diff options
Diffstat (limited to 'common/simple-pwquery.c')
-rw-r--r-- | common/simple-pwquery.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/common/simple-pwquery.c b/common/simple-pwquery.c index e405c1ec0..f0c1cdc00 100644 --- a/common/simple-pwquery.c +++ b/common/simple-pwquery.c @@ -426,17 +426,19 @@ copy_and_escape (char *buffer, const char *text) /* Ask the gpg-agent for a passphrase and present the user with a - DESCRIPTION, a PROMPT and optiaonlly with a TRYAGAIN extra text. + DESCRIPTION, a PROMPT and optionally with a TRYAGAIN extra text. If a CACHEID is not NULL it is used to locate the passphrase in in - the cache and store it under this ID. If ERRORCODE is not NULL it - should point a variable receiving an errorcode; thsi errocode might - be 0 if the user canceled the operation. The function returns NULL - to indicate an error. */ + the cache and store it under this ID. If OPT_CHECK is true + gpg-agent is asked to apply some checks on the passphrase security. + If ERRORCODE is not NULL it should point a variable receiving an + errorcode; this errocode might be 0 if the user canceled the + operation. The function returns NULL to indicate an error. */ char * simple_pwquery (const char *cacheid, const char *tryagain, const char *prompt, const char *description, + int opt_check, int *errorcode) { int fd = -1; @@ -463,7 +465,7 @@ simple_pwquery (const char *cacheid, char *line; /* We allocate 3 times the needed space so that there is enough space for escaping. */ - line = spwq_malloc (15 + line = spwq_malloc (15 + 10 + 3*strlen (cacheid) + 1 + 3*strlen (tryagain) + 1 + 3*strlen (prompt) + 1 @@ -476,6 +478,8 @@ simple_pwquery (const char *cacheid, } strcpy (line, "GET_PASSPHRASE "); p = line+15; + if (opt_check) + p = stpcpy (p, "--check "); p = copy_and_escape (p, cacheid); *p++ = ' '; p = copy_and_escape (p, tryagain); |