From: Werner Koch Date: Tue, 29 Jan 2002 10:04:41 +0000 (+0000) Subject: * engine-gpgsm.c (_gpgme_gpgsm_op_keylist): Implement secret only mode. X-Git-Tag: gpgme-1.2.0@1385~1127 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6d63be444f34c4f9af05cc459c9a520956a4a4c3;p=gpgme.git * engine-gpgsm.c (_gpgme_gpgsm_op_keylist): Implement secret only mode. * keylist.c (keylist_colon_handler): Add support for the new "crs" record type. --- diff --git a/trunk/gpgme/ChangeLog b/trunk/gpgme/ChangeLog index 1dc060c..7f485c0 100644 --- a/trunk/gpgme/ChangeLog +++ b/trunk/gpgme/ChangeLog @@ -1,3 +1,10 @@ +2002-01-29 Werner Koch + + * engine-gpgsm.c (_gpgme_gpgsm_op_keylist): Implement secret only mode. + + * keylist.c (keylist_colon_handler): Add support for the new "crs" + record type. + 2002-01-22 Marcus Brinkmann * engine-gpgsm.c (_gpgme_gpgsm_release): Call assuan_disconnect, diff --git a/trunk/gpgme/engine-gpgsm.c b/trunk/gpgme/engine-gpgsm.c index b66ceaa..51e62fd 100644 --- a/trunk/gpgme/engine-gpgsm.c +++ b/trunk/gpgme/engine-gpgsm.c @@ -433,11 +433,19 @@ _gpgme_gpgsm_op_keylist (GpgsmObject gpgsm, const char *pattern, if (!pattern) pattern = ""; - line = xtrymalloc (9 + strlen (pattern) + 1); /* "LISTKEYS " + p + '\0'. */ + line = xtrymalloc (15 + strlen (pattern) + 1); /* "LISTSECRETKEYS "+p+'\0'.*/ if (!line) return mk_error (Out_Of_Core); - strcpy (line, "LISTKEYS "); - strcpy (&line[9], pattern); + if (secret_only) + { + strcpy (line, "LISTSECRETKEYS "); + strcpy (&line[15], pattern); + } + else + { + strcpy (line, "LISTKEYS "); + strcpy (&line[9], pattern); + } _gpgme_io_close (gpgsm->input_fd); _gpgme_io_close (gpgsm->output_fd); diff --git a/trunk/gpgme/keylist.c b/trunk/gpgme/keylist.c index b9907a4..133da5d 100644 --- a/trunk/gpgme/keylist.c +++ b/trunk/gpgme/keylist.c @@ -146,7 +146,8 @@ 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_CRT + RT_NONE, RT_SIG, RT_UID, RT_SUB, RT_PUB, RT_FPR, RT_SSB, RT_SEC, + RT_CRT, RT_CRS } rectype = RT_NONE; GpgmeKey key = ctx->tmp_key; int i; @@ -223,13 +224,26 @@ keylist_colon_handler ( GpgmeCtx ctx, char *line ) assert ( !ctx->tmp_key ); ctx->tmp_key = key; } + else if ( !strcmp (p, "crs") ) { + /* start a new certificate */ + if ( _gpgme_key_new_secret ( &key ) ) { + ctx->out_of_core=1; /* the only kind of error we can get*/ + return; + } + key->x509 = 1; + rectype = RT_CRS; + 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 || rectype == RT_CRT) + else if ( rectype == RT_PUB || rectype == RT_SEC + || rectype == RT_CRT || rectype == RT_CRS) { switch (field) { case 2: /* trust info */