* 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>
|
2001-12-05 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
* engine-gpgsm.c (gpgsm_status_handler): Make it work with current
|
* engine-gpgsm.c (gpgsm_status_handler): Make it work with current
|
||||||
|
@ -86,7 +86,8 @@ struct gpgsm_object_s
|
|||||||
const char *
|
const char *
|
||||||
_gpgme_gpgsm_get_version (void)
|
_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. */
|
/* FIXME: Locking. */
|
||||||
if (!gpgsm_version)
|
if (!gpgsm_version)
|
||||||
@ -195,7 +196,7 @@ gpgsm_assuan_simple_command (ASSUAN_CONTEXT ctx, char *line)
|
|||||||
{
|
{
|
||||||
AssuanError err;
|
AssuanError err;
|
||||||
|
|
||||||
err = _assuan_write_line (ctx, line);
|
err = assuan_write_line (ctx, line);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
@ -378,6 +379,9 @@ _gpgme_gpgsm_op_keylist (GpgsmObject gpgsm, const char *pattern,
|
|||||||
{
|
{
|
||||||
char *line;
|
char *line;
|
||||||
|
|
||||||
|
if (!pattern)
|
||||||
|
pattern = "";
|
||||||
|
|
||||||
line = xtrymalloc (9 + strlen (pattern) + 1); /* "LISTKEYS " + p + '\0'. */
|
line = xtrymalloc (9 + strlen (pattern) + 1); /* "LISTKEYS " + p + '\0'. */
|
||||||
if (!line)
|
if (!line)
|
||||||
return mk_error (Out_Of_Core);
|
return mk_error (Out_Of_Core);
|
||||||
@ -575,7 +579,7 @@ _gpgme_gpgsm_start (GpgsmObject gpgsm, void *opaque)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!err)
|
if (!err)
|
||||||
err = _assuan_write_line (gpgsm->assuan_ctx, gpgsm->command);
|
err = assuan_write_line (gpgsm->assuan_ctx, gpgsm->command);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
22
gpgme/key.c
22
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
|
* Take a name from the --with-colon listing, remove certain escape sequences
|
||||||
* sequences and put it into the list of UIDs
|
* sequences and put it into the list of UIDs
|
||||||
@ -531,6 +550,9 @@ _gpgme_key_append_name ( GpgmeKey key, const char *s )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
*d++ = 0;
|
*d++ = 0;
|
||||||
|
if (key->x509)
|
||||||
|
parse_x509_user_id (uid, d);
|
||||||
|
else
|
||||||
parse_user_id (uid, d);
|
parse_user_id (uid, d);
|
||||||
|
|
||||||
uid->next = key->uids;
|
uid->next = key->uids;
|
||||||
|
@ -57,6 +57,7 @@ struct gpgme_key_s {
|
|||||||
} gloflags;
|
} gloflags;
|
||||||
unsigned int ref_count;
|
unsigned int ref_count;
|
||||||
unsigned int secret:1;
|
unsigned int secret:1;
|
||||||
|
unsigned int x509:1;
|
||||||
struct subkey_s keys;
|
struct subkey_s keys;
|
||||||
struct user_id_s *uids;
|
struct user_id_s *uids;
|
||||||
};
|
};
|
||||||
|
@ -146,7 +146,7 @@ keylist_colon_handler ( GpgmeCtx ctx, char *line )
|
|||||||
char *p, *pend;
|
char *p, *pend;
|
||||||
int field = 0;
|
int field = 0;
|
||||||
enum {
|
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;
|
} rectype = RT_NONE;
|
||||||
GpgmeKey key = ctx->tmp_key;
|
GpgmeKey key = ctx->tmp_key;
|
||||||
int i;
|
int i;
|
||||||
@ -211,13 +211,26 @@ keylist_colon_handler ( GpgmeCtx ctx, char *line )
|
|||||||
assert ( !ctx->tmp_key );
|
assert ( !ctx->tmp_key );
|
||||||
ctx->tmp_key = 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 )
|
else if ( !strcmp ( p, "fpr" ) && key )
|
||||||
rectype = RT_FPR;
|
rectype = RT_FPR;
|
||||||
else
|
else
|
||||||
rectype = RT_NONE;
|
rectype = RT_NONE;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ( rectype == RT_PUB || rectype == RT_SEC ) {
|
else if ( rectype == RT_PUB || rectype == RT_SEC || rectype == RT_CRT)
|
||||||
|
{
|
||||||
switch (field) {
|
switch (field) {
|
||||||
case 2: /* trust info */
|
case 2: /* trust info */
|
||||||
trust_info = p;
|
trust_info = p;
|
||||||
@ -242,11 +255,14 @@ keylist_colon_handler ( GpgmeCtx ctx, char *line )
|
|||||||
break;
|
break;
|
||||||
case 7: /* valid for n days */
|
case 7: /* valid for n days */
|
||||||
break;
|
break;
|
||||||
case 8: /* reserved (LID) */
|
case 8: /* X.509 serial number */
|
||||||
|
/* fixme: store it */
|
||||||
break;
|
break;
|
||||||
case 9: /* ownertrust */
|
case 9: /* ownertrust */
|
||||||
break;
|
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;
|
break;
|
||||||
case 11: /* signature class */
|
case 11: /* signature class */
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user