mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
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 <wk@gnupg.org>
This commit is contained in:
parent
a48e6de603
commit
ae471fa978
6 changed files with 82 additions and 31 deletions
|
@ -44,6 +44,7 @@
|
|||
/* Parameter structure used to gather status info. */
|
||||
struct ks_status_parm_s
|
||||
{
|
||||
const char *keyword; /* Look for this keyword or NULL for "SOURCE". */
|
||||
char *source;
|
||||
};
|
||||
|
||||
|
@ -334,7 +335,7 @@ clear_context_flags (ctrl_t ctrl, assuan_context_t ctx)
|
|||
|
||||
|
||||
|
||||
/* Status callback for ks_get and ks_search. */
|
||||
/* Status callback for ks_list, ks_get and ks_search. */
|
||||
static gpg_error_t
|
||||
ks_status_cb (void *opaque, const char *line)
|
||||
{
|
||||
|
@ -342,7 +343,7 @@ ks_status_cb (void *opaque, const char *line)
|
|||
gpg_error_t err = 0;
|
||||
const char *s;
|
||||
|
||||
if ((s = has_leading_keyword (line, "SOURCE")))
|
||||
if ((s = has_leading_keyword (line, parm->keyword? parm->keyword : "SOURCE")))
|
||||
{
|
||||
if (!parm->source)
|
||||
{
|
||||
|
@ -356,6 +357,44 @@ ks_status_cb (void *opaque, const char *line)
|
|||
}
|
||||
|
||||
|
||||
|
||||
/* Run the "KEYSERVER" command to return the name of the used
|
||||
keyserver at R_KEYSERVER. */
|
||||
gpg_error_t
|
||||
gpg_dirmngr_ks_list (ctrl_t ctrl, char **r_keyserver)
|
||||
{
|
||||
gpg_error_t err;
|
||||
assuan_context_t ctx;
|
||||
struct ks_status_parm_s stparm;
|
||||
|
||||
memset (&stparm, 0, sizeof stparm);
|
||||
stparm.keyword = "KEYSERVER";
|
||||
*r_keyserver = NULL;
|
||||
|
||||
err = open_context (ctrl, &ctx);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = assuan_transact (ctx, "KEYSERVER", NULL, NULL,
|
||||
NULL, NULL, ks_status_cb, &stparm);
|
||||
if (err)
|
||||
goto leave;
|
||||
if (!stparm.source)
|
||||
{
|
||||
err = gpg_error (GPG_ERR_NO_KEYSERVER);
|
||||
goto leave;
|
||||
}
|
||||
|
||||
*r_keyserver = stparm.source;
|
||||
stparm.source = NULL;
|
||||
|
||||
leave:
|
||||
xfree (stparm.source);
|
||||
close_context (ctrl, ctx);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Data callback for the KS_SEARCH command. */
|
||||
static gpg_error_t
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue