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.
+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
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)
GpgmeError
_gpgme_gpgsm_check_version (void)
{
- return _gpgme_compare_versions (_gpgme_gpgsm_get_version (),
+ return _gpgme_compare_versions (_gpgme_gpgsm_get_version (),
NEED_GPGSM_VERSION)
? 0 : mk_error (Invalid_Engine);
}
{
AssuanError err;
- err = _assuan_write_line (ctx, line);
+ err = assuan_write_line (ctx, line);
if (err)
return err;
{
char *line;
+ if (!pattern)
+ pattern = "";
+
line = xtrymalloc (9 + strlen (pattern) + 1); /* "LISTKEYS " + p + '\0'. */
if (!line)
return mk_error (Out_Of_Core);
}
if (!err)
- err = _assuan_write_line (gpgsm->assuan_ctx, gpgsm->command);
+ err = assuan_write_line (gpgsm->assuan_ctx, gpgsm->command);
return err;
}
}
+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
}
}
*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;
} gloflags;
unsigned int ref_count;
unsigned int secret:1;
+ unsigned int x509:1;
struct subkey_s keys;
struct user_id_s *uids;
};
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;
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;
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;
pend = NULL; /* we can stop here */
break;
}
- }
+ }
else if ( (rectype == RT_SUB || rectype== RT_SSB) && sk ) {
switch (field) {
case 2: /* trust info */