diff options
author | Werner Koch <wk@gnupg.org> | 2002-10-04 07:43:54 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2002-10-04 07:43:54 +0200 |
commit | d68fe4f73d00cf13dddfd18bf08d4aded176fdad (patch) | |
tree | 84040ac7ab4d9fce578e09fe7396fb44a3579302 /g10/passphrase.c | |
parent | * options.h, g10.c (main): Add --strict and --no-strict to switch the (diff) | |
download | gnupg2-d68fe4f73d00cf13dddfd18bf08d4aded176fdad.tar.xz gnupg2-d68fe4f73d00cf13dddfd18bf08d4aded176fdad.zip |
* import.c (import_keys_internal): s/inp/inp2/ to avoid shadowing
warning.
* passphrase.c (agent_get_passphrase): Fixed signed/unsigned char
problem in %-escaping. Noted by Ingo Kl�cker.
Diffstat (limited to 'g10/passphrase.c')
-rw-r--r-- | g10/passphrase.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/g10/passphrase.c b/g10/passphrase.c index 0da40e3c0..d84d6e88b 100644 --- a/g10/passphrase.c +++ b/g10/passphrase.c @@ -732,6 +732,7 @@ agent_get_passphrase ( u32 *keyid, int mode, const char *tryagain_text ) else { /* The new Assuan protocol */ char *line, *p; + const unsigned char *s; int i; if (!tryagain_text) @@ -751,33 +752,33 @@ agent_get_passphrase ( u32 *keyid, int mode, const char *tryagain_text ) else *p++ = 'X'; /* no caching */ *p++ = ' '; - for (i=0; tryagain_text[i]; i++) + for (i=0, s=tryagain_text; *s; s++) { - if (tryagain_text[i] < ' ' || tryagain_text[i] == '+') + if (*s < ' ' || *s == '+') { - sprintf (p, "%%%02X", tryagain_text[i]); + sprintf (p, "%%%02X", *s); p += 3; } - else if (tryagain_text[i] == ' ') + else if (*s == ' ') *p++ = '+'; else - *p++ = tryagain_text[i]; + *p++ = *s; } *p++ = ' '; *p++ = 'X'; /* Use the standard prompt */ *p++ = ' '; /* copy description */ - for (i=0; atext[i]; i++) + for (i=0, s= atext; *s; s++) { - if (atext[i] < ' ' || atext[i] == '+') + if (*s < ' ' || *s == '+') { - sprintf (p, "%%%02X", atext[i]); + sprintf (p, "%%%02X", *s); p += 3; } - else if (atext[i] == ' ') + else if (*s == ' ') *p++ = '+'; else - *p++ = atext[i]; + *p++ = *s; } *p++ = '\n'; i = writen (fd, line, p - line); |