1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-23 01:22:45 +02:00

* keylist.c (show_notation): Use bits to select which sort of notation to

show.  Don't allow a not-shown notation to prevent us from issuing the
proper --status-fd message.

* options.h, g10.c (main): Add show-std/standard-notations and
show-user-notations.  show-notations is both.  Default is to show standard
notations only during verify.  Change all callers.
This commit is contained in:
David Shaw 2004-05-05 02:40:27 +00:00
parent 0bfa710643
commit f106448a7d
6 changed files with 75 additions and 47 deletions

View File

@ -1,3 +1,13 @@
2004-05-04 David Shaw <dshaw@jabberwocky.com>
* keylist.c (show_notation): Use bits to select which sort of
notation to show. Don't allow a not-shown notation to prevent us
from issuing the proper --status-fd message.
* options.h, g10.c (main): Add show-std/standard-notations and
show-user-notations. show-notations is both. Default is to show
standard notations only during verify. Change all callers.
2004-04-28 David Shaw <dshaw@jabberwocky.com>
* main.h, keylist.c (show_notation): Add argument to show only

View File

@ -1447,7 +1447,7 @@ main( int argc, char **argv )
opt.keyserver_options.options=
KEYSERVER_INCLUDE_SUBKEYS|KEYSERVER_INCLUDE_REVOKED|KEYSERVER_TRY_DNS_SRV|KEYSERVER_HONOR_KEYSERVER_URL;
opt.verify_options=
VERIFY_SHOW_POLICY_URLS|VERIFY_SHOW_NOTATIONS|VERIFY_SHOW_KEYSERVER_URLS;
VERIFY_SHOW_POLICY_URLS|VERIFY_SHOW_STD_NOTATIONS|VERIFY_SHOW_KEYSERVER_URLS;
opt.trust_model=TM_AUTO;
opt.mangle_dos_filenames=0;
opt.min_cert_level=2;
@ -2126,6 +2126,9 @@ main( int argc, char **argv )
{"show-photos",LIST_SHOW_PHOTOS,NULL},
{"show-policy-urls",LIST_SHOW_POLICY_URLS,NULL},
{"show-notations",LIST_SHOW_NOTATIONS,NULL},
{"show-std-notations",LIST_SHOW_STD_NOTATIONS,NULL},
{"show-standard-notations",LIST_SHOW_STD_NOTATIONS,NULL},
{"show-user-notations",LIST_SHOW_USER_NOTATIONS,NULL},
{"show-keyserver-urls",LIST_SHOW_KEYSERVER_URLS,NULL},
{"show-validity",LIST_SHOW_VALIDITY,NULL},
{"show-unusable-uids",LIST_SHOW_UNUSABLE_UIDS,NULL},
@ -2152,6 +2155,9 @@ main( int argc, char **argv )
{"show-photos",VERIFY_SHOW_PHOTOS,NULL},
{"show-policy-urls",VERIFY_SHOW_POLICY_URLS,NULL},
{"show-notations",VERIFY_SHOW_NOTATIONS,NULL},
{"show-std-notations",VERIFY_SHOW_STD_NOTATIONS,NULL},
{"show-standard-notations",VERIFY_SHOW_STD_NOTATIONS,NULL},
{"show-user-notations",VERIFY_SHOW_USER_NOTATIONS,NULL},
{"show-keyserver-urls",VERIFY_SHOW_KEYSERVER_URLS,NULL},
{"show-validity",VERIFY_SHOW_VALIDITY,NULL},
{"show-unusable-uids",VERIFY_SHOW_UNUSABLE_UIDS,NULL},

View File

@ -170,7 +170,9 @@ print_and_check_one_sig( KBNODE keyblock, KBNODE node,
show_policy_url(sig,3,0);
if(sig->flags.notation && (opt.list_options&LIST_SHOW_NOTATIONS))
show_notation(sig,3,0,0);
show_notation(sig,3,0,
((opt.list_options&LIST_SHOW_STD_NOTATIONS)?1:0)+
((opt.list_options&LIST_SHOW_USER_NOTATIONS)?2:0));
if(sig->flags.pref_ks && (opt.list_options&LIST_SHOW_KEYSERVER_URLS))
show_keyserver_url(sig,3,0);

View File

@ -237,9 +237,9 @@ show_keyserver_url(PKT_signature *sig,int indent,int mode)
mode=1 for log_info + status messages
mode=2 for status messages only
which=0 for both standard and user notations
which=1 for standard notations only
which=2 for user notations only
which bits:
1 == standard notations
2 == user notations
*/
void
@ -250,6 +250,9 @@ show_notation(PKT_signature *sig,int indent,int mode,int which)
int seq=0,crit;
FILE *fp=mode?log_stream():stdout;
if(which==0)
which=3;
/* There may be multiple notations in the same sig. */
while((p=enum_sig_subpkt(sig->hashed,SIGSUBPKT_NOTATION,&len,&seq,&crit)))
@ -266,37 +269,37 @@ show_notation(PKT_signature *sig,int indent,int mode,int which)
continue;
}
if(which==1 && memchr(p+8,'@',n1))
continue;
else if(which==2 && !memchr(p+8,'@',n1))
continue;
if(mode!=2)
{
int i;
char *str;
int has_at=!!memchr(p+8,'@',n1);
for(i=0;i<indent;i++)
putchar(' ');
if((which&1 && !has_at) || (which&2 && has_at))
{
int i;
char *str;
/* This is UTF8 */
if(crit)
str=_("Critical signature notation: ");
else
str=_("Signature notation: ");
if(mode)
log_info("%s",str);
else
printf("%s",str);
print_utf8_string(fp,p+8,n1);
fprintf(fp,"=");
for(i=0;i<indent;i++)
putchar(' ');
if(*p&0x80)
print_utf8_string(fp,p+8+n1,n2);
else
fprintf(fp,"[ %s ]",_("not human readable"));
/* This is UTF8 */
if(crit)
str=_("Critical signature notation: ");
else
str=_("Signature notation: ");
if(mode)
log_info("%s",str);
else
printf("%s",str);
print_utf8_string(fp,p+8,n1);
fprintf(fp,"=");
fprintf(fp,"\n");
if(*p&0x80)
print_utf8_string(fp,p+8+n1,n2);
else
fprintf(fp,"[ %s ]",_("not human readable"));
fprintf(fp,"\n");
}
}
if(mode)
@ -770,8 +773,8 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
}
printf("ssb%c %4u%c/%s %s",
(sk->protect.s2k.mode==1001)?'#':
(sk->protect.s2k.mode==1002)?'>':' ',
(sk2->protect.s2k.mode==1001)?'#':
(sk2->protect.s2k.mode==1002)?'>':' ',
nbits_from_sk( sk2 ),pubkey_letter( sk2->pubkey_algo ),
keystr_from_sk(sk2),datestr_from_sk( sk2 ) );
if( sk2->expiredate )
@ -871,9 +874,10 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
&& (opt.list_options&LIST_SHOW_POLICY_URLS))
show_policy_url(sig,3,0);
if(sig->flags.notation
&& (opt.list_options&LIST_SHOW_NOTATIONS))
show_notation(sig,3,0,0);
if(sig->flags.notation && (opt.list_options&LIST_SHOW_NOTATIONS))
show_notation(sig,3,0,
((opt.list_options&LIST_SHOW_STD_NOTATIONS)?1:0)+
((opt.list_options&LIST_SHOW_USER_NOTATIONS)?2:0));
if(sig->flags.pref_ks
&& (opt.list_options&LIST_SHOW_KEYSERVER_URLS))

View File

@ -1539,7 +1539,9 @@ check_sig_and_print( CTX c, KBNODE node )
show_keyserver_url(sig,0,2);
if(opt.verify_options&VERIFY_SHOW_NOTATIONS)
show_notation(sig,0,1,0);
show_notation(sig,0,1,
((opt.verify_options&VERIFY_SHOW_STD_NOTATIONS)?1:0)+
((opt.verify_options&VERIFY_SHOW_USER_NOTATIONS)?2:0));
else
show_notation(sig,0,2,0);
}

View File

@ -245,20 +245,24 @@ struct
#define LIST_SHOW_PHOTOS (1<<0)
#define LIST_SHOW_POLICY_URLS (1<<1)
#define LIST_SHOW_NOTATIONS (1<<2)
#define LIST_SHOW_KEYSERVER_URLS (1<<3)
#define LIST_SHOW_VALIDITY (1<<4)
#define LIST_SHOW_UNUSABLE_UIDS (1<<5)
#define LIST_SHOW_UNUSABLE_SUBKEYS (1<<6)
#define LIST_SHOW_KEYRING (1<<7)
#define LIST_SHOW_SIG_EXPIRE (1<<8)
#define LIST_SHOW_STD_NOTATIONS (1<<2)
#define LIST_SHOW_USER_NOTATIONS (1<<3)
#define LIST_SHOW_NOTATIONS (LIST_SHOW_STD_NOTATIONS|LIST_SHOW_USER_NOTATIONS)
#define LIST_SHOW_KEYSERVER_URLS (1<<4)
#define LIST_SHOW_VALIDITY (1<<5)
#define LIST_SHOW_UNUSABLE_UIDS (1<<6)
#define LIST_SHOW_UNUSABLE_SUBKEYS (1<<7)
#define LIST_SHOW_KEYRING (1<<8)
#define LIST_SHOW_SIG_EXPIRE (1<<9)
#define VERIFY_SHOW_PHOTOS (1<<0)
#define VERIFY_SHOW_POLICY_URLS (1<<1)
#define VERIFY_SHOW_NOTATIONS (1<<2)
#define VERIFY_SHOW_KEYSERVER_URLS (1<<3)
#define VERIFY_SHOW_VALIDITY (1<<4)
#define VERIFY_SHOW_UNUSABLE_UIDS (1<<5)
#define VERIFY_SHOW_STD_NOTATIONS (1<<2)
#define VERIFY_SHOW_USER_NOTATIONS (1<<3)
#define VERIFY_SHOW_NOTATIONS (VERIFY_SHOW_STD_NOTATIONS|VERIFY_SHOW_USER_NOTATIONS)
#define VERIFY_SHOW_KEYSERVER_URLS (1<<4)
#define VERIFY_SHOW_VALIDITY (1<<5)
#define VERIFY_SHOW_UNUSABLE_UIDS (1<<6)
#define KEYSERVER_INCLUDE_REVOKED (1<<0)
#define KEYSERVER_INCLUDE_DISABLED (1<<1)