summaryrefslogtreecommitdiffstats
path: root/g10
diff options
context:
space:
mode:
Diffstat (limited to 'g10')
-rw-r--r--g10/ChangeLog8
-rw-r--r--g10/call-agent.c27
-rw-r--r--g10/main.h1
-rw-r--r--g10/misc.c33
-rw-r--r--g10/passphrase.c5
5 files changed, 12 insertions, 62 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index d7db690fc..50dca45ca 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,11 @@
+2009-03-31 Werner Koch <wk@g10code.com>
+
+ * passphrase.c (ask_passphrase): Use percent_plus_unescape.
+ * misc.c (unescape_percent_string): Remove.
+
+ * call-agent.c (unescape_status_string): Chnage to use
+ percent_plus_unescape.
+
2009-03-25 Werner Koch <wk@g10code.com>
* mainproc.c (print_pkenc_list): Use snprintf.
diff --git a/g10/call-agent.c b/g10/call-agent.c
index b6c61aa0e..444048a47 100644
--- a/g10/call-agent.c
+++ b/g10/call-agent.c
@@ -116,32 +116,7 @@ start_agent (void)
static char *
unescape_status_string (const unsigned char *s)
{
- char *buffer, *d;
-
- buffer = d = xtrymalloc (strlen (s)+1);
- if (!buffer)
- return NULL;
- 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;
+ return percent_plus_unescape (s, 0xff);
}
diff --git a/g10/main.h b/g10/main.h
index 706162529..1e5cad4bf 100644
--- a/g10/main.h
+++ b/g10/main.h
@@ -135,7 +135,6 @@ 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);
int has_invalid_email_chars (const char *s);
int is_valid_mailbox (const char *name);
const char *get_libexecdir (void);
diff --git a/g10/misc.c b/g10/misc.c
index b0e5e2ce1..80a8a74ca 100644
--- a/g10/misc.c
+++ b/g10/misc.c
@@ -1215,39 +1215,6 @@ 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;
-}
-
-
/* Check whether the string has characters not valid in an RFC-822
address. To cope with OpenPGP we ignore allow non-ascii characters
so that for example umlauts are legal in an email address. An
diff --git a/g10/passphrase.c b/g10/passphrase.c
index 0950581c9..8b952f72a 100644
--- a/g10/passphrase.c
+++ b/g10/passphrase.c
@@ -453,8 +453,9 @@ ask_passphrase (const char *description,
{
if (strchr (description, '%'))
{
- char *tmp = unescape_percent_string
- ((const unsigned char*)description);
+ char *tmp = percent_plus_unescape (description, 0xff);
+ if (!tmp)
+ log_fatal(_("out of core\n"));
tty_printf ("\n%s\n", tmp);
xfree (tmp);
}