diff options
author | David Shaw <[email protected]> | 2004-05-08 13:51:14 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2004-05-08 13:51:14 +0000 |
commit | 614304a54379fc040ded52296015402451166440 (patch) | |
tree | 1a762a1fdb9f7c925bb3fbdbda20d08cd0cc3b15 /g10/keyserver.c | |
parent | (write_plaintext_packet): Fixed the detection of too (diff) | |
download | gnupg-614304a54379fc040ded52296015402451166440.tar.gz gnupg-614304a54379fc040ded52296015402451166440.zip |
* keyedit.c (keyedit_menu, menu_set_keyserver_url): Allow passing
preferred keyserver on "keyserver" command line. Sanity check keyserver
URL before accepting it.
* keyserver-internal.h, g10.c (main), keyserver.c (parse_keyserver_uri):
Add an option to require the scheme:// and change all callers.
(free_keyserver_spec): Make public.
Diffstat (limited to 'g10/keyserver.c')
-rw-r--r-- | g10/keyserver.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/g10/keyserver.c b/g10/keyserver.c index 8b71a6340..7cf7824e8 100644 --- a/g10/keyserver.c +++ b/g10/keyserver.c @@ -135,7 +135,7 @@ parse_keyserver_options(char *options) return ret; } -static void +void free_keyserver_spec(struct keyserver_spec *keyserver) { m_free(keyserver->uri); @@ -146,7 +146,8 @@ free_keyserver_spec(struct keyserver_spec *keyserver) } struct keyserver_spec * -parse_keyserver_uri(char *uri,const char *configname,unsigned int configlineno) +parse_keyserver_uri(char *uri,int require_scheme, + const char *configname,unsigned int configlineno) { int assume_hkp=0; struct keyserver_spec *keyserver; @@ -163,6 +164,9 @@ parse_keyserver_uri(char *uri,const char *configname,unsigned int configlineno) scheme=strsep(&uri,":"); if(uri==NULL) { + if(require_scheme) + return NULL; + /* Assume HKP if there is no scheme */ assume_hkp=1; uri=scheme; @@ -1361,9 +1365,11 @@ keyidlist(STRLIST users,KEYDB_SEARCH_DESC **klist,int *count,int fakev3) dupe[plen]='\0'; /* Make up a keyserver structure and do an - import for this key. */ + import for this key. Note that a preferred + keyserver without a scheme:// will be + interpreted as hkp:// */ - keyserver=parse_keyserver_uri(dupe,NULL,0); + keyserver=parse_keyserver_uri(dupe,0,NULL,0); m_free(dupe); if(keyserver) |