* engine-gpgsm.c (_gpgme_gpgsm_op_keylist): Allow NULL for
pattern. (gpgsm_assuan_simple_command): Removed underscore from assuan_write_line. (_gpgme_gpgsm_start): Ditto. * keylist.c (keylist_colon_handler): Handle "crt" records * key.h (gpgme_key_s): Add an x509 flag. * key.c (parse_x509_user_id): New. (_gpgme_key_append_name): Handle x.509 names. However, it does not yet work.
This commit is contained in:
parent
3de2384ea5
commit
0b11af59c7
@ -1,3 +1,16 @@
|
||||
2001-12-13 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* engine-gpgsm.c (_gpgme_gpgsm_op_keylist): Allow NULL for
|
||||
pattern.
|
||||
(gpgsm_assuan_simple_command): Removed underscore from
|
||||
assuan_write_line.
|
||||
(_gpgme_gpgsm_start): Ditto.
|
||||
|
||||
* keylist.c (keylist_colon_handler): Handle "crt" records
|
||||
* key.h (gpgme_key_s): Add an x509 flag.
|
||||
* key.c (parse_x509_user_id): New.
|
||||
(_gpgme_key_append_name): Handle x.509 names.
|
||||
|
||||
2001-12-05 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* engine-gpgsm.c (gpgsm_status_handler): Make it work with current
|
||||
|
@ -86,7 +86,8 @@ struct gpgsm_object_s
|
||||
const char *
|
||||
_gpgme_gpgsm_get_version (void)
|
||||
{
|
||||
static const char *gpgsm_version;
|
||||
#warning version check is disabled
|
||||
static const char *gpgsm_version = "0.0.1";
|
||||
|
||||
/* FIXME: Locking. */
|
||||
if (!gpgsm_version)
|
||||
@ -195,7 +196,7 @@ gpgsm_assuan_simple_command (ASSUAN_CONTEXT ctx, char *line)
|
||||
{
|
||||
AssuanError err;
|
||||
|
||||
err = _assuan_write_line (ctx, line);
|
||||
err = assuan_write_line (ctx, line);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@ -378,6 +379,9 @@ _gpgme_gpgsm_op_keylist (GpgsmObject gpgsm, const char *pattern,
|
||||
{
|
||||
char *line;
|
||||
|
||||
if (!pattern)
|
||||
pattern = "";
|
||||
|
||||
line = xtrymalloc (9 + strlen (pattern) + 1); /* "LISTKEYS " + p + '\0'. */
|
||||
if (!line)
|
||||
return mk_error (Out_Of_Core);
|
||||
@ -575,7 +579,7 @@ _gpgme_gpgsm_start (GpgsmObject gpgsm, void *opaque)
|
||||
}
|
||||
|
||||
if (!err)
|
||||
err = _assuan_write_line (gpgsm->assuan_ctx, gpgsm->command);
|
||||
err = assuan_write_line (gpgsm->assuan_ctx, gpgsm->command);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
24
gpgme/key.c
24
gpgme/key.c
@ -459,6 +459,25 @@ parse_user_id ( struct user_id_s *uid, char *tail )
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
parse_x509_user_id ( struct user_id_s *uid, char *tail )
|
||||
{
|
||||
const char *s;
|
||||
|
||||
s=uid->name;
|
||||
if (*s == '<' && s[strlen(s)-1] == '>')
|
||||
uid->email_part = s;
|
||||
|
||||
/* let unused parts point to an EOS */
|
||||
tail--;
|
||||
if (!uid->name_part)
|
||||
uid->name_part = tail;
|
||||
if (!uid->email_part)
|
||||
uid->email_part = tail;
|
||||
if (!uid->comment_part)
|
||||
uid->comment_part = tail;
|
||||
}
|
||||
|
||||
/*
|
||||
* Take a name from the --with-colon listing, remove certain escape sequences
|
||||
* sequences and put it into the list of UIDs
|
||||
@ -531,7 +550,10 @@ _gpgme_key_append_name ( GpgmeKey key, const char *s )
|
||||
}
|
||||
}
|
||||
*d++ = 0;
|
||||
parse_user_id ( uid, d );
|
||||
if (key->x509)
|
||||
parse_x509_user_id (uid, d);
|
||||
else
|
||||
parse_user_id (uid, d);
|
||||
|
||||
uid->next = key->uids;
|
||||
key->uids = uid;
|
||||
|
@ -57,6 +57,7 @@ struct gpgme_key_s {
|
||||
} gloflags;
|
||||
unsigned int ref_count;
|
||||
unsigned int secret:1;
|
||||
unsigned int x509:1;
|
||||
struct subkey_s keys;
|
||||
struct user_id_s *uids;
|
||||
};
|
||||
|
@ -146,7 +146,7 @@ keylist_colon_handler ( GpgmeCtx ctx, char *line )
|
||||
char *p, *pend;
|
||||
int field = 0;
|
||||
enum {
|
||||
RT_NONE, RT_SIG, RT_UID, RT_SUB, RT_PUB, RT_FPR, RT_SSB, RT_SEC
|
||||
RT_NONE, RT_SIG, RT_UID, RT_SUB, RT_PUB, RT_FPR, RT_SSB, RT_SEC, RT_CRT
|
||||
} rectype = RT_NONE;
|
||||
GpgmeKey key = ctx->tmp_key;
|
||||
int i;
|
||||
@ -211,13 +211,26 @@ keylist_colon_handler ( GpgmeCtx ctx, char *line )
|
||||
assert ( !ctx->tmp_key );
|
||||
ctx->tmp_key = key;
|
||||
}
|
||||
else if ( !strcmp (p, "crt") ) {
|
||||
/* start a new certificate */
|
||||
if ( _gpgme_key_new ( &key ) ) {
|
||||
ctx->out_of_core=1; /* the only kind of error we can get*/
|
||||
return;
|
||||
}
|
||||
key->x509 = 1;
|
||||
rectype = RT_CRT;
|
||||
finish_key ( ctx );
|
||||
assert ( !ctx->tmp_key );
|
||||
ctx->tmp_key = key;
|
||||
}
|
||||
else if ( !strcmp ( p, "fpr" ) && key )
|
||||
rectype = RT_FPR;
|
||||
else
|
||||
rectype = RT_NONE;
|
||||
|
||||
}
|
||||
else if ( rectype == RT_PUB || rectype == RT_SEC ) {
|
||||
else if ( rectype == RT_PUB || rectype == RT_SEC || rectype == RT_CRT)
|
||||
{
|
||||
switch (field) {
|
||||
case 2: /* trust info */
|
||||
trust_info = p;
|
||||
@ -242,11 +255,14 @@ keylist_colon_handler ( GpgmeCtx ctx, char *line )
|
||||
break;
|
||||
case 7: /* valid for n days */
|
||||
break;
|
||||
case 8: /* reserved (LID) */
|
||||
case 8: /* X.509 serial number */
|
||||
/* fixme: store it */
|
||||
break;
|
||||
case 9: /* ownertrust */
|
||||
break;
|
||||
case 10: /* not used due to --fixed-list-mode option */
|
||||
case 10: /* not used for gpg due to --fixed-list-mode option
|
||||
but gpgsm stores the issuer name */
|
||||
/* fixme: store issuer name */
|
||||
break;
|
||||
case 11: /* signature class */
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user