From 32b11e4501b31267cf0e311bfb9eb55db4515e54 Mon Sep 17 00:00:00 2001 From: David Shaw Date: Thu, 4 Jul 2002 16:06:38 +0000 Subject: [PATCH] * photoid.c (get_default_photo_command, show_photos): Honor FIXED_PHOTO_VIEWER and DISABLE_PHOTO_VIEWER. * mainproc.c (check_sig_and_print): Use --show-photos to show photos when verifying a sig made by a key with a photo. * keyserver.c (parse_keyserver_uri): Properly parse a URI with no :port section and an empty file path, but with a terminating '/'. (keyserver_work): Honor DISABLE_KEYSERVER_HELPERS. * hkp.c (hkp_ask_import): Display keyserver URI as a URI, but only if verbose. * exec.c, g10.c: USE_EXEC_PATH -> FIXED_EXEC_PATH --- g10/ChangeLog | 17 +++++++++++++++++ g10/exec.c | 4 ++-- g10/g10.c | 2 +- g10/hkp.c | 6 ++++-- g10/keyserver.c | 7 ++++++- g10/mainproc.c | 8 ++++++++ g10/photoid.c | 8 ++++++++ 7 files changed, 46 insertions(+), 6 deletions(-) diff --git a/g10/ChangeLog b/g10/ChangeLog index 349779413..c4b24637f 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,20 @@ +2002-07-04 David Shaw + + * photoid.c (get_default_photo_command, show_photos): Honor + FIXED_PHOTO_VIEWER and DISABLE_PHOTO_VIEWER. + + * mainproc.c (check_sig_and_print): Use --show-photos to show + photos when verifying a sig made by a key with a photo. + + * keyserver.c (parse_keyserver_uri): Properly parse a URI with no + :port section and an empty file path, but with a terminating '/'. + (keyserver_work): Honor DISABLE_KEYSERVER_HELPERS. + + * hkp.c (hkp_ask_import): Display keyserver URI as a URI, but only + if verbose. + + * exec.c, g10.c: USE_EXEC_PATH -> FIXED_EXEC_PATH + 2002-07-03 David Shaw * exec.h, exec.c (set_exec_path, exec_write), g10.c (main): If diff --git a/g10/exec.c b/g10/exec.c index cfdf6d057..46990f29c 100644 --- a/g10/exec.c +++ b/g10/exec.c @@ -312,8 +312,8 @@ int exec_write(struct exec_info **info,const char *program, if(program==NULL && args_in==NULL) BUG(); -#ifdef USE_EXEC_PATH - set_exec_path(USE_EXEC_PATH); +#ifdef FIXED_EXEC_PATH + set_exec_path(FIXED_EXEC_PATH); #endif *info=m_alloc_clear(sizeof(struct exec_info)); diff --git a/g10/g10.c b/g10/g10.c index 707b54dc1..f2cef6fa0 100644 --- a/g10/g10.c +++ b/g10/g10.c @@ -1332,7 +1332,7 @@ main( int argc, char **argv ) break; case oTempDir: opt.temp_dir=pargs.r.ret_str; break; case oExecPath: -#ifndef USE_EXEC_PATH +#ifndef FIXED_EXEC_PATH if(set_exec_path(pargs.r.ret_str)) log_error(_("unable to set exec-path to %s\n"),pargs.r.ret_str); #endif diff --git a/g10/hkp.c b/g10/hkp.c index 7b96570cd..4cfb2bf10 100644 --- a/g10/hkp.c +++ b/g10/hkp.c @@ -67,8 +67,10 @@ hkp_ask_import( KEYDB_SEARCH_DESC *desc, void *stats_handle) else return -1; /* HKP does not support v3 fingerprints */ - log_info(_("requesting key %08lX from HKP keyserver %s\n"), - (ulong)key[1],opt.keyserver_host ); + if(opt.keyserver_options.verbose) + log_info(_("requesting key %08lX from %s\n"), + (ulong)key[1],opt.keyserver_uri); + request = m_alloc( strlen( opt.keyserver_host ) + 100 ); /* hkp does not accept the long keyid - we should really write a * nicer one :-) diff --git a/g10/keyserver.c b/g10/keyserver.c index df7ef48e9..377418bec 100644 --- a/g10/keyserver.c +++ b/g10/keyserver.c @@ -148,7 +148,7 @@ parse_keyserver_uri(char *uri,const char *configname,unsigned int configlineno) /* Get the host */ opt.keyserver_host=strsep(&uri,":/"); - if(uri==NULL) + if(uri==NULL || uri[0]=='\0') opt.keyserver_port="0"; else { @@ -638,6 +638,11 @@ keyserver_work(int action,STRLIST list,KEYDB_SEARCH_DESC *desc,int count) } #endif +#ifdef DISABLE_KEYSERVER_HELPERS + log_error(_("external keyserver calls are not supported in this build\n")); + return G10ERR_KEYSERVER; +#endif + /* It's not the internal HKP code, so try and spawn a handler for it */ rc=keyserver_spawn(action,list,desc,count,&ret); diff --git a/g10/mainproc.c b/g10/mainproc.c index d70003380..f5c1dfe9a 100644 --- a/g10/mainproc.c +++ b/g10/mainproc.c @@ -38,6 +38,7 @@ #include "i18n.h" #include "trustdb.h" #include "keyserver-internal.h" +#include "photoid.h" struct kidlist_item { @@ -1396,7 +1397,10 @@ check_sig_and_print( CTX c, KBNODE node ) /* If we have a good signature and already printed * the primary user ID, print all the other user IDs */ if ( count && !rc ) { + PKT_public_key *pk=NULL; for( un=keyblock; un; un = un->next ) { + if(un->pkt->pkttype==PKT_PUBLIC_KEY) + pk=un->pkt->pkt.public_key; if( un->pkt->pkttype != PKT_USER_ID ) continue; if ( un->pkt->pkt.user_id->is_revoked ) @@ -1408,6 +1412,10 @@ check_sig_and_print( CTX c, KBNODE node ) !un->pkt->pkt.user_id->attrib_data ) continue; + if(opt.show_photos && un->pkt->pkt.user_id->attrib_data) + show_photos(un->pkt->pkt.user_id->attribs, + un->pkt->pkt.user_id->numattribs,pk,NULL); + log_info( _(" aka \"")); print_utf8_string( log_stream(), un->pkt->pkt.user_id->name, un->pkt->pkt.user_id->len ); diff --git a/g10/photoid.c b/g10/photoid.c index 8a9101d36..091fe0c8b 100644 --- a/g10/photoid.c +++ b/g10/photoid.c @@ -218,6 +218,7 @@ char *image_type_to_string(byte type,int style) return string; } +#if !defined(FIXED_PHOTO_VIEWER) && !defined(DISABLE_PHOTO_VIEWER) static const char *get_default_photo_command(void) { #if defined(HAVE_DOSISH_SYSTEM) @@ -240,10 +241,12 @@ static const char *get_default_photo_command(void) return "xloadimage -fork -quiet -title 'KeyID 0x%k' stdin"; #endif } +#endif void show_photos(const struct user_attribute *attrs, int count,PKT_public_key *pk,PKT_secret_key *sk) { +#ifndef DISABLE_PHOTO_VIEWER int i; struct expando_args args; u32 len; @@ -266,8 +269,12 @@ void show_photos(const struct user_attribute *attrs, struct exec_info *spawn; int offset=attrs[i].len-len; +#ifdef FIXED_PHOTO_VIEWER + opt.photo_viewer=FIXED_PHOTO_VIEWER; +#else if(!opt.photo_viewer) opt.photo_viewer=get_default_photo_command(); +#endif /* make command grow */ command=pct_expando(opt.photo_viewer,&args); @@ -320,4 +327,5 @@ void show_photos(const struct user_attribute *attrs, fail: log_error("unable to display photo ID!\n"); +#endif }