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 Changes to 2.99.2/20100315



details:   https://anonhg.NetBSD.org/src/rev/681797770259
branches:  trunk
changeset: 753116:681797770259
user:      agc <agc%NetBSD.org@localhost>
date:      Tue Mar 16 04:14:29 2010 +0000

description:
Changes to 2.99.2/20100315

+ make subkey sigs available by hkp as well as on the command line
+ use the sketchily-defined vindex option to the hkp protocol to
  return the subkey signature information
+ add a netpgp_unsetvar() function as a corollary to netpgp_setvar()
+ use a variable name of ''subkey sigs'' to denote that subkey
  signatures should be returned with the pubkey uids

diffstat:

 crypto/external/bsd/netpgp/dist/TODO                      |   1 +
 crypto/external/bsd/netpgp/dist/configure                 |  22 ++--
 crypto/external/bsd/netpgp/dist/configure.ac              |   6 +-
 crypto/external/bsd/netpgp/dist/include/netpgp.h          |   1 +
 crypto/external/bsd/netpgp/dist/src/hkpclient/tst         |   4 +
 crypto/external/bsd/netpgp/dist/src/hkpd/hkpd.c           |  20 +++-
 crypto/external/bsd/netpgp/dist/src/lib/keyring.h         |   5 +-
 crypto/external/bsd/netpgp/dist/src/lib/netpgp.c          |  32 ++++++-
 crypto/external/bsd/netpgp/dist/src/lib/packet-print.c    |  58 ++++++++++++--
 crypto/external/bsd/netpgp/dist/src/lib/version.h         |   2 +-
 crypto/external/bsd/netpgp/dist/src/netpgpverify/verify.c |   4 +-
 11 files changed, 115 insertions(+), 40 deletions(-)

diffs (truncated from 378 to 300 lines):

diff -r 010b2895a52c -r 681797770259 crypto/external/bsd/netpgp/dist/TODO
--- a/crypto/external/bsd/netpgp/dist/TODO      Tue Mar 16 03:23:47 2010 +0000
+++ b/crypto/external/bsd/netpgp/dist/TODO      Tue Mar 16 04:14:29 2010 +0000
@@ -93,3 +93,4 @@
 trust subpackets
 add revocation information to public key display
 --list-sigs - these come out in __ops_check_subkey_sig()
+hkp to include sigs too
diff -r 010b2895a52c -r 681797770259 crypto/external/bsd/netpgp/dist/configure
--- a/crypto/external/bsd/netpgp/dist/configure Tue Mar 16 03:23:47 2010 +0000
+++ b/crypto/external/bsd/netpgp/dist/configure Tue Mar 16 04:14:29 2010 +0000
@@ -1,7 +1,7 @@
 #! /bin/sh
-# From configure.ac Revision: 1.27 .
+# From configure.ac Revision: 1.28 .
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.63 for netpgp 20100313.
+# Generated by GNU Autoconf 2.63 for netpgp 20100315.
 #
 # Report bugs to <Alistair Crooks <agc%netbsd.org@localhost> c0596823>.
 #
@@ -751,8 +751,8 @@
 # Identity of this package.
 PACKAGE_NAME='netpgp'
 PACKAGE_TARNAME='netpgp'
-PACKAGE_VERSION='20100313'
-PACKAGE_STRING='netpgp 20100313'
+PACKAGE_VERSION='20100315'
+PACKAGE_STRING='netpgp 20100315'
 PACKAGE_BUGREPORT='Alistair Crooks <agc%netbsd.org@localhost> c0596823'
 
 ac_unique_file="src/netpgp/netpgp.c"
@@ -1483,7 +1483,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures netpgp 20100313 to adapt to many kinds of systems.
+\`configure' configures netpgp 20100315 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1553,7 +1553,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of netpgp 20100313:";;
+     short | recursive ) echo "Configuration of netpgp 20100315:";;
    esac
   cat <<\_ACEOF
 
@@ -1660,7 +1660,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-netpgp configure 20100313
+netpgp configure 20100315
 generated by GNU Autoconf 2.63
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1674,7 +1674,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by netpgp $as_me 20100313, which was
+It was created by netpgp $as_me 20100315, which was
 generated by GNU Autoconf 2.63.  Invocation command line was
 
   $ $0 $@
@@ -2561,7 +2561,7 @@
 
 # Define the identity of the package.
  PACKAGE='netpgp'
- VERSION='20100313'
+ VERSION='20100315'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -22306,7 +22306,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by netpgp $as_me 20100313, which was
+This file was extended by netpgp $as_me 20100315, which was
 generated by GNU Autoconf 2.63.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -22369,7 +22369,7 @@
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_version="\\
-netpgp config.status 20100313
+netpgp config.status 20100315
 configured by $0, generated by GNU Autoconf 2.63,
   with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
diff -r 010b2895a52c -r 681797770259 crypto/external/bsd/netpgp/dist/configure.ac
--- a/crypto/external/bsd/netpgp/dist/configure.ac      Tue Mar 16 03:23:47 2010 +0000
+++ b/crypto/external/bsd/netpgp/dist/configure.ac      Tue Mar 16 04:14:29 2010 +0000
@@ -1,10 +1,10 @@
-# $NetBSD: configure.ac,v 1.28 2010/03/13 23:30:40 agc Exp $
+# $NetBSD: configure.ac,v 1.29 2010/03/16 04:14:29 agc Exp $
 #
 # Process this file with autoconf to produce a configure script.
 
-AC_INIT([netpgp],[20100313],[Alistair Crooks <agc%netbsd.org@localhost> c0596823])
+AC_INIT([netpgp],[20100315],[Alistair Crooks <agc%netbsd.org@localhost> c0596823])
 AC_PREREQ(2.63)
-AC_REVISION([$Revision: 1.28 $])
+AC_REVISION([$Revision: 1.29 $])
 
 AS_SHELL_SANITIZE
 
diff -r 010b2895a52c -r 681797770259 crypto/external/bsd/netpgp/dist/include/netpgp.h
--- a/crypto/external/bsd/netpgp/dist/include/netpgp.h  Tue Mar 16 03:23:47 2010 +0000
+++ b/crypto/external/bsd/netpgp/dist/include/netpgp.h  Tue Mar 16 04:14:29 2010 +0000
@@ -67,6 +67,7 @@
 int netpgp_setvar(netpgp_t *, const char *, const char *);
 char *netpgp_getvar(netpgp_t *, const char *);
 int netpgp_incvar(netpgp_t *, const char *, const int);
+int netpgp_unsetvar(netpgp_t *, const char *);
 
 /* set home directory information */
 int netpgp_set_homedir(netpgp_t *, char *, const char *, const int);
diff -r 010b2895a52c -r 681797770259 crypto/external/bsd/netpgp/dist/src/hkpclient/tst
--- a/crypto/external/bsd/netpgp/dist/src/hkpclient/tst Tue Mar 16 03:23:47 2010 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/hkpclient/tst Tue Mar 16 04:14:29 2010 +0000
@@ -16,6 +16,10 @@
 done
 
 ./hkpclient.lua -s ${host} agc%netbsd.org@localhost
+./hkpclient.lua -s ${host} --mr 0xc0596823
+./hkpclient.lua -s ${host} 0xc0596823
 ./hkpclient.lua --op index -s ${host} 0xc0596823
 ./hkpclient.lua -o index -s ${host} --mr 0xc0596823
+./hkpclient.lua -o index -s ${host} --mr 0xc0596823
+./hkpclient.lua -o vindex -s ${host} --mr agc@
 ./hkpclient.lua -o index -s ${host} dhklsbcldshjkcdlsjhcvdsljhvcdsljhcvdjlshvcdsc
diff -r 010b2895a52c -r 681797770259 crypto/external/bsd/netpgp/dist/src/hkpd/hkpd.c
--- a/crypto/external/bsd/netpgp/dist/src/hkpd/hkpd.c   Tue Mar 16 03:23:47 2010 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/hkpd/hkpd.c   Tue Mar 16 04:14:29 2010 +0000
@@ -98,8 +98,10 @@
 static int
 response(int sock, const int code, const char *search, const int get, char *buf, int cc, int mr)
 {
-       char    outbuf[BUFSIZ * 8];
+       char    outbuf[1024 * 512];
        char    item[BUFSIZ];
+       int     tot;
+       int     wc;
        int     n;
 
        if (buf == NULL) {
@@ -116,8 +118,7 @@
                        mr,
                        buf);
        }
-       if (write(sock, outbuf, n) != n) {
-               (void) fprintf(stderr, "Short write\n");
+       for (tot = 0 ; (wc = write(sock, &outbuf[tot], n - tot)) > 0 && tot < n ; tot += wc) {
        }
        return 1;
 }
@@ -282,9 +283,18 @@
                        sizeof(search));
                code = HKP_NOT_FOUND;
                cc = 0;
-               if (strncmp(&buf[opmatches[1].rm_so], "vindex", 6) == 0 ||
-                   strncmp(&buf[opmatches[1].rm_so], "index", 5) == 0) {
+               if (strncmp(&buf[opmatches[1].rm_so], "vindex", 6) == 0) {
                        cc = 0;
+                       netpgp_setvar(netpgp, "subkey sigs", "yes");
+                       if ((cp = netpgp_get_key(netpgp, search, (mr) ? "mr" : "")) != NULL) {
+                               cc = strlen(cp);
+                               code = HKP_SUCCESS;
+                       }
+                       response(newsock, code, search, 0, cp, cc, mr);
+                       netpgp_unsetvar(netpgp, "subkey sigs");
+               } else if (strncmp(&buf[opmatches[1].rm_so], "index", 5) == 0) {
+                       cc = 0;
+                       netpgp_unsetvar(netpgp, "subkey sigs");
                        if ((cp = netpgp_get_key(netpgp, search, (mr) ? "mr" : "")) != NULL) {
                                cc = strlen(cp);
                                code = HKP_SUCCESS;
diff -r 010b2895a52c -r 681797770259 crypto/external/bsd/netpgp/dist/src/lib/keyring.h
--- a/crypto/external/bsd/netpgp/dist/src/lib/keyring.h Tue Mar 16 03:23:47 2010 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/lib/keyring.h Tue Mar 16 04:14:29 2010 +0000
@@ -119,8 +119,9 @@
 int __ops_sprint_keydata(__ops_io_t *, const __ops_keyring_t *,
                        const __ops_key_t *, char **, const char *,
                        const __ops_pubkey_t *, const int);
-int __ops_hkp_sprint_keydata(const __ops_key_t *, char **,
-                       const __ops_pubkey_t *);
+int __ops_hkp_sprint_keydata(__ops_io_t *, const __ops_keyring_t *,
+                       const __ops_key_t *, char **,
+                       const __ops_pubkey_t *, const int);
 void __ops_print_keydata(__ops_io_t *, const __ops_keyring_t *, const __ops_key_t *,
                        const char *, const __ops_pubkey_t *, const int);
 void __ops_print_sig(__ops_io_t *, const __ops_key_t *, const char *,
diff -r 010b2895a52c -r 681797770259 crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
--- a/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c  Tue Mar 16 03:23:47 2010 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c  Tue Mar 16 04:14:29 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.43 2010/03/13 23:30:41 agc Exp $");
+__RCSID("$NetBSD: netpgp.c,v 1.44 2010/03/16 04:14:29 agc Exp $");
 #endif
 
 #include <sys/types.h>
@@ -566,9 +566,9 @@
                        ALLOC(char *, pubs.v, pubs.size, pubs.c, 10, 10,
                                        "netpgp_match_keys", return 0);
                        if (strcmp(fmt, "mr") == 0) {
-                               __ops_hkp_sprint_keydata(
+                               __ops_hkp_sprint_keydata(netpgp->io, netpgp->pubring,
                                                key, &pubs.v[pubs.c],
-                                               &key->key.pubkey);
+                                               &key->key.pubkey, psigs);
                        } else {
                                __ops_sprint_keydata(netpgp->io, netpgp->pubring,
                                                key, &pubs.v[pubs.c],
@@ -659,12 +659,15 @@
                return NULL;
        }
        if (strcmp(fmt, "mr") == 0) {
-               return (__ops_hkp_sprint_keydata(key, &newkey,
-                               &key->key.pubkey) > 0) ? newkey : NULL;
+               return (__ops_hkp_sprint_keydata(netpgp->io, netpgp->pubring,
+                               key, &newkey,
+                               &key->key.pubkey,
+                               netpgp_getvar(netpgp, "subkey sigs") != NULL) > 0) ? newkey : NULL;
        }
        return (__ops_sprint_keydata(netpgp->io, netpgp->pubring,
                                key, &newkey, "pub",
-                               &key->key.pubkey, 0) > 0) ? newkey : NULL;
+                               &key->key.pubkey,
+                               netpgp_getvar(netpgp, "subkey sigs") != NULL) > 0) ? newkey : NULL;
 }
 
 /* export a given key */
@@ -1250,6 +1253,23 @@
        return 1;
 }
 
+/* unset a variable */
+int
+netpgp_unsetvar(netpgp_t *netpgp, const char *name)
+{
+       int     i;
+
+       if ((i = findvar(netpgp, name)) >= 0) {
+               if (netpgp->value[i]) {
+                       free(netpgp->value[i]);
+                       netpgp->value[i] = NULL;
+               }
+               netpgp->value[i] = NULL;
+               return 1;
+       }
+       return 0;
+}
+
 /* get a variable's value (NULL if not set) */
 char *
 netpgp_getvar(netpgp_t *netpgp, const char *name)
diff -r 010b2895a52c -r 681797770259 crypto/external/bsd/netpgp/dist/src/lib/packet-print.c
--- a/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c    Tue Mar 16 03:23:47 2010 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/lib/packet-print.c    Tue Mar 16 04:14:29 2010 +0000
@@ -58,7 +58,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: packet-print.c,v 1.29 2010/03/13 23:30:41 agc Exp $");
+__RCSID("$NetBSD: packet-print.c,v 1.30 2010/03/16 04:14:29 agc Exp $");
 #endif
 
 #include <string.h>
@@ -496,20 +496,58 @@
 }
 
 int
-__ops_hkp_sprint_keydata(const __ops_key_t *key, char **buf,
-               const __ops_pubkey_t *pubkey)
+__ops_hkp_sprint_keydata(__ops_io_t *io, const __ops_keyring_t *keyring,
+               const __ops_key_t *key, char **buf,
+               const __ops_pubkey_t *pubkey, const int psigs)
 {
-       unsigned         i;
-       char             uidbuf[KB(128)];
-       char             fp[(OPS_FINGERPRINT_SIZE * 3) + 1];
-       int              n;
+       const __ops_key_t       *trustkey;
+       unsigned                 from;
+       unsigned                 i;
+       unsigned                 j;
+       char                     keyid[OPS_KEY_ID_SIZE * 3];
+       char                     uidbuf[KB(128)];
+       char                     fp[(OPS_FINGERPRINT_SIZE * 3) + 1];
+       int                      n;
 



Home | Main Index | Thread Index | Old Index