mirror of
git://git.gnupg.org/gnupg.git
synced 2025-03-28 22:49:59 +01:00
* mainproc.c (check_sig_and_print), main.h, keylist.c (show_policy,
show_notation): Collapse the old print_notation_data into show_policy() and show_notation() so there is only one function to print notations and policy URLs. * options.h, main.h, g10.c (main), keyedit.c (print_and_check_one_sig), keylist.c (list_one, list_keyblock_print), pkclist.c (do_edit_ownertrust), sign.c (mk_notation_and_policy): New "list-options" and "verify-options" commands. These replace the existing --show-photos/--no-show-photos, --show-notation/--no-show-notation, --show-policy-url/--no-show-policy-url, and --show-keyring options. The new method is more flexible since a user can specify (for example) showing photos during sig verification, but not in key listings. The old options are emulated.
This commit is contained in:
parent
ff43d07819
commit
b17358948d
@ -1,5 +1,22 @@
|
|||||||
2003-05-31 David Shaw <dshaw@jabberwocky.com>
|
2003-05-31 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
|
* mainproc.c (check_sig_and_print), main.h, keylist.c
|
||||||
|
(show_policy, show_notation): Collapse the old print_notation_data
|
||||||
|
into show_policy() and show_notation() so there is only one
|
||||||
|
function to print notations and policy URLs.
|
||||||
|
|
||||||
|
* options.h, main.h, g10.c (main), keyedit.c
|
||||||
|
(print_and_check_one_sig), keylist.c (list_one,
|
||||||
|
list_keyblock_print), pkclist.c (do_edit_ownertrust), sign.c
|
||||||
|
(mk_notation_and_policy): New "list-options" and "verify-options"
|
||||||
|
commands. These replace the existing
|
||||||
|
--show-photos/--no-show-photos,
|
||||||
|
--show-notation/--no-show-notation,
|
||||||
|
--show-policy-url/--no-show-policy-url, and --show-keyring
|
||||||
|
options. The new method is more flexible since a user can specify
|
||||||
|
(for example) showing photos during sig verification, but not in
|
||||||
|
key listings. The old options are emulated.
|
||||||
|
|
||||||
* main.h, misc.c (parse_options): New general option line
|
* main.h, misc.c (parse_options): New general option line
|
||||||
parser. Fix the bug in the old version that did not handle report
|
parser. Fix the bug in the old version that did not handle report
|
||||||
syntax errors after a valid entry.
|
syntax errors after a valid entry.
|
||||||
|
82
g10/g10.c
82
g10/g10.c
@ -250,6 +250,8 @@ enum cmd_and_opt_values { aNull = 0,
|
|||||||
oKeyServerOptions,
|
oKeyServerOptions,
|
||||||
oImportOptions,
|
oImportOptions,
|
||||||
oExportOptions,
|
oExportOptions,
|
||||||
|
oListOptions,
|
||||||
|
oVerifyOptions,
|
||||||
oTempDir,
|
oTempDir,
|
||||||
oExecPath,
|
oExecPath,
|
||||||
oEncryptTo,
|
oEncryptTo,
|
||||||
@ -434,6 +436,7 @@ static ARGPARSE_OPTS opts[] = {
|
|||||||
{ oKeyServerOptions, "keyserver-options",2,"@"},
|
{ oKeyServerOptions, "keyserver-options",2,"@"},
|
||||||
{ oImportOptions, "import-options",2,"@"},
|
{ oImportOptions, "import-options",2,"@"},
|
||||||
{ oExportOptions, "export-options",2,"@"},
|
{ oExportOptions, "export-options",2,"@"},
|
||||||
|
{ oListOptions, "list-options",2,"@"},
|
||||||
{ oCharset, "charset" , 2, N_("|NAME|set terminal charset to NAME") },
|
{ oCharset, "charset" , 2, N_("|NAME|set terminal charset to NAME") },
|
||||||
{ oOptions, "options" , 2, N_("read options from file")},
|
{ oOptions, "options" , 2, N_("read options from file")},
|
||||||
|
|
||||||
@ -478,9 +481,9 @@ static ARGPARSE_OPTS opts[] = {
|
|||||||
{ oCompressAlgo,"compress-algo",2,N_("|NAME|use compression algorithm NAME")},
|
{ oCompressAlgo,"compress-algo",2,N_("|NAME|use compression algorithm NAME")},
|
||||||
{ oThrowKeyid, "throw-keyid", 0, N_("throw keyid field of encrypted packets")},
|
{ oThrowKeyid, "throw-keyid", 0, N_("throw keyid field of encrypted packets")},
|
||||||
{ oNoThrowKeyid, "no-throw-keyid", 0, "@" },
|
{ oNoThrowKeyid, "no-throw-keyid", 0, "@" },
|
||||||
{ oShowPhotos, "show-photos", 0, N_("Show Photo IDs")},
|
{ oShowPhotos, "show-photos", 0, "@" },
|
||||||
{ oNoShowPhotos, "no-show-photos", 0, N_("Don't show Photo IDs")},
|
{ oNoShowPhotos, "no-show-photos", 0, "@" },
|
||||||
{ oPhotoViewer, "photo-viewer", 2, N_("Set command line to view Photo IDs")},
|
{ oPhotoViewer, "photo-viewer", 2, "@" },
|
||||||
{ oNotation, "notation-data", 2, "@" },
|
{ oNotation, "notation-data", 2, "@" },
|
||||||
{ oSigNotation, "sig-notation", 2, "@" },
|
{ oSigNotation, "sig-notation", 2, "@" },
|
||||||
{ oCertNotation, "cert-notation", 2, "@" },
|
{ oCertNotation, "cert-notation", 2, "@" },
|
||||||
@ -1403,7 +1406,7 @@ main( int argc, char **argv )
|
|||||||
sl=append_to_strlist( &nrings, pargs.r.ret_str);
|
sl=append_to_strlist( &nrings, pargs.r.ret_str);
|
||||||
sl->flags=2;
|
sl->flags=2;
|
||||||
break;
|
break;
|
||||||
case oShowKeyring: opt.show_keyring = 1; break;
|
case oShowKeyring: opt.list_options|=LIST_SHOW_KEYRING; break;
|
||||||
case oDebug: opt.debug |= pargs.r.ret_ulong; break;
|
case oDebug: opt.debug |= pargs.r.ret_ulong; break;
|
||||||
case oDebugAll: opt.debug = ~0; break;
|
case oDebugAll: opt.debug = ~0; break;
|
||||||
case oStatusFD:
|
case oStatusFD:
|
||||||
@ -1576,15 +1579,27 @@ main( int argc, char **argv )
|
|||||||
break;
|
break;
|
||||||
case oSigPolicyURL: add_policy_url(pargs.r.ret_str,0); break;
|
case oSigPolicyURL: add_policy_url(pargs.r.ret_str,0); break;
|
||||||
case oCertPolicyURL: add_policy_url(pargs.r.ret_str,1); break;
|
case oCertPolicyURL: add_policy_url(pargs.r.ret_str,1); break;
|
||||||
case oShowPolicyURL: opt.show_policy_url=1; break;
|
case oShowPolicyURL:
|
||||||
case oNoShowPolicyURL: opt.show_policy_url=0; break;
|
opt.list_options|=LIST_SHOW_POLICY;
|
||||||
|
opt.verify_options|=VERIFY_SHOW_POLICY;
|
||||||
|
break;
|
||||||
|
case oNoShowPolicyURL:
|
||||||
|
opt.list_options&=~LIST_SHOW_POLICY;
|
||||||
|
opt.verify_options&=~VERIFY_SHOW_POLICY;
|
||||||
|
break;
|
||||||
case oUseEmbeddedFilename: opt.use_embedded_filename = 1; break;
|
case oUseEmbeddedFilename: opt.use_embedded_filename = 1; break;
|
||||||
case oComment: opt.comment_string = pargs.r.ret_str; break;
|
case oComment: opt.comment_string = pargs.r.ret_str; break;
|
||||||
case oDefaultComment: opt.comment_string = NULL; break;
|
case oDefaultComment: opt.comment_string = NULL; break;
|
||||||
case oThrowKeyid: opt.throw_keyid = 1; break;
|
case oThrowKeyid: opt.throw_keyid = 1; break;
|
||||||
case oNoThrowKeyid: opt.throw_keyid = 0; break;
|
case oNoThrowKeyid: opt.throw_keyid = 0; break;
|
||||||
case oShowPhotos: opt.show_photos = 1; break;
|
case oShowPhotos:
|
||||||
case oNoShowPhotos: opt.show_photos = 0; break;
|
opt.list_options|=LIST_SHOW_PHOTOS;
|
||||||
|
opt.verify_options|=VERIFY_SHOW_PHOTOS;
|
||||||
|
break;
|
||||||
|
case oNoShowPhotos:
|
||||||
|
opt.list_options&=~LIST_SHOW_PHOTOS;
|
||||||
|
opt.verify_options&=~VERIFY_SHOW_PHOTOS;
|
||||||
|
break;
|
||||||
case oPhotoViewer: opt.photo_viewer = pargs.r.ret_str; break;
|
case oPhotoViewer: opt.photo_viewer = pargs.r.ret_str; break;
|
||||||
case oForceV3Sigs: opt.force_v3_sigs = 1; break;
|
case oForceV3Sigs: opt.force_v3_sigs = 1; break;
|
||||||
case oNoForceV3Sigs: opt.force_v3_sigs = 0; break;
|
case oNoForceV3Sigs: opt.force_v3_sigs = 0; break;
|
||||||
@ -1720,6 +1735,47 @@ main( int argc, char **argv )
|
|||||||
log_error(_("invalid export options\n"));
|
log_error(_("invalid export options\n"));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case oListOptions:
|
||||||
|
{
|
||||||
|
struct parse_options lopts[]=
|
||||||
|
{
|
||||||
|
{"show-photos",LIST_SHOW_PHOTOS},
|
||||||
|
{"show-policy-url",LIST_SHOW_POLICY},
|
||||||
|
{"show-notation",LIST_SHOW_NOTATION},
|
||||||
|
{"show-keyring",LIST_SHOW_KEYRING},
|
||||||
|
{NULL,0}
|
||||||
|
};
|
||||||
|
|
||||||
|
if(!parse_options(pargs.r.ret_str,&opt.list_options,lopts))
|
||||||
|
{
|
||||||
|
if(configname)
|
||||||
|
log_error(_("%s:%d: invalid list options\n"),
|
||||||
|
configname,configlineno);
|
||||||
|
else
|
||||||
|
log_error(_("invalid list options\n"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case oVerifyOptions:
|
||||||
|
{
|
||||||
|
struct parse_options vopts[]=
|
||||||
|
{
|
||||||
|
{"show-photos",VERIFY_SHOW_PHOTOS},
|
||||||
|
{"show-policy-url",VERIFY_SHOW_POLICY},
|
||||||
|
{"show-notation",VERIFY_SHOW_NOTATION},
|
||||||
|
{NULL,0}
|
||||||
|
};
|
||||||
|
|
||||||
|
if(!parse_options(pargs.r.ret_str,&opt.verify_options,vopts))
|
||||||
|
{
|
||||||
|
if(configname)
|
||||||
|
log_error(_("%s:%d: invalid verify options\n"),
|
||||||
|
configname,configlineno);
|
||||||
|
else
|
||||||
|
log_error(_("invalid verify options\n"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case oTempDir: opt.temp_dir=pargs.r.ret_str; break;
|
case oTempDir: opt.temp_dir=pargs.r.ret_str; break;
|
||||||
case oExecPath:
|
case oExecPath:
|
||||||
if(set_exec_path(pargs.r.ret_str,0))
|
if(set_exec_path(pargs.r.ret_str,0))
|
||||||
@ -1733,8 +1789,14 @@ main( int argc, char **argv )
|
|||||||
break;
|
break;
|
||||||
case oSigNotation: add_notation_data( pargs.r.ret_str, 0 ); break;
|
case oSigNotation: add_notation_data( pargs.r.ret_str, 0 ); break;
|
||||||
case oCertNotation: add_notation_data( pargs.r.ret_str, 1 ); break;
|
case oCertNotation: add_notation_data( pargs.r.ret_str, 1 ); break;
|
||||||
case oShowNotation: opt.show_notation=1; break;
|
case oShowNotation:
|
||||||
case oNoShowNotation: opt.show_notation=0; break;
|
opt.list_options|=LIST_SHOW_NOTATION;
|
||||||
|
opt.verify_options|=VERIFY_SHOW_NOTATION;
|
||||||
|
break;
|
||||||
|
case oNoShowNotation:
|
||||||
|
opt.list_options&=~LIST_SHOW_NOTATION;
|
||||||
|
opt.verify_options&=~VERIFY_SHOW_NOTATION;
|
||||||
|
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;
|
||||||
case oDisableCipherAlgo:
|
case oDisableCipherAlgo:
|
||||||
|
@ -161,11 +161,11 @@ print_and_check_one_sig( KBNODE keyblock, KBNODE node,
|
|||||||
}
|
}
|
||||||
tty_printf("\n");
|
tty_printf("\n");
|
||||||
|
|
||||||
if(sig->flags.policy_url && opt.show_policy_url)
|
if(sig->flags.policy_url && (opt.list_options&LIST_SHOW_POLICY))
|
||||||
show_policy_url(sig,3);
|
show_policy_url(sig,3,0);
|
||||||
|
|
||||||
if(sig->flags.notation && opt.show_notation)
|
if(sig->flags.notation && (opt.list_options&LIST_SHOW_NOTATION))
|
||||||
show_notation(sig,3);
|
show_notation(sig,3,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (sigrc == '!');
|
return (sigrc == '!');
|
||||||
|
@ -116,35 +116,43 @@ print_pubkey_info (PKT_public_key *pk)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
show_policy_url(PKT_signature *sig,int indent)
|
show_policy_url(PKT_signature *sig,int indent,int mode)
|
||||||
{
|
{
|
||||||
const byte *p;
|
const byte *p;
|
||||||
size_t len;
|
size_t len;
|
||||||
int seq=0,crit;
|
int seq=0,crit;
|
||||||
|
FILE *fp=mode?log_stream():stdout;
|
||||||
|
|
||||||
while((p=enum_sig_subpkt(sig->hashed,SIGSUBPKT_POLICY,&len,&seq,&crit)))
|
while((p=enum_sig_subpkt(sig->hashed,SIGSUBPKT_POLICY,&len,&seq,&crit)))
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
char *str;
|
||||||
|
|
||||||
for(i=0;i<indent;i++)
|
for(i=0;i<indent;i++)
|
||||||
putchar(' ');
|
putchar(' ');
|
||||||
|
|
||||||
/* This isn't UTF8 as it is a URL(?) */
|
/* This isn't UTF8 as it is a URL(?) */
|
||||||
if(crit)
|
if(crit)
|
||||||
printf(_("Critical signature policy: "));
|
str=_("Critical signature policy: ");
|
||||||
else
|
else
|
||||||
printf(_("Signature policy: "));
|
str=_("Signature policy: ");
|
||||||
print_string(stdout,p,len,0);
|
if(mode)
|
||||||
printf("\n");
|
log_info("%s",str);
|
||||||
|
else
|
||||||
|
printf("%s",str);
|
||||||
|
print_string(fp,p,len,0);
|
||||||
|
fprintf(fp,"\n");
|
||||||
|
write_status_buffer ( STATUS_POLICY_URL, p, len, 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
show_notation(PKT_signature *sig,int indent)
|
show_notation(PKT_signature *sig,int indent,int mode)
|
||||||
{
|
{
|
||||||
const byte *p;
|
const byte *p;
|
||||||
size_t len;
|
size_t len;
|
||||||
int seq=0,crit;
|
int seq=0,crit;
|
||||||
|
FILE *fp=mode?log_stream():stdout;
|
||||||
|
|
||||||
/* There may be multiple notations in the same sig. */
|
/* There may be multiple notations in the same sig. */
|
||||||
|
|
||||||
@ -152,6 +160,7 @@ show_notation(PKT_signature *sig,int indent)
|
|||||||
if(len>=8)
|
if(len>=8)
|
||||||
{
|
{
|
||||||
int n1,n2,i;
|
int n1,n2,i;
|
||||||
|
char *str;
|
||||||
|
|
||||||
n1=(p[4]<<8)|p[5];
|
n1=(p[4]<<8)|p[5];
|
||||||
n2=(p[6]<<8)|p[7];
|
n2=(p[6]<<8)|p[7];
|
||||||
@ -167,18 +176,28 @@ show_notation(PKT_signature *sig,int indent)
|
|||||||
|
|
||||||
/* This is UTF8 */
|
/* This is UTF8 */
|
||||||
if(crit)
|
if(crit)
|
||||||
printf(_("Critical signature notation: "));
|
str=_("Critical signature notation: ");
|
||||||
else
|
else
|
||||||
printf(_("Signature notation: "));
|
str=_("Signature notation: ");
|
||||||
print_utf8_string(stdout,p+8,n1);
|
if(mode)
|
||||||
printf("=");
|
log_info("%s",str);
|
||||||
|
else
|
||||||
|
printf("%s",str);
|
||||||
|
print_utf8_string(fp,p+8,n1);
|
||||||
|
fprintf(fp,"=");
|
||||||
|
|
||||||
if(*p&0x80)
|
if(*p&0x80)
|
||||||
print_utf8_string(stdout,p+8+n1,n2);
|
print_utf8_string(fp,p+8+n1,n2);
|
||||||
else
|
else
|
||||||
printf("[ %s ]",_("not human readable"));
|
fprintf(fp,"[ %s ]",_("not human readable"));
|
||||||
|
|
||||||
printf("\n");
|
fprintf(fp,"\n");
|
||||||
|
|
||||||
|
if(mode)
|
||||||
|
{
|
||||||
|
write_status_buffer ( STATUS_NOTATION_NAME, p+8 , n1, 0 );
|
||||||
|
write_status_buffer ( STATUS_NOTATION_DATA, p+8+n1, n2, 50 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
log_info(_("WARNING: invalid notation data found\n"));
|
log_info(_("WARNING: invalid notation data found\n"));
|
||||||
@ -292,7 +311,7 @@ list_one( STRLIST names, int secret )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
if (opt.show_keyring && !opt.with_colons) {
|
if ((opt.list_options&LIST_SHOW_KEYRING) && !opt.with_colons) {
|
||||||
resname = keydb_get_resource_name (get_ctx_handle(ctx));
|
resname = keydb_get_resource_name (get_ctx_handle(ctx));
|
||||||
printf("%s: %s\n", keyring_str, resname);
|
printf("%s: %s\n", keyring_str, resname);
|
||||||
for(i = strlen(resname) + strlen(keyring_str) + 2; i; i-- )
|
for(i = strlen(resname) + strlen(keyring_str) + 2; i; i-- )
|
||||||
@ -312,7 +331,7 @@ list_one( STRLIST names, int secret )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
if (opt.show_keyring && !opt.with_colons) {
|
if ((opt.list_options&LIST_SHOW_KEYRING) && !opt.with_colons) {
|
||||||
resname = keydb_get_resource_name (get_ctx_handle(ctx));
|
resname = keydb_get_resource_name (get_ctx_handle(ctx));
|
||||||
printf("%s: %s\n", keyring_str, resname);
|
printf("%s: %s\n", keyring_str, resname);
|
||||||
for(i = strlen(resname) + strlen(keyring_str) + 2; i; i-- )
|
for(i = strlen(resname) + strlen(keyring_str) + 2; i; i-- )
|
||||||
@ -525,7 +544,8 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
|
|||||||
any = 1;
|
any = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(opt.show_photos && node->pkt->pkt.user_id->attribs!=NULL)
|
if((opt.list_options&LIST_SHOW_PHOTOS)
|
||||||
|
&& node->pkt->pkt.user_id->attribs!=NULL)
|
||||||
show_photos(node->pkt->pkt.user_id->attribs,
|
show_photos(node->pkt->pkt.user_id->attribs,
|
||||||
node->pkt->pkt.user_id->numattribs,pk,sk);
|
node->pkt->pkt.user_id->numattribs,pk,sk);
|
||||||
}
|
}
|
||||||
@ -656,11 +676,11 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
|
|||||||
}
|
}
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
|
|
||||||
if(sig->flags.policy_url && opt.show_policy_url)
|
if(sig->flags.policy_url && (opt.list_options&LIST_SHOW_POLICY))
|
||||||
show_policy_url(sig,3);
|
show_policy_url(sig,3,0);
|
||||||
|
|
||||||
if(sig->flags.notation && opt.show_notation)
|
if(sig->flags.notation && (opt.list_options&LIST_SHOW_NOTATION))
|
||||||
show_notation(sig,3);
|
show_notation(sig,3,0);
|
||||||
|
|
||||||
/* fixme: check or list other sigs here */
|
/* fixme: check or list other sigs here */
|
||||||
}
|
}
|
||||||
|
13
g10/main.h
13
g10/main.h
@ -213,13 +213,18 @@ struct revocation_reason_info *
|
|||||||
void release_revocation_reason_info( struct revocation_reason_info *reason );
|
void release_revocation_reason_info( struct revocation_reason_info *reason );
|
||||||
|
|
||||||
/*-- keylist.c --*/
|
/*-- keylist.c --*/
|
||||||
|
#define LIST_SHOW_PHOTOS 1
|
||||||
|
#define LIST_SHOW_POLICY 2
|
||||||
|
#define LIST_SHOW_NOTATION 4
|
||||||
|
#define LIST_SHOW_KEYRING 8
|
||||||
|
|
||||||
void public_key_list( STRLIST list );
|
void public_key_list( STRLIST list );
|
||||||
void secret_key_list( STRLIST list );
|
void secret_key_list( STRLIST list );
|
||||||
void reorder_keyblock (KBNODE keyblock);
|
void reorder_keyblock (KBNODE keyblock);
|
||||||
void list_keyblock( KBNODE keyblock, int secret, int fpr, void *opaque );
|
void list_keyblock( KBNODE keyblock, int secret, int fpr, void *opaque );
|
||||||
void print_fingerprint (PKT_public_key *pk, PKT_secret_key *sk, int mode);
|
void print_fingerprint (PKT_public_key *pk, PKT_secret_key *sk, int mode);
|
||||||
void show_policy_url(PKT_signature *sig,int indent);
|
void show_policy_url(PKT_signature *sig,int indent,int mode);
|
||||||
void show_notation(PKT_signature *sig,int indent);
|
void show_notation(PKT_signature *sig,int indent,int mode);
|
||||||
void dump_attribs(const PKT_user_id *uid,
|
void dump_attribs(const PKT_user_id *uid,
|
||||||
PKT_public_key *pk,PKT_secret_key *sk);
|
PKT_public_key *pk,PKT_secret_key *sk);
|
||||||
void set_attrib_fd(int fd);
|
void set_attrib_fd(int fd);
|
||||||
@ -227,6 +232,10 @@ void print_seckey_info (PKT_secret_key *sk);
|
|||||||
void print_pubkey_info (PKT_public_key *pk);
|
void print_pubkey_info (PKT_public_key *pk);
|
||||||
|
|
||||||
/*-- verify.c --*/
|
/*-- verify.c --*/
|
||||||
|
#define VERIFY_SHOW_PHOTOS 1
|
||||||
|
#define VERIFY_SHOW_POLICY 2
|
||||||
|
#define VERIFY_SHOW_NOTATION 4
|
||||||
|
|
||||||
void print_file_status( int status, const char *name, int what );
|
void print_file_status( int status, const char *name, int what );
|
||||||
int verify_signatures( int nfiles, char **files );
|
int verify_signatures( int nfiles, char **files );
|
||||||
int verify_files( int nfiles, char **files );
|
int verify_files( int nfiles, char **files );
|
||||||
|
@ -757,52 +757,6 @@ print_userid( PACKET *pkt )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
print_notation_data( PKT_signature *sig )
|
|
||||||
{
|
|
||||||
size_t n, n1, n2;
|
|
||||||
const byte *p;
|
|
||||||
int seq = 0;
|
|
||||||
|
|
||||||
while((p=enum_sig_subpkt(sig->hashed,SIGSUBPKT_NOTATION,&n,&seq,NULL))) {
|
|
||||||
if( n < 8 ) {
|
|
||||||
log_info(_("WARNING: invalid notation data found\n"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if( !(*p & 0x80) )
|
|
||||||
return; /* not human readable */
|
|
||||||
n1 = (p[4] << 8) | p[5];
|
|
||||||
n2 = (p[6] << 8) | p[7];
|
|
||||||
p += 8;
|
|
||||||
if( 8+n1+n2 != n ) {
|
|
||||||
log_info(_("WARNING: invalid notation data found\n"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
log_info(_("Notation: ") );
|
|
||||||
print_string( log_stream(), p, n1, 0 );
|
|
||||||
putc( '=', log_stream() );
|
|
||||||
print_string( log_stream(), p+n1, n2, 0 );
|
|
||||||
putc( '\n', log_stream() );
|
|
||||||
write_status_buffer ( STATUS_NOTATION_NAME, p , n1, 0 );
|
|
||||||
write_status_buffer ( STATUS_NOTATION_DATA, p+n1, n2, 50 );
|
|
||||||
}
|
|
||||||
|
|
||||||
seq=0;
|
|
||||||
|
|
||||||
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() );
|
|
||||||
write_status_buffer ( STATUS_POLICY_URL, p, n, 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Now check whether the key of this signature has some
|
|
||||||
* notation data */
|
|
||||||
|
|
||||||
/* TODO */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/****************
|
/****************
|
||||||
* List the certificate in a user friendly way
|
* List the certificate in a user friendly way
|
||||||
*/
|
*/
|
||||||
@ -1433,7 +1387,7 @@ check_sig_and_print( CTX c, KBNODE node )
|
|||||||
{
|
{
|
||||||
dump_attribs(un->pkt->pkt.user_id,pk,NULL);
|
dump_attribs(un->pkt->pkt.user_id,pk,NULL);
|
||||||
|
|
||||||
if(opt.show_photos)
|
if(opt.verify_options&VERIFY_SHOW_PHOTOS)
|
||||||
show_photos(un->pkt->pkt.user_id->attribs,
|
show_photos(un->pkt->pkt.user_id->attribs,
|
||||||
un->pkt->pkt.user_id->numattribs,pk,NULL);
|
un->pkt->pkt.user_id->numattribs,pk,NULL);
|
||||||
}
|
}
|
||||||
@ -1447,7 +1401,10 @@ check_sig_and_print( CTX c, KBNODE node )
|
|||||||
release_kbnode( keyblock );
|
release_kbnode( keyblock );
|
||||||
|
|
||||||
if( !rc )
|
if( !rc )
|
||||||
print_notation_data( sig );
|
{
|
||||||
|
show_notation(sig,0,1);
|
||||||
|
show_policy_url(sig,0,1);
|
||||||
|
}
|
||||||
|
|
||||||
if( !rc && is_status_enabled() ) {
|
if( !rc && is_status_enabled() ) {
|
||||||
/* print a status response with the fingerprint */
|
/* print a status response with the fingerprint */
|
||||||
|
@ -103,7 +103,6 @@ struct {
|
|||||||
const char *set_filename;
|
const char *set_filename;
|
||||||
const char *comment_string;
|
const char *comment_string;
|
||||||
int throw_keyid;
|
int throw_keyid;
|
||||||
int show_photos;
|
|
||||||
const char *photo_viewer;
|
const char *photo_viewer;
|
||||||
int s2k_mode;
|
int s2k_mode;
|
||||||
int s2k_digest_algo;
|
int s2k_digest_algo;
|
||||||
@ -139,6 +138,8 @@ struct {
|
|||||||
int exec_path_set;
|
int exec_path_set;
|
||||||
unsigned int import_options;
|
unsigned int import_options;
|
||||||
unsigned int export_options;
|
unsigned int export_options;
|
||||||
|
unsigned int list_options;
|
||||||
|
unsigned int verify_options;
|
||||||
char *def_preference_list;
|
char *def_preference_list;
|
||||||
prefitem_t *personal_cipher_prefs;
|
prefitem_t *personal_cipher_prefs;
|
||||||
prefitem_t *personal_digest_prefs;
|
prefitem_t *personal_digest_prefs;
|
||||||
@ -150,10 +151,8 @@ struct {
|
|||||||
int interactive;
|
int interactive;
|
||||||
STRLIST sig_notation_data;
|
STRLIST sig_notation_data;
|
||||||
STRLIST cert_notation_data;
|
STRLIST cert_notation_data;
|
||||||
int show_notation;
|
|
||||||
STRLIST sig_policy_url;
|
STRLIST sig_policy_url;
|
||||||
STRLIST cert_policy_url;
|
STRLIST cert_policy_url;
|
||||||
int show_policy_url;
|
|
||||||
int use_embedded_filename;
|
int use_embedded_filename;
|
||||||
int allow_non_selfsigned_uid;
|
int allow_non_selfsigned_uid;
|
||||||
int allow_freeform_uid;
|
int allow_freeform_uid;
|
||||||
@ -178,7 +177,6 @@ struct {
|
|||||||
int no_auto_check_trustdb;
|
int no_auto_check_trustdb;
|
||||||
int preserve_permissions;
|
int preserve_permissions;
|
||||||
int no_homedir_creation;
|
int no_homedir_creation;
|
||||||
int show_keyring;
|
|
||||||
struct groupitem *grouplist;
|
struct groupitem *grouplist;
|
||||||
int strict;
|
int strict;
|
||||||
int mangle_dos_filenames;
|
int mangle_dos_filenames;
|
||||||
|
@ -294,7 +294,8 @@ do_edit_ownertrust (PKT_public_key *pk, int mode,
|
|||||||
!un->pkt->pkt.user_id->attrib_data )
|
!un->pkt->pkt.user_id->attrib_data )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(opt.show_photos && un->pkt->pkt.user_id->attrib_data)
|
if((opt.verify_options&VERIFY_SHOW_PHOTOS)
|
||||||
|
&& un->pkt->pkt.user_id->attrib_data)
|
||||||
show_photos(un->pkt->pkt.user_id->attribs,
|
show_photos(un->pkt->pkt.user_id->attribs,
|
||||||
un->pkt->pkt.user_id->numattribs,pk,NULL);
|
un->pkt->pkt.user_id->numattribs,pk,NULL);
|
||||||
|
|
||||||
|
@ -123,8 +123,8 @@ mk_notation_and_policy( PKT_signature *sig,
|
|||||||
m_free(buf);
|
m_free(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(opt.show_notation)
|
if(opt.list_options&LIST_SHOW_NOTATION)
|
||||||
show_notation(sig,0);
|
show_notation(sig,0,0);
|
||||||
|
|
||||||
/* set policy URL */
|
/* set policy URL */
|
||||||
if( IS_SIG(sig) && opt.sig_policy_url )
|
if( IS_SIG(sig) && opt.sig_policy_url )
|
||||||
@ -161,8 +161,8 @@ mk_notation_and_policy( PKT_signature *sig,
|
|||||||
m_free(s);
|
m_free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(opt.show_policy_url)
|
if(opt.list_options&LIST_SHOW_POLICY)
|
||||||
show_policy_url(sig,0);
|
show_policy_url(sig,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user