aboutsummaryrefslogtreecommitdiffstats
path: root/g10/parse-packet.c
diff options
context:
space:
mode:
authorDavid Shaw <[email protected]>2002-10-29 18:00:07 +0000
committerDavid Shaw <[email protected]>2002-10-29 18:00:07 +0000
commit809b8b031a3482d12faefa5ce9f392c1688eaa81 (patch)
treeb9de81d600d52f51da3be66ad3d79cf723f35534 /g10/parse-packet.c
parenttidied RISC OS filetype support (diff)
downloadgnupg-809b8b031a3482d12faefa5ce9f392c1688eaa81.tar.gz
gnupg-809b8b031a3482d12faefa5ce9f392c1688eaa81.zip
* keyedit.c (print_and_check_one_sig, show_key_and_fingerprint,
menu_addrevoker), keylist.c (list_keyblock_print, print_fingerprint): Show "T" or the trust depth for trust signatures, and add spaces to some strings to make room for it. * packet.h, parse-packet.c (dump_sig_subpkt, parse_one_sig_subpkt, parse_signature): Parse trust signature values. * tdbio.h, tdbio.c (tdbio_read_record, tdbio_write_record): Reserve a byte for the minimum ownertrust value (for use with trust signatures).
Diffstat (limited to 'g10/parse-packet.c')
-rw-r--r--g10/parse-packet.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/g10/parse-packet.c b/g10/parse-packet.c
index bce3ce308..f15f412ef 100644
--- a/g10/parse-packet.c
+++ b/g10/parse-packet.c
@@ -778,13 +778,13 @@ dump_sig_subpkt( int hashed, int type, int critical,
break;
case SIGSUBPKT_TRUST:
if(length!=2)
- p="[invalid trust signature]";
+ p="[invalid trust subpacket]";
else
- printf("trust signature of level %d, amount %d",buffer[0],buffer[1]);
+ printf("trust signature of depth %d, amount %d",buffer[0],buffer[1]);
break;
case SIGSUBPKT_REGEXP:
if(!length)
- p="[invalid regexp]";
+ p="[invalid regexp subpacket]";
else
printf("regular expression: \"%s\"",buffer);
break;
@@ -933,6 +933,7 @@ parse_one_sig_subpkt( const byte *buffer, size_t n, int type )
case SIGSUBPKT_PREF_COMPR:
case SIGSUBPKT_POLICY:
case SIGSUBPKT_FEATURES:
+ case SIGSUBPKT_REGEXP:
return 0;
case SIGSUBPKT_EXPORTABLE:
case SIGSUBPKT_REVOCABLE:
@@ -955,6 +956,10 @@ parse_one_sig_subpkt( const byte *buffer, size_t n, int type )
if ( n != 1 )
break;
return 0;
+ case SIGSUBPKT_TRUST:
+ if ( n != 2 )
+ break;
+ return 0;
case SIGSUBPKT_PRIV_VERIFY_CACHE:
/* We used this in gpg 1.0.5 and 1.0.6 to cache signature
* verification results - it is no longer used.
@@ -1247,6 +1252,7 @@ parse_signature( IOBUF inp, int pkttype, unsigned long pktlen,
if( is_v4 && sig->pubkey_algo ) { /*extract required information */
const byte *p;
+ size_t len;
/* set sig->flags.unknown_critical if there is a
* critical bit set for packets which we do not understand */
@@ -1288,6 +1294,21 @@ parse_signature( IOBUF inp, int pkttype, unsigned long pktlen,
if(p && *p==0)
sig->flags.revocable=0;
+ p=parse_sig_subpkt(sig->hashed,SIGSUBPKT_TRUST,&len);
+ if(p && len==2)
+ {
+ sig->trust_depth=p[0];
+ sig->trust_value=p[1];
+
+ sig->trust_regexp=
+ parse_sig_subpkt(sig->hashed,SIGSUBPKT_REGEXP,&len);
+
+ /* If the regular expression is of 0 length, there is no
+ regular expression. */
+ if(len==0)
+ sig->trust_regexp=NULL;
+ }
+
/* We accept the exportable subpacket from either the hashed
or unhashed areas as older versions of gpg put it in the
unhashed area. In theory, anyway, we should never see this