aboutsummaryrefslogtreecommitdiffstats
path: root/sm/certdump.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2008-12-05 16:31:39 +0000
committerWerner Koch <[email protected]>2008-12-05 16:31:39 +0000
commit5bc9948f699b70c76dc0c7c406817d077b61317d (patch)
tree2c59e77471cbf6f02fea58466c4b5544a9b74cad /sm/certdump.c
parentAdd option --card-timeout. (diff)
downloadgnupg-5bc9948f699b70c76dc0c7c406817d077b61317d.tar.gz
gnupg-5bc9948f699b70c76dc0c7c406817d077b61317d.zip
Add a custom prompt for the CSR generation.
Add a new percent escape fucntion.
Diffstat (limited to 'sm/certdump.c')
-rw-r--r--sm/certdump.c31
1 files changed, 3 insertions, 28 deletions
diff --git a/sm/certdump.c b/sm/certdump.c
index ddfc1d120..71907d188 100644
--- a/sm/certdump.c
+++ b/sm/certdump.c
@@ -924,13 +924,12 @@ gpgsm_fpr_and_name_for_status (ksba_cert_t cert)
/* Create a key description for the CERT, this may be passed to the
- pinentry. The caller must free the returned string. NULL may be
+ pinentry. The caller must free the returned string. NULL may be
returned on error. */
char *
gpgsm_format_keydesc (ksba_cert_t cert)
{
- char *name, *subject, *buffer, *p;
- const char *s;
+ char *name, *subject, *buffer;
ksba_isotime_t t;
char created[20];
char expires[20];
@@ -939,10 +938,8 @@ gpgsm_format_keydesc (ksba_cert_t cert)
char *orig_codeset;
name = ksba_cert_get_subject (cert, 0);
- log_printhex ("XXXX NAME: ", name, strlen (name));
subject = name? gpgsm_format_name2 (name, 0) : NULL;
ksba_free (name); name = NULL;
- log_printhex ("YYYY NAME: ", subject, strlen (subject));
sexp = ksba_cert_get_serial (cert);
sn = sexp? gpgsm_format_serial (sexp) : NULL;
@@ -975,38 +972,16 @@ gpgsm_format_keydesc (ksba_cert_t cert)
if (!name)
{
- int save_errno = errno;
xfree (subject);
xfree (sn);
- errno = save_errno;
return NULL;
}
xfree (subject);
xfree (sn);
- buffer = p = xtrymalloc (strlen (name) * 3 + 1);
- for (s=name; *s; s++)
- {
- /* We also escape the quote character to work around a bug in
- the mingw32 runtime which does not correcty handle command
- line quoting. We correctly double the quote mark when
- calling a program (i.e. gpg-protect-tool), but the pre-main
- code does not notice the double quote as an escaped
- quote. */
- if (*s < ' ' || *s == '+' || *s == '\"')
- {
- sprintf (p, "%%%02X", *(unsigned char *)s);
- p += 3;
- }
- else if (*s == ' ')
- *p++ = '+';
- else
- *p++ = *s;
- }
- *p = 0;
+ buffer = percent_plus_escape (name);
xfree (name);
-
return buffer;
}