* g10.c (main), keylist.c (show_policy_url, show_notation), mainproc.c

(check_sig_and_print): Emulate the old policy and notation behavior
(display by default).  Send to status-fd whether it is displayed on the
screen or not.

* g10.c (main): Since we now have some options in devel that won't work in
a stable branch gpg.conf file, try for a version-specific gpg.conf-VERSION
file before falling back to gpg.conf.

* main.h, options.h: Move various option flags to options.h.
This commit is contained in:
David Shaw 2003-06-01 15:36:13 +00:00
parent b17358948d
commit 27ec3d9201
5 changed files with 100 additions and 55 deletions

View File

@ -1,3 +1,16 @@
2003-06-01 David Shaw <dshaw@jabberwocky.com>
* g10.c (main), keylist.c (show_policy_url, show_notation),
mainproc.c (check_sig_and_print): Emulate the old policy and
notation behavior (display by default). Send to status-fd whether
it is displayed on the screen or not.
* g10.c (main): Since we now have some options in devel that won't
work in a stable branch gpg.conf file, try for a version-specific
gpg.conf-VERSION file before falling back to gpg.conf.
* main.h, options.h: Move various option flags to options.h.
2003-05-31 David Shaw <dshaw@jabberwocky.com>
* mainproc.c (check_sig_and_print), main.h, keylist.c

View File

@ -1175,6 +1175,7 @@ main( int argc, char **argv )
opt.keyserver_options.include_subkeys=1;
opt.keyserver_options.include_revoked=1;
opt.keyserver_options.try_dns_srv=1;
opt.verify_options=VERIFY_SHOW_POLICY|VERIFY_SHOW_NOTATION;
opt.trust_model=TM_AUTO;
opt.mangle_dos_filenames = 1;
@ -1257,7 +1258,15 @@ main( int argc, char **argv )
if( default_config )
{
configname = make_filename(opt.homedir, "gpg" EXTSEP_S "conf", NULL );
/* Try for a version specific config file first */
configname = make_filename(opt.homedir,
"gpg" EXTSEP_S "conf-" VERSION, NULL );
if(access(configname,R_OK))
{
m_free(configname);
configname = make_filename(opt.homedir,
"gpg" EXTSEP_S "conf", NULL );
}
if (!access (configname, R_OK))
{ /* Print a warning when both config files are present. */
char *p = make_filename(opt.homedir, "options", NULL );

View File

@ -114,6 +114,11 @@ print_pubkey_info (PKT_public_key *pk)
tty_printf ("\n\n");
}
/*
mode=0 for stdout.
mode=1 for log_info + status messages
mode=2 for status messages only
*/
void
show_policy_url(PKT_signature *sig,int indent,int mode)
@ -125,27 +130,38 @@ show_policy_url(PKT_signature *sig,int indent,int mode)
while((p=enum_sig_subpkt(sig->hashed,SIGSUBPKT_POLICY,&len,&seq,&crit)))
{
int i;
char *str;
if(mode!=2)
{
int i;
char *str;
for(i=0;i<indent;i++)
putchar(' ');
for(i=0;i<indent;i++)
putchar(' ');
/* This isn't UTF8 as it is a URL(?) */
if(crit)
str=_("Critical signature policy: ");
else
str=_("Signature policy: ");
if(mode)
log_info("%s",str);
else
printf("%s",str);
print_string(fp,p,len,0);
fprintf(fp,"\n");
}
/* This isn't UTF8 as it is a URL(?) */
if(crit)
str=_("Critical signature policy: ");
else
str=_("Signature policy: ");
if(mode)
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 );
write_status_buffer ( STATUS_POLICY_URL, p, len, 0 );
}
}
/*
mode=0 for stdout.
mode=1 for log_info + status messages
mode=2 for status messages only
*/
void
show_notation(PKT_signature *sig,int indent,int mode)
{
@ -159,8 +175,7 @@ show_notation(PKT_signature *sig,int indent,int mode)
while((p=enum_sig_subpkt(sig->hashed,SIGSUBPKT_NOTATION,&len,&seq,&crit)))
if(len>=8)
{
int n1,n2,i;
char *str;
int n1,n2;
n1=(p[4]<<8)|p[5];
n2=(p[6]<<8)|p[7];
@ -171,27 +186,33 @@ show_notation(PKT_signature *sig,int indent,int mode)
return;
}
for(i=0;i<indent;i++)
putchar(' ');
if(mode!=2)
{
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)
{

View File

@ -170,11 +170,6 @@ KBNODE make_comment_node( const char *s );
KBNODE make_mpi_comment_node( const char *s, MPI a );
/*-- import.c --*/
#define IMPORT_ALLOW_LOCAL_SIGS 1
#define IMPORT_REPAIR_PKS_SUBKEY_BUG 2
#define IMPORT_FAST_IMPORT 4
#define IMPORT_SK2PK 8
int parse_import_options(char *str,unsigned int *options);
void import_keys( char **fnames, int nnames,
void *stats_hd, unsigned int options );
@ -187,11 +182,6 @@ void import_print_stats (void *hd);
int collapse_uids( KBNODE *keyblock );
/*-- export.c --*/
#define EXPORT_INCLUDE_NON_RFC 1
#define EXPORT_INCLUDE_LOCAL_SIGS 2
#define EXPORT_INCLUDE_ATTRIBUTES 4
#define EXPORT_INCLUDE_SENSITIVE_REVKEYS 8
int parse_export_options(char *str,unsigned int *options);
int export_pubkeys( STRLIST users, unsigned int options );
int export_pubkeys_stream( IOBUF out, STRLIST users,
@ -213,11 +203,6 @@ struct revocation_reason_info *
void release_revocation_reason_info( struct revocation_reason_info *reason );
/*-- 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 secret_key_list( STRLIST list );
void reorder_keyblock (KBNODE keyblock);
@ -232,10 +217,6 @@ void print_seckey_info (PKT_secret_key *sk);
void print_pubkey_info (PKT_public_key *pk);
/*-- 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 );
int verify_signatures( int nfiles, char **files );
int verify_files( int nfiles, char **files );

View File

@ -215,4 +215,25 @@ struct {
#define PGP7 (opt.compliance==CO_PGP7)
#define PGP8 (opt.compliance==CO_PGP8)
/* Various option flags */
#define IMPORT_ALLOW_LOCAL_SIGS 1
#define IMPORT_REPAIR_PKS_SUBKEY_BUG 2
#define IMPORT_FAST_IMPORT 4
#define IMPORT_SK2PK 8
#define EXPORT_INCLUDE_NON_RFC 1
#define EXPORT_INCLUDE_LOCAL_SIGS 2
#define EXPORT_INCLUDE_ATTRIBUTES 4
#define EXPORT_INCLUDE_SENSITIVE_REVKEYS 8
#define LIST_SHOW_PHOTOS 1
#define LIST_SHOW_POLICY 2
#define LIST_SHOW_NOTATION 4
#define LIST_SHOW_KEYRING 8
#define VERIFY_SHOW_PHOTOS 1
#define VERIFY_SHOW_POLICY 2
#define VERIFY_SHOW_NOTATION 4
#endif /*G10_OPTIONS_H*/