aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Shaw <[email protected]>2002-06-03 23:30:10 +0000
committerDavid Shaw <[email protected]>2002-06-03 23:30:10 +0000
commit8273c728604a88d44226d2e75d8d055c679268f7 (patch)
tree85a9efe818c945cf259a92b420cc06ba0690bb8f
parent* DETAILS: Details of ATTRIBUTE. (diff)
downloadgnupg-8273c728604a88d44226d2e75d8d055c679268f7.tar.gz
gnupg-8273c728604a88d44226d2e75d8d055c679268f7.zip
* packet.h, parse-packet.c (enum_sig_subpkt): Report back from
enum_sig_subpkt when a subpacket is critical and change all callers in keylist.c (show_policy_url, show_notation), mainproc.c (print_notation_data), and pkclist.c (do_show_revocation_reason). * keylist.c (show_policy_url, show_notation): Display if the policy or notation is critical.
-rw-r--r--g10/keylist.c18
-rw-r--r--g10/mainproc.c4
-rw-r--r--g10/packet.h2
-rw-r--r--g10/parse-packet.c19
-rw-r--r--g10/pkclist.c2
5 files changed, 27 insertions, 18 deletions
diff --git a/g10/keylist.c b/g10/keylist.c
index 296de6b5a..83fc19964 100644
--- a/g10/keylist.c
+++ b/g10/keylist.c
@@ -77,9 +77,9 @@ show_policy_url(PKT_signature *sig,int indent)
{
const byte *p;
size_t len;
- int seq=0;
+ int seq=0,crit;
- while((p=enum_sig_subpkt(sig->hashed,SIGSUBPKT_POLICY,&len,&seq)))
+ while((p=enum_sig_subpkt(sig->hashed,SIGSUBPKT_POLICY,&len,&seq,&crit)))
{
int i;
@@ -87,7 +87,10 @@ show_policy_url(PKT_signature *sig,int indent)
putchar(' ');
/* This isn't UTF8 as it is a URL(?) */
- printf(_("Signature policy: "));
+ if(crit)
+ printf(_("Critical signature policy: "));
+ else
+ printf(_("Signature policy: "));
print_string(stdout,p,len,0);
printf("\n");
}
@@ -98,11 +101,11 @@ show_notation(PKT_signature *sig,int indent)
{
const byte *p;
size_t len;
- int seq=0;
+ int seq=0,crit;
/* There may be multiple notations in the same sig. */
- while((p=enum_sig_subpkt(sig->hashed,SIGSUBPKT_NOTATION,&len,&seq)))
+ while((p=enum_sig_subpkt(sig->hashed,SIGSUBPKT_NOTATION,&len,&seq,&crit)))
if(len>=8)
{
int n1,n2,i;
@@ -120,7 +123,10 @@ show_notation(PKT_signature *sig,int indent)
putchar(' ');
/* This is UTF8 */
- printf(_("Signature notation: "));
+ if(crit)
+ printf(_("Critical signature notation: "));
+ else
+ printf(_("Signature notation: "));
print_utf8_string(stdout,p+8,n1);
printf("=");
diff --git a/g10/mainproc.c b/g10/mainproc.c
index 84824c275..e8f30e1ce 100644
--- a/g10/mainproc.c
+++ b/g10/mainproc.c
@@ -721,7 +721,7 @@ print_notation_data( PKT_signature *sig )
const byte *p;
int seq = 0;
- while( (p = enum_sig_subpkt (sig->hashed, SIGSUBPKT_NOTATION, &n, &seq))) {
+ while((p=enum_sig_subpkt(sig->hashed,SIGSUBPKT_NOTATION,&n,&seq,NULL))) {
if( n < 8 ) {
log_info(_("WARNING: invalid notation data found\n"));
return;
@@ -746,7 +746,7 @@ print_notation_data( PKT_signature *sig )
seq=0;
- while( (p = enum_sig_subpkt (sig->hashed, SIGSUBPKT_POLICY, &n, &seq) )) {
+ while((p=enum_sig_subpkt(sig->hashed,SIGSUBPKT_POLICY,&n,&seq,NULL))) {
log_info(_("Policy: ") );
print_string( log_stream(), p, n, 0 );
putc( '\n', log_stream() );
diff --git a/g10/packet.h b/g10/packet.h
index d530f83f7..023680b9e 100644
--- a/g10/packet.h
+++ b/g10/packet.h
@@ -389,7 +389,7 @@ int skip_some_packets( IOBUF inp, unsigned n );
const byte *enum_sig_subpkt ( const subpktarea_t *subpkts,
sigsubpkttype_t reqtype,
- size_t *ret_n, int *start );
+ size_t *ret_n, int *start, int *critical );
const byte *parse_sig_subpkt ( const subpktarea_t *buffer,
sigsubpkttype_t reqtype,
size_t *ret_n );
diff --git a/g10/parse-packet.c b/g10/parse-packet.c
index 54620ece3..d57659b6b 100644
--- a/g10/parse-packet.c
+++ b/g10/parse-packet.c
@@ -999,17 +999,20 @@ can_handle_critical( const byte *buffer, size_t n, int type )
const byte *
enum_sig_subpkt( const subpktarea_t *pktbuf, sigsubpkttype_t reqtype,
- size_t *ret_n, int *start )
+ size_t *ret_n, int *start, int *critical )
{
const byte *buffer;
int buflen;
int type;
- int critical;
+ int critical_dummy;
int offset;
size_t n;
int seq = 0;
int reqseq = start? *start: 0;
+ if(!critical)
+ critical=&critical_dummy;
+
if( !pktbuf || reqseq == -1 ) {
/* return some value different from NULL to indicate that
* there is no critical bit we do not understand. The caller
@@ -1040,14 +1043,14 @@ enum_sig_subpkt( const subpktarea_t *pktbuf, sigsubpkttype_t reqtype,
type = *buffer;
if( type & 0x80 ) {
type &= 0x7f;
- critical = 1;
+ *critical = 1;
}
else
- critical = 0;
+ *critical = 0;
if( !(++seq > reqseq) )
;
else if( reqtype == SIGSUBPKT_TEST_CRITICAL ) {
- if( critical ) {
+ if( *critical ) {
if( n-1 > buflen+1 )
goto too_short;
if( !can_handle_critical(buffer+1, n-1, type ) ) {
@@ -1061,7 +1064,7 @@ enum_sig_subpkt( const subpktarea_t *pktbuf, sigsubpkttype_t reqtype,
}
else if( reqtype < 0 ) /* list packets */
dump_sig_subpkt( reqtype == SIGSUBPKT_LIST_HASHED,
- type, critical, buffer, buflen, n );
+ type, *critical, buffer, buflen, n );
else if( type == reqtype ) { /* found */
buffer++;
n--;
@@ -1106,7 +1109,7 @@ const byte *
parse_sig_subpkt (const subpktarea_t *buffer, sigsubpkttype_t reqtype,
size_t *ret_n)
{
- return enum_sig_subpkt( buffer, reqtype, ret_n, NULL );
+ return enum_sig_subpkt( buffer, reqtype, ret_n, NULL, NULL );
}
const byte *
@@ -1134,7 +1137,7 @@ void parse_revkeys(PKT_signature *sig)
while((revkey=
(struct revocation_key *)enum_sig_subpkt(sig->hashed,
SIGSUBPKT_REV_KEY,
- &len,&seq)))
+ &len,&seq,NULL)))
{
if(len==sizeof(struct revocation_key) &&
(revkey->class&0x80)) /* 0x80 bit must be set */
diff --git a/g10/pkclist.c b/g10/pkclist.c
index 0e10a4b70..190faaec9 100644
--- a/g10/pkclist.c
+++ b/g10/pkclist.c
@@ -53,7 +53,7 @@ do_show_revocation_reason( PKT_signature *sig )
const char *text;
while( (p = enum_sig_subpkt (sig->hashed, SIGSUBPKT_REVOC_REASON,
- &n, &seq )) ) {
+ &n, &seq, NULL )) ) {
if( !n )
continue; /* invalid - just skip it */