Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/crypto/external/bsd/netpgp/dist/src/lib when matching pubkey...
details: https://anonhg.NetBSD.org/src/rev/0f9735545ee3
branches: trunk
changeset: 767873:0f9735545ee3
user: agc <agc%NetBSD.org@localhost>
date: Tue Aug 02 05:36:45 2011 +0000
description:
when matching pubkeys, also return the first (pgp) uid for the key in the
resultant key listing
when using json to format keys returned from libnetpgp, also prepare for
machine-readable format ("mr") as well as human ("human"), even though
it's not yet used.
diffstat:
crypto/external/bsd/netpgp/dist/src/lib/netpgp.c | 32 ++++++++++++++---------
1 files changed, 19 insertions(+), 13 deletions(-)
diffs (78 lines):
diff -r 7b77fff7fea3 -r 0f9735545ee3 crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
--- a/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Tue Aug 02 05:17:18 2011 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Tue Aug 02 05:36:45 2011 +0000
@@ -34,7 +34,7 @@
#if defined(__NetBSD__)
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: netpgp.c,v 1.92 2011/06/28 03:35:28 agc Exp $");
+__RCSID("$NetBSD: netpgp.c,v 1.93 2011/08/02 05:36:45 agc Exp $");
#endif
#include <sys/types.h>
@@ -1028,9 +1028,10 @@
netpgp_match_keys_json(netpgp_t *netpgp, char **json, char *name, const char *fmt, const int psigs)
{
const pgp_key_t *key;
- unsigned k;
- mj_t id_array;
- int ret;
+ unsigned k;
+ mj_t id_array;
+ char *newkey;
+ int ret;
if (name[0] == '0' && name[1] == 'x') {
name += 2;
@@ -1044,11 +1045,13 @@
name, &k);
if (key != NULL) {
if (strcmp(fmt, "mr") == 0) {
-#if 0
pgp_hkp_sprint_keydata(netpgp->io, netpgp->pubring,
- key, &pubs.v[pubs.c],
- &key->key.pubkey, psigs);
-#endif
+ key, &newkey,
+ &key->key.pubkey, 0);
+ if (newkey) {
+ printf("%s\n", newkey);
+ free(newkey);
+ }
} else {
ALLOC(mj_t, id_array.value.v, id_array.size,
id_array.c, 10, 10, "netpgp_match_keys_json", return 0);
@@ -1070,9 +1073,10 @@
netpgp_match_pubkeys(netpgp_t *netpgp, char *name, void *vp)
{
const pgp_key_t *key;
- unsigned k;
- strings_t pubs;
- FILE *fp = (FILE *)vp;
+ unsigned k;
+ strings_t pubs;
+ ssize_t cc;
+ FILE *fp = (FILE *)vp;
(void) memset(&pubs, 0x0, sizeof(pubs));
do {
@@ -1083,7 +1087,9 @@
ALLOC(char *, pubs.v, pubs.size, pubs.c, 10, 10,
"netpgp_match_pubkeys", return 0);
- (void) pgp_sprint_pubkey(key, out, sizeof(out));
+ cc = pgp_sprint_pubkey(key, out, sizeof(out));
+ (void) snprintf(&out[cc], sizeof(out) - cc, "name=%s\n",
+ key->uids[0]);
pubs.v[pubs.c++] = netpgp_strdup(out);
k += 1;
}
@@ -1116,7 +1122,7 @@
netpgp_get_key(netpgp_t *netpgp, const char *name, const char *fmt)
{
const pgp_key_t *key;
- char *newkey;
+ char *newkey;
if ((key = resolve_userid(netpgp, netpgp->pubring, name)) == NULL) {
return NULL;
Home |
Main Index |
Thread Index |
Old Index