mirror of
git://git.gnupg.org/gnupg.git
synced 2025-04-17 15:44:34 +02:00
* 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.
This commit is contained in:
parent
fa7148d1ed
commit
8273c72860
@ -77,9 +77,9 @@ show_policy_url(PKT_signature *sig,int indent)
|
|||||||
{
|
{
|
||||||
const byte *p;
|
const byte *p;
|
||||||
size_t len;
|
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;
|
int i;
|
||||||
|
|
||||||
@ -87,7 +87,10 @@ show_policy_url(PKT_signature *sig,int indent)
|
|||||||
putchar(' ');
|
putchar(' ');
|
||||||
|
|
||||||
/* This isn't UTF8 as it is a URL(?) */
|
/* 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);
|
print_string(stdout,p,len,0);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
@ -98,11 +101,11 @@ show_notation(PKT_signature *sig,int indent)
|
|||||||
{
|
{
|
||||||
const byte *p;
|
const byte *p;
|
||||||
size_t len;
|
size_t len;
|
||||||
int seq=0;
|
int seq=0,crit;
|
||||||
|
|
||||||
/* There may be multiple notations in the same sig. */
|
/* 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)
|
if(len>=8)
|
||||||
{
|
{
|
||||||
int n1,n2,i;
|
int n1,n2,i;
|
||||||
@ -120,7 +123,10 @@ show_notation(PKT_signature *sig,int indent)
|
|||||||
putchar(' ');
|
putchar(' ');
|
||||||
|
|
||||||
/* This is UTF8 */
|
/* This is UTF8 */
|
||||||
printf(_("Signature notation: "));
|
if(crit)
|
||||||
|
printf(_("Critical signature notation: "));
|
||||||
|
else
|
||||||
|
printf(_("Signature notation: "));
|
||||||
print_utf8_string(stdout,p+8,n1);
|
print_utf8_string(stdout,p+8,n1);
|
||||||
printf("=");
|
printf("=");
|
||||||
|
|
||||||
|
@ -721,7 +721,7 @@ print_notation_data( PKT_signature *sig )
|
|||||||
const byte *p;
|
const byte *p;
|
||||||
int seq = 0;
|
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 ) {
|
if( n < 8 ) {
|
||||||
log_info(_("WARNING: invalid notation data found\n"));
|
log_info(_("WARNING: invalid notation data found\n"));
|
||||||
return;
|
return;
|
||||||
@ -746,7 +746,7 @@ print_notation_data( PKT_signature *sig )
|
|||||||
|
|
||||||
seq=0;
|
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: ") );
|
log_info(_("Policy: ") );
|
||||||
print_string( log_stream(), p, n, 0 );
|
print_string( log_stream(), p, n, 0 );
|
||||||
putc( '\n', log_stream() );
|
putc( '\n', log_stream() );
|
||||||
|
@ -389,7 +389,7 @@ int skip_some_packets( IOBUF inp, unsigned n );
|
|||||||
|
|
||||||
const byte *enum_sig_subpkt ( const subpktarea_t *subpkts,
|
const byte *enum_sig_subpkt ( const subpktarea_t *subpkts,
|
||||||
sigsubpkttype_t reqtype,
|
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,
|
const byte *parse_sig_subpkt ( const subpktarea_t *buffer,
|
||||||
sigsubpkttype_t reqtype,
|
sigsubpkttype_t reqtype,
|
||||||
size_t *ret_n );
|
size_t *ret_n );
|
||||||
|
@ -999,17 +999,20 @@ can_handle_critical( const byte *buffer, size_t n, int type )
|
|||||||
|
|
||||||
const byte *
|
const byte *
|
||||||
enum_sig_subpkt( const subpktarea_t *pktbuf, sigsubpkttype_t reqtype,
|
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;
|
const byte *buffer;
|
||||||
int buflen;
|
int buflen;
|
||||||
int type;
|
int type;
|
||||||
int critical;
|
int critical_dummy;
|
||||||
int offset;
|
int offset;
|
||||||
size_t n;
|
size_t n;
|
||||||
int seq = 0;
|
int seq = 0;
|
||||||
int reqseq = start? *start: 0;
|
int reqseq = start? *start: 0;
|
||||||
|
|
||||||
|
if(!critical)
|
||||||
|
critical=&critical_dummy;
|
||||||
|
|
||||||
if( !pktbuf || reqseq == -1 ) {
|
if( !pktbuf || reqseq == -1 ) {
|
||||||
/* return some value different from NULL to indicate that
|
/* return some value different from NULL to indicate that
|
||||||
* there is no critical bit we do not understand. The caller
|
* 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;
|
type = *buffer;
|
||||||
if( type & 0x80 ) {
|
if( type & 0x80 ) {
|
||||||
type &= 0x7f;
|
type &= 0x7f;
|
||||||
critical = 1;
|
*critical = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
critical = 0;
|
*critical = 0;
|
||||||
if( !(++seq > reqseq) )
|
if( !(++seq > reqseq) )
|
||||||
;
|
;
|
||||||
else if( reqtype == SIGSUBPKT_TEST_CRITICAL ) {
|
else if( reqtype == SIGSUBPKT_TEST_CRITICAL ) {
|
||||||
if( critical ) {
|
if( *critical ) {
|
||||||
if( n-1 > buflen+1 )
|
if( n-1 > buflen+1 )
|
||||||
goto too_short;
|
goto too_short;
|
||||||
if( !can_handle_critical(buffer+1, n-1, type ) ) {
|
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 */
|
else if( reqtype < 0 ) /* list packets */
|
||||||
dump_sig_subpkt( reqtype == SIGSUBPKT_LIST_HASHED,
|
dump_sig_subpkt( reqtype == SIGSUBPKT_LIST_HASHED,
|
||||||
type, critical, buffer, buflen, n );
|
type, *critical, buffer, buflen, n );
|
||||||
else if( type == reqtype ) { /* found */
|
else if( type == reqtype ) { /* found */
|
||||||
buffer++;
|
buffer++;
|
||||||
n--;
|
n--;
|
||||||
@ -1106,7 +1109,7 @@ const byte *
|
|||||||
parse_sig_subpkt (const subpktarea_t *buffer, sigsubpkttype_t reqtype,
|
parse_sig_subpkt (const subpktarea_t *buffer, sigsubpkttype_t reqtype,
|
||||||
size_t *ret_n)
|
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 *
|
const byte *
|
||||||
@ -1134,7 +1137,7 @@ void parse_revkeys(PKT_signature *sig)
|
|||||||
while((revkey=
|
while((revkey=
|
||||||
(struct revocation_key *)enum_sig_subpkt(sig->hashed,
|
(struct revocation_key *)enum_sig_subpkt(sig->hashed,
|
||||||
SIGSUBPKT_REV_KEY,
|
SIGSUBPKT_REV_KEY,
|
||||||
&len,&seq)))
|
&len,&seq,NULL)))
|
||||||
{
|
{
|
||||||
if(len==sizeof(struct revocation_key) &&
|
if(len==sizeof(struct revocation_key) &&
|
||||||
(revkey->class&0x80)) /* 0x80 bit must be set */
|
(revkey->class&0x80)) /* 0x80 bit must be set */
|
||||||
|
@ -53,7 +53,7 @@ do_show_revocation_reason( PKT_signature *sig )
|
|||||||
const char *text;
|
const char *text;
|
||||||
|
|
||||||
while( (p = enum_sig_subpkt (sig->hashed, SIGSUBPKT_REVOC_REASON,
|
while( (p = enum_sig_subpkt (sig->hashed, SIGSUBPKT_REVOC_REASON,
|
||||||
&n, &seq )) ) {
|
&n, &seq, NULL )) ) {
|
||||||
if( !n )
|
if( !n )
|
||||||
continue; /* invalid - just skip it */
|
continue; /* invalid - just skip it */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user