From 4c316cb9b51455d421a3ee363977a6666e454521 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 8 Feb 2001 20:59:58 +0000 Subject: [PATCH] Fixed some bugs in the selection code --- g10/ChangeLog | 7 +++++++ g10/getkey.c | 6 ++++-- g10/parse-packet.c | 8 ++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/g10/ChangeLog b/g10/ChangeLog index 0850f4a65..4aae34ab9 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,5 +1,12 @@ 2001-02-08 Werner Koch + * getkey.c (key_byname): I can happe that we have both, sk and pk + NULL, fix for that. + + * parse-packet.c (parse_one_sig_subpkt): Add support for + primary_uid and key_flags. + (can_handle_critical): Ditto + * parse-packet.c (parse_encrypted): Fixed listing of pktlen for MDC packets. diff --git a/g10/getkey.c b/g10/getkey.c index 28bb7f84d..25bd9ba23 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -857,8 +857,10 @@ key_byname( GETKEY_CTX *retctx, STRLIST namelist, } } else { - ctx->req_algo = pk->req_algo; - ctx->req_usage = pk->req_usage; + if (pk) { + ctx->req_algo = pk->req_algo; + ctx->req_usage = pk->req_usage; + } rc = lookup( ctx, ret_kb, 0 ); if ( !rc && pk ) { pk_from_block ( ctx, pk, *ret_kb, NULL /* FIXME need to get the namehash*/ ); diff --git a/g10/parse-packet.c b/g10/parse-packet.c index fe4d99f6a..c97e312df 100644 --- a/g10/parse-packet.c +++ b/g10/parse-packet.c @@ -873,6 +873,8 @@ parse_one_sig_subpkt( const byte *buffer, size_t n, int type ) if( n < 4 ) break; return 0; + case SIGSUBPKT_KEY_FLAGS: + return 0; case SIGSUBPKT_EXPORTABLE: if( !n ) break; @@ -894,6 +896,10 @@ parse_one_sig_subpkt( const byte *buffer, size_t n, int type ) case SIGSUBPKT_PREF_COMPR: case SIGSUBPKT_POLICY: return 0; + case SIGSUBPKT_PRIMARY_UID: + if ( n != 1 ) + break; + return 0; case SIGSUBPKT_PRIV_ADD_SIG: /* because we use private data, we check the GNUPG marker */ if( n < 24 ) @@ -924,6 +930,8 @@ can_handle_critical( const byte *buffer, size_t n, int type ) case SIGSUBPKT_PREF_SYM: case SIGSUBPKT_PREF_HASH: case SIGSUBPKT_PREF_COMPR: + case SIGSUBPKT_KEY_FLAGS: + case SIGSUBPKT_PRIMARY_UID: return 1; case SIGSUBPKT_POLICY: /* Is it enough to show the policy? */