1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

* keylist.c (email_kludge): Reworked.

* certdump.c (gpgsm_print_serial, gpgsm_dump_serial): Cast printf
arg to unsigned.
* call-dirmngr.c (gpgsm_dirmngr_run_command): Ditto
This commit is contained in:
Werner Koch 2005-07-20 15:05:05 +00:00
parent 8889f4a2ee
commit 68191d0c93
11 changed files with 62 additions and 15 deletions

View file

@ -1,3 +1,11 @@
2005-07-20 Werner Koch <wk@g10code.com>
* keylist.c (email_kludge): Reworked.
* certdump.c (gpgsm_print_serial, gpgsm_dump_serial): Cast printf
arg to unsigned.
* call-dirmngr.c (gpgsm_dirmngr_run_command): Ditto
2005-07-19 Werner Koch <wk@g10code.com>
* fingerprint.c (gpgsm_get_certid): Cast printf arg to unsigned.

View file

@ -827,7 +827,7 @@ gpgsm_dirmngr_run_command (CTRL ctrl, const char *command,
*p++ = '+';
else if (!isprint (*s) || *s == '+')
{
sprintf (p, "%%%02X", *s);
sprintf (p, "%%%02X", *(const unsigned char *)s);
p += 3;
}
else

View file

@ -70,7 +70,7 @@ gpgsm_print_serial (FILE *fp, ksba_const_sexp_t sn)
else
{
for (p++; n; n--, p++)
fprintf (fp, "%02X", *p);
fprintf (fp, "%02X", *(const unsigned char*)p);
}
}
}
@ -98,7 +98,7 @@ gpgsm_dump_serial (ksba_const_sexp_t sn)
else
{
for (p++; n; n--, p++)
log_printf ("%02X", *p);
log_printf ("%02X", *(const unsigned char *)p);
}
}
}

View file

@ -251,30 +251,42 @@ print_time (gnupg_isotime_t t, FILE *fp)
}
/* return an allocated string with the email address extracted from a
/* Return an allocated string with the email address extracted from a
DN */
static char *
email_kludge (const char *name)
{
const char *p;
const char *p, *string;
unsigned char *buf;
int n;
if (strncmp (name, "1.2.840.113549.1.9.1=#", 22))
return NULL;
string = name;
for (;;)
{
p = strstr (string, "1.2.840.113549.1.9.1=#");
if (!p)
return NULL;
if (p == name || (p > string+1 && p[-1] == ',' && p[-2] != '\\'))
{
name = p + 22;
break;
}
string = p + 22;
}
/* This looks pretty much like an email address in the subject's DN
we use this to add an additional user ID entry. This way,
openSSL generated keys get a nicer and usable listing */
name += 22;
for (n=0, p=name; hexdigitp (p) && hexdigitp (p+1); p +=2, n++)
;
if (*p != '#' || !n)
if (!n)
return NULL;
buf = xtrymalloc (n+3);
if (!buf)
return NULL; /* oops, out of core */
*buf = '<';
for (n=1, p=name; *p != '#'; p +=2, n++)
for (n=1, p=name; hexdigitp (p); p +=2, n++)
buf[n] = xtoi_2 (p);
buf[n++] = '>';
buf[n] = 0;

View file

@ -1109,7 +1109,7 @@ write_status_text_and_buffer ( int no, const char *string,
if (s != buffer)
fwrite (buffer, s-buffer, 1, statusfp );
if ( esc ) {
fprintf (statusfp, "%%%02X", *(const byte*)s );
fprintf (statusfp, "%%%02X", *(const unsigned char*)s );
s++; n--;
}
buffer = s;