gPass

gPass Commit Details

Date:2017-07-08 08:37:16 (1 year 11 months ago)
Author:Grégory Soutadé
Branch:master
Commit:0caa8a66e1da00a9772df6e1e8024e2190e3a636
Parents: 35f49d24b32cdbc9b24661373eca3f4580cf3192
Message:Handle Ctrl+C and Ctrl+Z in gpass_cli

Changes:
Mcli/main.c (4 diffs)

File differences

cli/main.c
2121
2222
2323
24
2425
2526
2627
......
7172
7273
7374
75
76
77
78
79
80
7481
7582
7683
7784
7885
79
86
8087
8188
8289
......
8592
8693
8794
88
95
8996
9097
9198
......
695702
696703
697704
705
706
707
708
709
698710
699711
700712
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <curl/curl.h>
#include <openssl/opensslv.h>
static const EVP_MD * s_md_256;
static EVP_CIPHER_CTX * s_cipher_ctx;
static int s_stop_display = 0;
static void signal_handler(int signum)
{
s_stop_display = 1;
}
static void display_password(char* password, int time)
{
int length;
for (; time; time--)
for (; time && !s_stop_display; time--)
{
printf("\r(%02d) Password found: %s", time, password);
fflush(stdout);
// Clear line
printf("\r");
length = 4 + 17 + strlen(password) + 1;
length = 4 + 17 + strlen(password) + 1 + 1 /* For Ctrl+Z/C */;
while (length--)
printf(" ");
printf("\n");
params.orig_master_key = strdup(tmp);
derive_master_key(&params);
// Ctrl+C
signal(SIGINT, signal_handler);
// Ctrl+Z
signal(SIGTSTP, signal_handler);
ret = ask_server(&params);
// try again with new parameters

Archive Download the corresponding diff file