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 generating a ke...



details:   https://anonhg.NetBSD.org/src/rev/561af1ec1d80
branches:  trunk
changeset: 759207:561af1ec1d80
user:      agc <agc%NetBSD.org@localhost>
date:      Wed Dec 01 22:01:41 2010 +0000

description:
When generating a key, set the new key's userid (last 16 bytes of
fingerprint) as an internal netpgp variable.

This can then be queried using netpgp_getvar(netpgp, "userid") to find the
new key's id.

diffstat:

 crypto/external/bsd/netpgp/dist/src/lib/netpgp.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r 3b6b8c096cb7 -r 561af1ec1d80 crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
--- a/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c  Wed Dec 01 20:29:56 2010 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c  Wed Dec 01 22:01:41 2010 +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.85 2010/11/29 04:20:12 agc Exp $");
+__RCSID("$NetBSD: netpgp.c,v 1.86 2010/12/01 22:01:41 agc Exp $");
 #endif
 
 #include <sys/types.h>
@@ -1156,6 +1156,7 @@
        int                      attempts;
        int                      passc;
        int                      fd;
+       int                      cc;
 
        uid = NULL;
        io = netpgp->io;
@@ -1178,7 +1179,8 @@
        pgp_sprint_keydata(netpgp->io, NULL, key, &cp, "signature ", &key->key.seckey.pubkey, 0);
        (void) fprintf(stdout, "%s", cp);
        /* write public key */
-       (void) snprintf(dir, sizeof(dir), "%s/%.16s", netpgp_getvar(netpgp, "homedir"), &cp[ID_OFFSET]);
+       cc = snprintf(dir, sizeof(dir), "%s/%.16s", netpgp_getvar(netpgp, "homedir"), &cp[ID_OFFSET]);
+       netpgp_setvar(netpgp, "userid", &dir[cc - 16]);
        if (mkdir(dir, 0700) < 0) {
                (void) fprintf(io->errs, "can't mkdir '%s'\n", dir);
                return 0;



Home | Main Index | Thread Index | Old Index