aboutsummaryrefslogtreecommitdiffstats
path: root/g10/keyserver.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2015-10-05 15:52:28 +0000
committerWerner Koch <[email protected]>2015-10-05 15:52:28 +0000
commitae471fa978589fb61ecb0f89bbfe4d43cf2d5eac (patch)
tree3113249c540466a59232f8299ca77461f5ce5c7e /g10/keyserver.c
parentdirmngr: Add option --keyserver. (diff)
downloadgnupg-ae471fa978589fb61ecb0f89bbfe4d43cf2d5eac.tar.gz
gnupg-ae471fa978589fb61ecb0f89bbfe4d43cf2d5eac.zip
gpg: Deprecate the --keyserver option.
* g10/keyserver.c (keyserver_refresh): Change return type to gpg_error_t. Use gpg_dirmngr_ks_list to print the name of the keyserver to use. (keyserver_search): Do not print the "no keyserver" error message. The same error is anyway returned from dirmngr. * g10/call-dirmngr.c (ks_status_parm_s): Add field "keyword". (ks_status_cb): Handle other status keywords. (gpg_dirmngr_ks_list): New. * tools/gpgconf-comp.c (gc_options_gpg): Deprecate "keyserver". (gc_options_dirmngr): Add "Keyserver" group and "keyserver". -- Along with the corresponding dirmngr change this option allows to configure the keyserver only in dirmngr.conf. Existing configurations will continue to work. However, GUIs using gpgconf now the keyserver option under the dirmngr (aka Key Acquirer) tab unless they are in export mode in which the keyserver option is also show for gpg. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to '')
-rw-r--r--g10/keyserver.c50
1 files changed, 26 insertions, 24 deletions
diff --git a/g10/keyserver.c b/g10/keyserver.c
index 40ba49a61..e20c16b08 100644
--- a/g10/keyserver.c
+++ b/g10/keyserver.c
@@ -1357,10 +1357,12 @@ keyidlist(strlist_t users,KEYDB_SEARCH_DESC **klist,int *count,int fakev3)
/* Note this is different than the original HKP refresh. It allows
usernames to refresh only part of the keyring. */
-int
+gpg_error_t
keyserver_refresh (ctrl_t ctrl, strlist_t users)
{
- int rc,count,numdesc,fakev3=0;
+ gpg_error_t err;
+ int count, numdesc;
+ int fakev3 = 0;
KEYDB_SEARCH_DESC *desc;
unsigned int options=opt.keyserver_options.import_options;
@@ -1381,9 +1383,9 @@ keyserver_refresh (ctrl_t ctrl, strlist_t users)
ascii_strcasecmp(opt.keyserver->scheme,"mailto")==0))
fakev3=1;
- rc=keyidlist(users,&desc,&numdesc,fakev3);
- if(rc)
- return rc;
+ err = keyidlist (users, &desc, &numdesc, fakev3);
+ if (err)
+ return err;
count=numdesc;
if(count>0)
@@ -1403,11 +1405,11 @@ keyserver_refresh (ctrl_t ctrl, strlist_t users)
/* We use the keyserver structure we parsed out before.
Note that a preferred keyserver without a scheme://
will be interpreted as hkp:// */
- rc = keyserver_get (ctrl, &desc[i], 1, keyserver, NULL, NULL);
- if(rc)
+ err = keyserver_get (ctrl, &desc[i], 1, keyserver, NULL, NULL);
+ if (err)
log_info(_("WARNING: unable to refresh key %s"
" via %s: %s\n"),keystr_from_desc(&desc[i]),
- keyserver->uri,gpg_strerror (rc));
+ keyserver->uri,gpg_strerror (err));
else
{
/* We got it, so mark it as NONE so we don't try and
@@ -1424,16 +1426,22 @@ keyserver_refresh (ctrl_t ctrl, strlist_t users)
if(count>0)
{
- if(opt.keyserver && !opt.quiet)
- {
- if(count==1)
- log_info(_("refreshing 1 key from %s\n"),opt.keyserver->uri);
- else
- log_info(_("refreshing %d keys from %s\n"),
- count,opt.keyserver->uri);
- }
+ char *tmpuri;
- rc=keyserver_get (ctrl, desc, numdesc, NULL, NULL, NULL);
+ err = gpg_dirmngr_ks_list (ctrl, &tmpuri);
+ if (!err)
+ {
+ if (!opt.quiet)
+ {
+ if(count==1)
+ log_info(_("refreshing 1 key from %s\n"), tmpuri);
+ else
+ log_info(_("refreshing %d keys from %s\n"), count, tmpuri);
+ }
+ xfree (tmpuri);
+
+ err = keyserver_get (ctrl, desc, numdesc, NULL, NULL, NULL);
+ }
}
xfree(desc);
@@ -1445,7 +1453,7 @@ keyserver_refresh (ctrl_t ctrl, strlist_t users)
if(!(opt.keyserver_options.import_options&IMPORT_FAST))
check_or_update_trustdb ();
- return rc;
+ return err;
}
@@ -1463,12 +1471,6 @@ keyserver_search (ctrl_t ctrl, strlist_t tokens)
if (!tokens)
return 0; /* Return success if no patterns are given. */
- if (!opt.keyserver)
- {
- log_error (_("no keyserver known (use option --keyserver)\n"));
- return gpg_error (GPG_ERR_NO_KEYSERVER);
- }
-
/* Write global options */
/* for(temp=opt.keyserver_options.other;temp;temp=temp->next) */