From 5bc9948f699b70c76dc0c7c406817d077b61317d Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 5 Dec 2008 16:31:39 +0000 Subject: Add a custom prompt for the CSR generation. Add a new percent escape fucntion. --- g10/ChangeLog | 6 ++++++ g10/call-agent.c | 14 +++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'g10') diff --git a/g10/ChangeLog b/g10/ChangeLog index eec3d6f0b..0ad19abaf 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,9 @@ +2008-12-05 Werner Koch + + * call-agent.c (percent_plus_escape): Rename to + my_percent_plus_escape and also escape the percent character. + Change all callers. + 2008-11-18 Werner Koch * gpg.c (build_lib_list): Remove. diff --git a/g10/call-agent.c b/g10/call-agent.c index 15c17b038..33025ef27 100644 --- a/g10/call-agent.c +++ b/g10/call-agent.c @@ -148,15 +148,15 @@ unescape_status_string (const unsigned char *s) escaping. Note that the provided buffer needs to be 3 times the size of ATEXT plus 1. Returns a pointer to the leading Nul in P. */ static char * -percent_plus_escape (char *p, const char *atext) +my_percent_plus_escape (char *p, const char *atext) { const unsigned char *s; for (s=atext; *s; s++) { - if (*s < ' ' || *s == '+') + if (*s < ' ' || *s == '+' || *s == '%') { - sprintf (p, "%%%02X", *s); + snprintf (p, 4, "%%%02X", *s); p += 3; } else if (*s == ' ') @@ -865,25 +865,25 @@ agent_get_passphrase (const char *cache_id, p = stpcpy (line, cmd); if (cache_id && *cache_id) - p = percent_plus_escape (p, cache_id); + p = my_percent_plus_escape (p, cache_id); else *p++ = 'X'; *p++ = ' '; if (err_msg && *err_msg) - p = percent_plus_escape (p, err_msg); + p = my_percent_plus_escape (p, err_msg); else *p++ = 'X'; *p++ = ' '; if (prompt && *prompt) - p = percent_plus_escape (p, prompt); + p = my_percent_plus_escape (p, prompt); else *p++ = 'X'; *p++ = ' '; if (desc_msg && *desc_msg) - p = percent_plus_escape (p, desc_msg); + p = my_percent_plus_escape (p, desc_msg); else *p++ = 'X'; *p = 0; -- cgit v1.2.3