1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-11-09 21:28:51 +01:00

* options.h, g10.c, keyedit.c, keylist.c, mainproc.c: Clarify the

plurarility (or not) of various list and verify options.
This commit is contained in:
David Shaw 2003-11-14 05:06:19 +00:00
parent fbadc93876
commit 80caf9957f
6 changed files with 81 additions and 73 deletions

View File

@ -1,3 +1,8 @@
2003-11-13 David Shaw <dshaw@jabberwocky.com>
* options.h, g10.c, keyedit.c, keylist.c, mainproc.c: Clarify the
plurarility (or not) of various list and verify options.
2003-11-12 David Shaw <dshaw@jabberwocky.com> 2003-11-12 David Shaw <dshaw@jabberwocky.com>
* g10.c (main): Add --symmetric --sign --encrypt. * g10.c (main): Add --symmetric --sign --encrypt.

View File

@ -1224,7 +1224,7 @@ main( int argc, char **argv )
opt.keyserver_options.include_revoked=1; opt.keyserver_options.include_revoked=1;
opt.keyserver_options.try_dns_srv=1; opt.keyserver_options.try_dns_srv=1;
opt.verify_options= opt.verify_options=
VERIFY_SHOW_POLICY|VERIFY_SHOW_NOTATION|VERIFY_SHOW_KEYSERVER; VERIFY_SHOW_POLICY_URLS|VERIFY_SHOW_NOTATIONS|VERIFY_SHOW_KEYSERVER_URLS;
opt.trust_model=TM_AUTO; opt.trust_model=TM_AUTO;
opt.mangle_dos_filenames = 0; opt.mangle_dos_filenames = 0;
#if defined (_WIN32) #if defined (_WIN32)
@ -1691,19 +1691,19 @@ main( int argc, char **argv )
case oCertPolicyURL: add_policy_url(pargs.r.ret_str,1); break; case oCertPolicyURL: add_policy_url(pargs.r.ret_str,1); break;
case oShowPolicyURL: case oShowPolicyURL:
deprecated_warning(configname,configlineno,"--show-policy-url", deprecated_warning(configname,configlineno,"--show-policy-url",
"--list-options ","show-policy-url"); "--list-options ","show-policy-urls");
deprecated_warning(configname,configlineno,"--show-policy-url", deprecated_warning(configname,configlineno,"--show-policy-url",
"--verify-options ","show-policy-url"); "--verify-options ","show-policy-urls");
opt.list_options|=LIST_SHOW_POLICY; opt.list_options|=LIST_SHOW_POLICY_URLS;
opt.verify_options|=VERIFY_SHOW_POLICY; opt.verify_options|=VERIFY_SHOW_POLICY_URLS;
break; break;
case oNoShowPolicyURL: case oNoShowPolicyURL:
deprecated_warning(configname,configlineno,"--no-show-policy-url", deprecated_warning(configname,configlineno,"--no-show-policy-url",
"--list-options ","no-show-policy-url"); "--list-options ","no-show-policy-urls");
deprecated_warning(configname,configlineno,"--no-show-policy-url", deprecated_warning(configname,configlineno,"--no-show-policy-url",
"--verify-options ","no-show-policy-url"); "--verify-options ","no-show-policy-urls");
opt.list_options&=~LIST_SHOW_POLICY; opt.list_options&=~LIST_SHOW_POLICY_URLS;
opt.verify_options&=~VERIFY_SHOW_POLICY; opt.verify_options&=~VERIFY_SHOW_POLICY_URLS;
break; break;
case oSigKeyserverURL: add_keyserver_url(pargs.r.ret_str,0); break; case oSigKeyserverURL: add_keyserver_url(pargs.r.ret_str,0); break;
case oUseEmbeddedFilename: opt.use_embedded_filename = 1; break; case oUseEmbeddedFilename: opt.use_embedded_filename = 1; break;
@ -1878,11 +1878,11 @@ main( int argc, char **argv )
struct parse_options lopts[]= struct parse_options lopts[]=
{ {
{"show-photos",LIST_SHOW_PHOTOS}, {"show-photos",LIST_SHOW_PHOTOS},
{"show-policy-url",LIST_SHOW_POLICY}, {"show-policy-urls",LIST_SHOW_POLICY_URLS},
{"show-notation",LIST_SHOW_NOTATION}, {"show-notations",LIST_SHOW_NOTATIONS},
{"show-keyserver-url",LIST_SHOW_KEYSERVER}, {"show-keyserver-urls",LIST_SHOW_KEYSERVER_URLS},
{"show-validity",LIST_SHOW_VALIDITY}, {"show-validity",LIST_SHOW_VALIDITY},
{"show-long-keyid",LIST_SHOW_LONG_KEYID}, {"show-long-keyids",LIST_SHOW_LONG_KEYIDS},
{"show-unusable-uids",LIST_SHOW_UNUSABLE_UIDS}, {"show-unusable-uids",LIST_SHOW_UNUSABLE_UIDS},
{"show-keyring",LIST_SHOW_KEYRING}, {"show-keyring",LIST_SHOW_KEYRING},
{"show-sig-expire",LIST_SHOW_SIG_EXPIRE}, {"show-sig-expire",LIST_SHOW_SIG_EXPIRE},
@ -1904,11 +1904,11 @@ main( int argc, char **argv )
struct parse_options vopts[]= struct parse_options vopts[]=
{ {
{"show-photos",VERIFY_SHOW_PHOTOS}, {"show-photos",VERIFY_SHOW_PHOTOS},
{"show-policy-url",VERIFY_SHOW_POLICY}, {"show-policy-urls",VERIFY_SHOW_POLICY_URLS},
{"show-notation",VERIFY_SHOW_NOTATION}, {"show-notations",VERIFY_SHOW_NOTATIONS},
{"show-keyserver-url",VERIFY_SHOW_KEYSERVER}, {"show-keyserver-urls",VERIFY_SHOW_KEYSERVER_URLS},
{"show-validity",VERIFY_SHOW_VALIDITY}, {"show-validity",VERIFY_SHOW_VALIDITY},
{"show-long-keyid",VERIFY_SHOW_LONG_KEYID}, {"show-long-keyids",VERIFY_SHOW_LONG_KEYIDS},
{"show-unusable-uids",VERIFY_SHOW_UNUSABLE_UIDS}, {"show-unusable-uids",VERIFY_SHOW_UNUSABLE_UIDS},
{NULL,0} {NULL,0}
}; };
@ -1938,19 +1938,19 @@ main( int argc, char **argv )
case oCertNotation: add_notation_data( pargs.r.ret_str, 1 ); break; case oCertNotation: add_notation_data( pargs.r.ret_str, 1 ); break;
case oShowNotation: case oShowNotation:
deprecated_warning(configname,configlineno,"--show-notation", deprecated_warning(configname,configlineno,"--show-notation",
"--list-options ","show-notation"); "--list-options ","show-notations");
deprecated_warning(configname,configlineno,"--show-notation", deprecated_warning(configname,configlineno,"--show-notation",
"--verify-options ","show-notation"); "--verify-options ","show-notations");
opt.list_options|=LIST_SHOW_NOTATION; opt.list_options|=LIST_SHOW_NOTATIONS;
opt.verify_options|=VERIFY_SHOW_NOTATION; opt.verify_options|=VERIFY_SHOW_NOTATIONS;
break; break;
case oNoShowNotation: case oNoShowNotation:
deprecated_warning(configname,configlineno,"--no-show-notation", deprecated_warning(configname,configlineno,"--no-show-notation",
"--list-options ","no-show-notation"); "--list-options ","no-show-notations");
deprecated_warning(configname,configlineno,"--no-show-notation", deprecated_warning(configname,configlineno,"--no-show-notation",
"--verify-options ","no-show-notation"); "--verify-options ","no-show-notations");
opt.list_options&=~LIST_SHOW_NOTATION; opt.list_options&=~LIST_SHOW_NOTATIONS;
opt.verify_options&=~VERIFY_SHOW_NOTATION; opt.verify_options&=~VERIFY_SHOW_NOTATIONS;
break; break;
case oUtf8Strings: utf8_strings = 1; break; case oUtf8Strings: utf8_strings = 1; break;
case oNoUtf8Strings: utf8_strings = 0; break; case oNoUtf8Strings: utf8_strings = 0; break;

View File

@ -145,7 +145,7 @@ print_and_check_one_sig( KBNODE keyblock, KBNODE node,
sig->flags.expired?'X':' ', sig->flags.expired?'X':' ',
(sig->trust_depth>9)?'T': (sig->trust_depth>9)?'T':
(sig->trust_depth>0)?'0'+sig->trust_depth:' '); (sig->trust_depth>0)?'0'+sig->trust_depth:' ');
if(opt.list_options&LIST_SHOW_LONG_KEYID) if(opt.list_options&LIST_SHOW_LONG_KEYIDS)
tty_printf("%08lX%08lX",(ulong)sig->keyid[0],(ulong)sig->keyid[1]); tty_printf("%08lX%08lX",(ulong)sig->keyid[0],(ulong)sig->keyid[1]);
else else
tty_printf("%08lX",(ulong)sig->keyid[1]); tty_printf("%08lX",(ulong)sig->keyid[1]);
@ -169,13 +169,13 @@ print_and_check_one_sig( KBNODE keyblock, KBNODE node,
} }
tty_printf("\n"); tty_printf("\n");
if(sig->flags.policy_url && (opt.list_options&LIST_SHOW_POLICY)) if(sig->flags.policy_url && (opt.list_options&LIST_SHOW_POLICY_URLS))
show_policy_url(sig,3,0); show_policy_url(sig,3,0);
if(sig->flags.notation && (opt.list_options&LIST_SHOW_NOTATION)) if(sig->flags.notation && (opt.list_options&LIST_SHOW_NOTATIONS))
show_notation(sig,3,0); show_notation(sig,3,0);
if(sig->flags.pref_ks && (opt.list_options&LIST_SHOW_KEYSERVER)) if(sig->flags.pref_ks && (opt.list_options&LIST_SHOW_KEYSERVER_URLS))
show_keyserver_url(sig,3,0); show_keyserver_url(sig,3,0);
} }
@ -2068,7 +2068,7 @@ show_key_with_all_names( KBNODE keyblock, int only_marked, int with_revoker,
nbits_from_pk( pk ), nbits_from_pk( pk ),
pubkey_letter( pk->pubkey_algo )); pubkey_letter( pk->pubkey_algo ));
if(opt.list_options&LIST_SHOW_LONG_KEYID) if(opt.list_options&LIST_SHOW_LONG_KEYIDS)
tty_printf("%08lX",(ulong)pk->keyid[0]); tty_printf("%08lX",(ulong)pk->keyid[0]);
tty_printf("%08lX ",(ulong)pk->keyid[1]); tty_printf("%08lX ",(ulong)pk->keyid[1]);
@ -2082,7 +2082,7 @@ show_key_with_all_names( KBNODE keyblock, int only_marked, int with_revoker,
if(opt.trust_model!=TM_ALWAYS) if(opt.trust_model!=TM_ALWAYS)
{ {
tty_printf(" "); tty_printf(" ");
if(opt.list_options&LIST_SHOW_LONG_KEYID) if(opt.list_options&LIST_SHOW_LONG_KEYIDS)
tty_printf(" "); tty_printf(" ");
/* Ownertrust is only meaningful for the PGP or /* Ownertrust is only meaningful for the PGP or
classic trust models */ classic trust models */

View File

@ -1,6 +1,6 @@
/* keylist.c /* keylist.c
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 * Copyright (C) 1998, 1999, 2000, 2001, 2002
* Free Software Foundation, Inc. * 2003 Free Software Foundation, Inc.
* *
* This file is part of GnuPG. * This file is part of GnuPG.
* *
@ -605,7 +605,7 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
struct sig_stats *stats=opaque; struct sig_stats *stats=opaque;
int skip_sigs=0; int skip_sigs=0;
int newformat=((opt.list_options&LIST_SHOW_VALIDITY) && !secret) int newformat=((opt.list_options&LIST_SHOW_VALIDITY) && !secret)
|| (opt.list_options & (LIST_SHOW_LONG_KEYID | LIST_SHOW_UNUSABLE_UIDS)); || (opt.list_options & (LIST_SHOW_LONG_KEYIDS|LIST_SHOW_UNUSABLE_UIDS));
/* get the keyid from the keyblock */ /* get the keyid from the keyblock */
node = find_kbnode( keyblock, secret? PKT_SECRET_KEY : PKT_PUBLIC_KEY ); node = find_kbnode( keyblock, secret? PKT_SECRET_KEY : PKT_PUBLIC_KEY );
@ -625,7 +625,7 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
(sk->protect.s2k.mode==1002)?'>':' ', (sk->protect.s2k.mode==1002)?'>':' ',
nbits_from_sk( sk ),pubkey_letter( sk->pubkey_algo )); nbits_from_sk( sk ),pubkey_letter( sk->pubkey_algo ));
if(opt.list_options&LIST_SHOW_LONG_KEYID) if(opt.list_options&LIST_SHOW_LONG_KEYIDS)
printf("%08lX%08lX",(ulong)keyid[0],(ulong)keyid[1]); printf("%08lX%08lX",(ulong)keyid[0],(ulong)keyid[1]);
else else
printf("%08lX",(ulong)keyid[1]); printf("%08lX",(ulong)keyid[1]);
@ -653,7 +653,7 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
printf("pub %4u%c/", printf("pub %4u%c/",
nbits_from_pk(pk),pubkey_letter(pk->pubkey_algo)); nbits_from_pk(pk),pubkey_letter(pk->pubkey_algo));
if(opt.list_options&LIST_SHOW_LONG_KEYID) if(opt.list_options&LIST_SHOW_LONG_KEYIDS)
printf("%08lX%08lX",(ulong)keyid[0],(ulong)keyid[1]); printf("%08lX%08lX",(ulong)keyid[0],(ulong)keyid[1]);
else else
printf("%08lX",(ulong)keyid[1]); printf("%08lX",(ulong)keyid[1]);
@ -696,7 +696,7 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
if(uid->is_revoked || uid->is_expired) if(uid->is_revoked || uid->is_expired)
printf("uid%*s[%s] ", printf("uid%*s[%s] ",
(opt.list_options&LIST_SHOW_LONG_KEYID)?16:8,"", (opt.list_options&LIST_SHOW_LONG_KEYIDS)?16:8,"",
uid->is_revoked?"revoked":"expired"); uid->is_revoked?"revoked":"expired");
else if((opt.list_options&LIST_SHOW_VALIDITY) && pk) else if((opt.list_options&LIST_SHOW_VALIDITY) && pk)
{ {
@ -704,7 +704,7 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
trust_value_to_string(get_validity(pk,uid)); trust_value_to_string(get_validity(pk,uid));
/* Includes the 3 spaces for [, ], and " ". */ /* Includes the 3 spaces for [, ], and " ". */
indent=((opt.list_options&LIST_SHOW_LONG_KEYID)?23:15) indent=((opt.list_options&LIST_SHOW_LONG_KEYIDS)?23:15)
-strlen(validity); -strlen(validity);
if(indent<0) if(indent<0)
@ -714,7 +714,7 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
} }
else if(newformat) else if(newformat)
printf("uid%*s", printf("uid%*s",
(opt.list_options&LIST_SHOW_LONG_KEYID)?26:18,""); (opt.list_options&LIST_SHOW_LONG_KEYIDS)?26:18,"");
else if(any) else if(any)
printf("uid%*s",29,""); printf("uid%*s",29,"");
@ -745,7 +745,7 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
keyid_from_pk( pk2, keyid2 ); keyid_from_pk( pk2, keyid2 );
printf("sub %4u%c/", printf("sub %4u%c/",
nbits_from_pk( pk2 ),pubkey_letter( pk2->pubkey_algo )); nbits_from_pk( pk2 ),pubkey_letter( pk2->pubkey_algo ));
if(opt.list_options&LIST_SHOW_LONG_KEYID) if(opt.list_options&LIST_SHOW_LONG_KEYIDS)
printf("%08lX%08lX",(ulong)keyid2[0],(ulong)keyid2[1]); printf("%08lX%08lX",(ulong)keyid2[0],(ulong)keyid2[1]);
else else
printf("%08lX",(ulong)keyid2[1]); printf("%08lX",(ulong)keyid2[1]);
@ -774,7 +774,7 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
(sk->protect.s2k.mode==1001)?'#': (sk->protect.s2k.mode==1001)?'#':
(sk->protect.s2k.mode==1002)?'>':' ', (sk->protect.s2k.mode==1002)?'>':' ',
nbits_from_sk( sk2 ),pubkey_letter( sk2->pubkey_algo )); nbits_from_sk( sk2 ),pubkey_letter( sk2->pubkey_algo ));
if(opt.list_options&LIST_SHOW_LONG_KEYID) if(opt.list_options&LIST_SHOW_LONG_KEYIDS)
printf("%08lX%08lX",(ulong)keyid2[0],(ulong)keyid2[1]); printf("%08lX%08lX",(ulong)keyid2[0],(ulong)keyid2[1]);
else else
printf("%08lX",(ulong)keyid2[1]); printf("%08lX",(ulong)keyid2[1]);
@ -857,7 +857,7 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
sig->flags.expired?'X':' ', sig->flags.expired?'X':' ',
(sig->trust_depth>9)?'T': (sig->trust_depth>9)?'T':
(sig->trust_depth>0)?'0'+sig->trust_depth:' '); (sig->trust_depth>0)?'0'+sig->trust_depth:' ');
if(opt.list_options&LIST_SHOW_LONG_KEYID) if(opt.list_options&LIST_SHOW_LONG_KEYIDS)
printf("%08lX%08lX",(ulong)sig->keyid[0],(ulong)sig->keyid[1]); printf("%08lX%08lX",(ulong)sig->keyid[0],(ulong)sig->keyid[1]);
else else
printf("%08lX",(ulong)sig->keyid[1]); printf("%08lX",(ulong)sig->keyid[1]);
@ -877,13 +877,16 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
} }
putchar('\n'); putchar('\n');
if(sig->flags.policy_url && (opt.list_options&LIST_SHOW_POLICY)) if(sig->flags.policy_url
&& (opt.list_options&LIST_SHOW_POLICY_URLS))
show_policy_url(sig,3,0); show_policy_url(sig,3,0);
if(sig->flags.notation && (opt.list_options&LIST_SHOW_NOTATION)) if(sig->flags.notation
&& (opt.list_options&LIST_SHOW_NOTATIONS))
show_notation(sig,3,0); show_notation(sig,3,0);
if(sig->flags.pref_ks && (opt.list_options&LIST_SHOW_KEYSERVER)) if(sig->flags.pref_ks
&& (opt.list_options&LIST_SHOW_KEYSERVER_URLS))
show_keyserver_url(sig,3,0); show_keyserver_url(sig,3,0);
/* fixme: check or list other sigs here */ /* fixme: check or list other sigs here */

View File

@ -1306,7 +1306,7 @@ check_sig_and_print( CTX c, KBNODE node )
tstr = asctimestamp(sig->timestamp); tstr = asctimestamp(sig->timestamp);
astr = pubkey_algo_to_string( sig->pubkey_algo ); astr = pubkey_algo_to_string( sig->pubkey_algo );
if(opt.verify_options&VERIFY_SHOW_LONG_KEYID) if(opt.verify_options&VERIFY_SHOW_LONG_KEYIDS)
{ {
log_info(_("Signature made %.*s\n"),(int)strlen(tstr), tstr); log_info(_("Signature made %.*s\n"),(int)strlen(tstr), tstr);
log_info(_(" using %s key %08lX%08lX\n"), log_info(_(" using %s key %08lX%08lX\n"),
@ -1499,17 +1499,17 @@ check_sig_and_print( CTX c, KBNODE node )
if( !rc ) if( !rc )
{ {
if(opt.verify_options&VERIFY_SHOW_POLICY) if(opt.verify_options&VERIFY_SHOW_POLICY_URLS)
show_policy_url(sig,0,1); show_policy_url(sig,0,1);
else else
show_policy_url(sig,0,2); show_policy_url(sig,0,2);
if(opt.verify_options&VERIFY_SHOW_KEYSERVER) if(opt.verify_options&VERIFY_SHOW_KEYSERVER_URLS)
show_keyserver_url(sig,0,1); show_keyserver_url(sig,0,1);
else else
show_keyserver_url(sig,0,2); show_keyserver_url(sig,0,2);
if(opt.verify_options&VERIFY_SHOW_NOTATION) if(opt.verify_options&VERIFY_SHOW_NOTATIONS)
show_notation(sig,0,1); show_notation(sig,0,1);
else else
show_notation(sig,0,2); show_notation(sig,0,2);

View File

@ -227,32 +227,32 @@ struct {
/* Various option flags */ /* Various option flags */
#define IMPORT_ALLOW_LOCAL_SIGS 1 #define IMPORT_ALLOW_LOCAL_SIGS (1<<0)
#define IMPORT_REPAIR_PKS_SUBKEY_BUG 2 #define IMPORT_REPAIR_PKS_SUBKEY_BUG (1<<1)
#define IMPORT_FAST_IMPORT 4 #define IMPORT_FAST_IMPORT (1<<2)
#define IMPORT_SK2PK 8 #define IMPORT_SK2PK (1<<3)
#define EXPORT_INCLUDE_NON_RFC 1 #define EXPORT_INCLUDE_NON_RFC (1<<0)
#define EXPORT_INCLUDE_LOCAL_SIGS 2 #define EXPORT_INCLUDE_LOCAL_SIGS (1<<1)
#define EXPORT_INCLUDE_ATTRIBUTES 4 #define EXPORT_INCLUDE_ATTRIBUTES (1<<2)
#define EXPORT_INCLUDE_SENSITIVE_REVKEYS 8 #define EXPORT_INCLUDE_SENSITIVE_REVKEYS (1<<3)
#define LIST_SHOW_PHOTOS (1<<0) #define LIST_SHOW_PHOTOS (1<<0)
#define LIST_SHOW_POLICY (1<<1) #define LIST_SHOW_POLICY_URLS (1<<1)
#define LIST_SHOW_NOTATION (1<<2) #define LIST_SHOW_NOTATIONS (1<<2)
#define LIST_SHOW_KEYSERVER (1<<3) #define LIST_SHOW_KEYSERVER_URLS (1<<3)
#define LIST_SHOW_VALIDITY (1<<4) #define LIST_SHOW_VALIDITY (1<<4)
#define LIST_SHOW_LONG_KEYID (1<<5) #define LIST_SHOW_LONG_KEYIDS (1<<5)
#define LIST_SHOW_UNUSABLE_UIDS (1<<6) #define LIST_SHOW_UNUSABLE_UIDS (1<<6)
#define LIST_SHOW_KEYRING (1<<7) #define LIST_SHOW_KEYRING (1<<7)
#define LIST_SHOW_SIG_EXPIRE (1<<8) #define LIST_SHOW_SIG_EXPIRE (1<<8)
#define VERIFY_SHOW_PHOTOS (1<<0) #define VERIFY_SHOW_PHOTOS (1<<0)
#define VERIFY_SHOW_POLICY (1<<1) #define VERIFY_SHOW_POLICY_URLS (1<<1)
#define VERIFY_SHOW_NOTATION (1<<2) #define VERIFY_SHOW_NOTATIONS (1<<2)
#define VERIFY_SHOW_KEYSERVER (1<<3) #define VERIFY_SHOW_KEYSERVER_URLS (1<<3)
#define VERIFY_SHOW_VALIDITY (1<<4) #define VERIFY_SHOW_VALIDITY (1<<4)
#define VERIFY_SHOW_LONG_KEYID (1<<5) #define VERIFY_SHOW_LONG_KEYIDS (1<<5)
#define VERIFY_SHOW_UNUSABLE_UIDS (1<<6) #define VERIFY_SHOW_UNUSABLE_UIDS (1<<6)
#endif /*G10_OPTIONS_H*/ #endif /*G10_OPTIONS_H*/