diff options
Diffstat (limited to '')
-rw-r--r-- | NEWS | 14 | ||||
-rw-r--r-- | g10/ChangeLog | 5 | ||||
-rw-r--r-- | g10/app-openpgp.c | 4 | ||||
-rw-r--r-- | g10/cardglue.c | 46 | ||||
-rw-r--r-- | g10/main.h | 2 | ||||
-rw-r--r-- | g10/misc.c | 35 | ||||
-rw-r--r-- | g10/passphrase.c | 11 |
7 files changed, 66 insertions, 51 deletions
@@ -8,13 +8,13 @@ Noteworthy changes in version 1.4.2 allows displayin the Private-DO-4 with the "list" command. * Rewrote large parts of the card code to optionally make use of a - running gpg-agent. If --use-agent is beeing used and a - gpg-agent with enabled scdaemon is active, gpg will now divert - all card operations to that daemon. This is required because - bot, scdaemon and gpg require exclusive access to the card - reader. By delegating the work to scdaemon, both can peacefully - coexist and scdaemon is able to control the use of the reader. - Note that this requires at least gnupg 1.9.17. + running gpg-agent. If --use-agent is being used and a gpg-agent + with enabled scdaemon is active, gpg will now divert all card + operations to that daemon. This is required because bot, + scdaemon and gpg require exclusive access to the card reader. By + delegating the work to scdaemon, both can peacefully coexist and + scdaemon is able to control the use of the reader. Note that + this requires at least gnupg 1.9.17. * Fixed a couple of problems with the card reader. diff --git a/g10/ChangeLog b/g10/ChangeLog index 86bdce93e..12c1702b1 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,5 +1,10 @@ 2005-05-24 Werner Koch <[email protected]> + * passphrase.c (ask_passphrase): Unescape the description string. + * cardglue.c (unescape_status_string): Removed. Changed all + caller to use ... + * misc.c (unescape_percent_string): New. + * g10.c (add_notation_data): Check number of at-signs. 2005-05-23 Werner Koch <[email protected]> diff --git a/g10/app-openpgp.c b/g10/app-openpgp.c index 91e208a0a..14483869b 100644 --- a/g10/app-openpgp.c +++ b/g10/app-openpgp.c @@ -1528,7 +1528,7 @@ do_change_pin (app_t app, ctrl_t ctrl, const char *chvnostr, int reset_mode, /* Check whether a key already exists. KEYIDX is the index of the key - (0..2). If FORCE is TRUE a diagnositivc will be printed but no + (0..2). If FORCE is TRUE a diagnositic will be printed but no error returned if the key already exists. */ static gpg_error_t does_key_exist (app_t app, int keyidx, int force) @@ -2134,7 +2134,7 @@ do_sign (app_t app, const char *keyidstr, int hashalgo, { char *prompt; -#define PROMPTSTRING _("PIN [sigs done: %lu]") +#define PROMPTSTRING _("||Please enter the PIN%%0A[sigs done: %lu]") prompt = malloc (strlen (PROMPTSTRING) + 50); if (!prompt) diff --git a/g10/cardglue.c b/g10/cardglue.c index f8272ecd2..a4ecee06f 100644 --- a/g10/cardglue.c +++ b/g10/cardglue.c @@ -540,40 +540,6 @@ check_card_serialno (app_t app, const char *serialno) } - -/* Return a new malloced string by unescaping the string S. Escaping - is percent escaping and '+'/space mapping. A binary nul will - silently be replaced by a 0xFF. Function returns NULL to indicate - an out of memory status. */ -static char * -unescape_status_string (const unsigned char *s) -{ - char *buffer, *d; - - buffer = d = xmalloc (strlen (s)+1); - while (*s) - { - if (*s == '%' && s[1] && s[2]) - { - s++; - *d = xtoi_2 (s); - if (!*d) - *d = '\xff'; - d++; - s += 2; - } - else if (*s == '+') - { - *d++ = ' '; - s++; - } - else - *d++ = *s++; - } - *d = 0; - return buffer; -} - /* Take a 20 byte hexencoded string and put it into the the provided 20 byte buffer FPR in binary format. */ static int @@ -633,12 +599,12 @@ learn_status_cb (void *opaque, const char *line) else if (keywordlen == 9 && !memcmp (keyword, "DISP-NAME", keywordlen)) { xfree (parm->disp_name); - parm->disp_name = unescape_status_string (line); + parm->disp_name = unescape_percent_string (line); } else if (keywordlen == 9 && !memcmp (keyword, "DISP-LANG", keywordlen)) { xfree (parm->disp_lang); - parm->disp_lang = unescape_status_string (line); + parm->disp_lang = unescape_percent_string (line); } else if (keywordlen == 8 && !memcmp (keyword, "DISP-SEX", keywordlen)) { @@ -647,12 +613,12 @@ learn_status_cb (void *opaque, const char *line) else if (keywordlen == 10 && !memcmp (keyword, "PUBKEY-URL", keywordlen)) { xfree (parm->pubkey_url); - parm->pubkey_url = unescape_status_string (line); + parm->pubkey_url = unescape_percent_string (line); } else if (keywordlen == 10 && !memcmp (keyword, "LOGIN-DATA", keywordlen)) { xfree (parm->login_data); - parm->login_data = unescape_status_string (line); + parm->login_data = unescape_percent_string (line); } else if (keywordlen == 11 && !memcmp (keyword, "SIG-COUNTER", keywordlen)) { @@ -662,7 +628,7 @@ learn_status_cb (void *opaque, const char *line) { char *p, *buf; - buf = p = unescape_status_string (line); + buf = p = unescape_percent_string (line); if (buf) { while (spacep (p)) @@ -739,7 +705,7 @@ learn_status_cb (void *opaque, const char *line) int no = keyword[11] - '1'; assert (no >= 0 && no <= 3); xfree (parm->private_do[no]); - parm->private_do[no] = unescape_status_string (line); + parm->private_do[no] = unescape_percent_string (line); } return 0; diff --git a/g10/main.h b/g10/main.h index 38c999bae..6c0925505 100644 --- a/g10/main.h +++ b/g10/main.h @@ -123,7 +123,7 @@ char *optsep(char **stringp); char *argsplit(char *string); int parse_options(char *str,unsigned int *options, struct parse_options *opts,int noisy); - +char *unescape_percent_string (const unsigned char *s); char *default_homedir (void); diff --git a/g10/misc.c b/g10/misc.c index 6e3dbce0b..175590ce2 100644 --- a/g10/misc.c +++ b/g10/misc.c @@ -1029,6 +1029,41 @@ parse_options(char *str,unsigned int *options, } +/* Return a new malloced string by unescaping the string S. Escaping + is percent escaping and '+'/space mapping. A binary nul will + silently be replaced by a 0xFF. */ +char * +unescape_percent_string (const unsigned char *s) +{ + char *buffer, *d; + + buffer = d = xmalloc (strlen (s)+1); + while (*s) + { + if (*s == '%' && s[1] && s[2]) + { + s++; + *d = xtoi_2 (s); + if (!*d) + *d = '\xff'; + d++; + s += 2; + } + else if (*s == '+') + { + *d++ = ' '; + s++; + } + else + *d++ = *s++; + } + *d = 0; + return buffer; +} + + + + /* This is a helper function to load a Windows function from either of one DLLs. */ #ifdef HAVE_W32_SYSTEM diff --git a/g10/passphrase.c b/g10/passphrase.c index 030d801b2..740ac549b 100644 --- a/g10/passphrase.c +++ b/g10/passphrase.c @@ -746,7 +746,16 @@ ask_passphrase (const char *description, *canceled = 0; if (!opt.batch && description) - tty_printf ("\n%s\n",description); + { + if (strchr (description, '%')) + { + char *tmp = unescape_percent_string (description); + tty_printf ("\n%s\n", tmp); + xfree (tmp); + } + else + tty_printf ("\n%s\n",description); + } agent_died: if ( opt.use_agent ) |