gnupg (7 files)
cvs user wk
cvs at cvs.gnupg.org
Tue May 24 14:19:27 CEST 2005
Date: Tuesday, May 24, 2005 @ 14:39:42
Author: wk
Path: /cvs/gnupg/gnupg
Modified: NEWS g10/ChangeLog g10/app-openpgp.c g10/cardglue.c g10/main.h
g10/misc.c g10/passphrase.c
* 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.
-------------------+
NEWS | 14 +++++++-------
g10/ChangeLog | 5 +++++
g10/app-openpgp.c | 6 +++---
g10/cardglue.c | 46 ++++++----------------------------------------
g10/main.h | 2 +-
g10/misc.c | 35 +++++++++++++++++++++++++++++++++++
g10/passphrase.c | 11 ++++++++++-
7 files changed, 67 insertions(+), 52 deletions(-)
Index: gnupg/NEWS
diff -u gnupg/NEWS:1.240 gnupg/NEWS:1.241
--- gnupg/NEWS:1.240 Sat May 21 16:04:32 2005
+++ gnupg/NEWS Tue May 24 14:39:42 2005
@@ -8,13 +8,13 @@
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.
Index: gnupg/g10/ChangeLog
diff -u gnupg/g10/ChangeLog:1.741 gnupg/g10/ChangeLog:1.742
--- gnupg/g10/ChangeLog:1.741 Tue May 24 11:14:31 2005
+++ gnupg/g10/ChangeLog Tue May 24 14:39:42 2005
@@ -1,5 +1,10 @@
2005-05-24 Werner Koch <wk at g10code.com>
+ * 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 <wk at g10code.com>
Index: gnupg/g10/app-openpgp.c
diff -u gnupg/g10/app-openpgp.c:1.28 gnupg/g10/app-openpgp.c:1.29
--- gnupg/g10/app-openpgp.c:1.28 Mon May 23 22:16:21 2005
+++ gnupg/g10/app-openpgp.c Tue May 24 14:39:42 2005
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: app-openpgp.c,v 1.28 2005/05/23 20:16:21 wk Exp $
+ * $Id: app-openpgp.c,v 1.29 2005/05/24 12:39:42 wk Exp $
*/
#include <config.h>
@@ -1528,7 +1528,7 @@
/* 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 @@
{
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)
Index: gnupg/g10/cardglue.c
diff -u gnupg/g10/cardglue.c:1.30 gnupg/g10/cardglue.c:1.31
--- gnupg/g10/cardglue.c:1.30 Mon May 23 22:16:21 2005
+++ gnupg/g10/cardglue.c Tue May 24 14:39:42 2005
@@ -540,40 +540,6 @@
}
-
-/* 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 @@
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 @@
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 @@
{
char *p, *buf;
- buf = p = unescape_status_string (line);
+ buf = p = unescape_percent_string (line);
if (buf)
{
while (spacep (p))
@@ -739,7 +705,7 @@
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;
Index: gnupg/g10/main.h
diff -u gnupg/g10/main.h:1.130 gnupg/g10/main.h:1.131
--- gnupg/g10/main.h:1.130 Fri May 20 22:37:08 2005
+++ gnupg/g10/main.h Tue May 24 14:39:42 2005
@@ -123,7 +123,7 @@
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);
Index: gnupg/g10/misc.c
diff -u gnupg/g10/misc.c:1.67 gnupg/g10/misc.c:1.68
--- gnupg/g10/misc.c:1.67 Mon Apr 11 20:24:09 2005
+++ gnupg/g10/misc.c Tue May 24 14:39:42 2005
@@ -1029,6 +1029,41 @@
}
+/* 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
Index: gnupg/g10/passphrase.c
diff -u gnupg/g10/passphrase.c:1.79 gnupg/g10/passphrase.c:1.80
--- gnupg/g10/passphrase.c:1.79 Fri May 20 22:37:08 2005
+++ gnupg/g10/passphrase.c Tue May 24 14:39:42 2005
@@ -746,7 +746,16 @@
*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 )
More information about the Gnupg-commits
mailing list