aboutsummaryrefslogtreecommitdiffstats
path: root/g10/getkey.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2017-07-24 19:07:03 +0000
committerWerner Koch <[email protected]>2017-07-24 19:10:58 +0000
commit87b5421ca84bbea68217c9ed771ee8c0a98a4d0c (patch)
tree07df766cc85680c315c81f953079f2bd30139e65 /g10/getkey.c
parentgpg: Store key origin info for new keys from a keyserver (diff)
downloadgnupg-87b5421ca84bbea68217c9ed771ee8c0a98a4d0c.tar.gz
gnupg-87b5421ca84bbea68217c9ed771ee8c0a98a4d0c.zip
gpg: Extend --key-origin to take an optional URL arg.
* g10/getkey.c (parse_key_origin): Parse appended URL. * g10/options.h (struct opt): Add field 'key_origin_url'. * g10/gpg.c (main) <aImport>: Pass that option to import_keys. * g10/import.c (apply_meta_data): Extend for file and url. * g10/keyserver.c (keyserver_fetch): Pass the url to import_keys_es_stream. -- Example: gpg --key-origin url,myscheme://bla --import FILE Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'g10/getkey.c')
-rw-r--r--g10/getkey.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/g10/getkey.c b/g10/getkey.c
index 74eed132f..390e2dc48 100644
--- a/g10/getkey.c
+++ b/g10/getkey.c
@@ -4325,6 +4325,11 @@ int
parse_key_origin (char *string)
{
int i;
+ char *comma;
+
+ comma = strchr (string, ',');
+ if (comma)
+ *comma = 0;
if (!ascii_strcasecmp (string, "help"))
{
@@ -4338,9 +4343,19 @@ parse_key_origin (char *string)
if (!ascii_strcasecmp (string, key_origin_list[i].name))
{
opt.key_origin = key_origin_list[i].origin;
+ xfree (opt.key_origin_url);
+ opt.key_origin_url = NULL;
+ if (comma && comma[1])
+ {
+ opt.key_origin_url = xstrdup (comma+1);
+ trim_spaces (opt.key_origin_url);
+ }
+
return 1;
}
+ if (comma)
+ *comma = ',';
return 0;
}