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 avoid false positive...



details:   https://anonhg.NetBSD.org/src/rev/4faeb24e551f
branches:  trunk
changeset: 757265:4faeb24e551f
user:      agc <agc%NetBSD.org@localhost>
date:      Sat Aug 21 19:00:43 2010 +0000

description:
avoid false positives when matching a (non-existent) encryption subkey

use debugging output to point to the matching key

diffstat:

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

diffs (40 lines):

diff -r 72c565babd2b -r 4faeb24e551f crypto/external/bsd/netpgp/dist/src/lib/keyring.c
--- a/crypto/external/bsd/netpgp/dist/src/lib/keyring.c Sat Aug 21 18:25:45 2010 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/lib/keyring.c Sat Aug 21 19:00:43 2010 +0000
@@ -57,7 +57,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: keyring.c,v 1.43 2010/08/15 16:10:56 agc Exp $");
+__RCSID("$NetBSD: keyring.c,v 1.44 2010/08/21 19:00:43 agc Exp $");
 #endif
 
 #ifdef HAVE_FCNTL_H
@@ -834,6 +834,9 @@
                        }
                        return &keyring->keys[*from];
                }
+               if (memcmp(&keyring->keys[*from].encid, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", OPS_KEY_ID_SIZE) == 0) {
+                       continue;
+               }
                if (memcmp(&keyring->keys[*from].encid, keyid, OPS_KEY_ID_SIZE) == 0 ||
                    memcmp(&keyring->keys[*from].encid[OPS_KEY_ID_SIZE / 2], keyid, OPS_KEY_ID_SIZE / 2) == 0) {
                        if (pubkey) {
@@ -924,12 +927,12 @@
        for (keyp = &keyring->keys[*from]; *from < keyring->keyc; *from += 1, keyp++) {
                uidp = keyp->uids;
                for (i = 0 ; i < keyp->uidc; i++, uidp++) {
-                       if (__ops_get_debug_level(__FILE__)) {
-                               (void) fprintf(io->outs,
-                                       "keyid \"%s\" len %" PRIsize "u\n",
-                                      (char *) *uidp, len);
-                       }
                        if (regexec(&r, (char *)*uidp, 0, NULL, 0) == 0) {
+                               if (__ops_get_debug_level(__FILE__)) {
+                                       (void) fprintf(io->outs,
+                                               "MATCHED keyid \"%s\" len %" PRIsize "u\n",
+                                              (char *) *uidp, len);
+                               }
                                regfree(&r);
                                return keyp;
                        }



Home | Main Index | Thread Index | Old Index