[Pkg-gnupg-commit] [gnupg2] 27/34: gpg: Add option '--disable-dirmngr'.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Fri Aug 11 16:51:24 UTC 2017


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch upstream
in repository gnupg2.

commit c4506f624ed6854aa0ba1629aa2d1d43eb26900d
Author: Justus Winter <justus at g10code.com>
Date:   Tue Aug 8 11:43:22 2017 +0200

    gpg: Add option '--disable-dirmngr'.
    
    * doc/gpg.texi: Document new option.
    * g10/call-dirmngr.c (create_context): Fail if option is given.
    * g10/gpg.c (cmd_and_opt_values): New value.
    (opts): New option.
    (gpgconf_list): Add new option.
    (main): Handle new option.
    * g10/options.h (struct opt): New field 'disable_dirmngr'.
    * tools/gpgconf-comp.c (gc_options_gpg): New option.
    
    GnuPG-bug-id: 3334
    Signed-off-by: Justus Winter <justus at g10code.com>
---
 doc/gpg.texi         | 3 +++
 g10/call-dirmngr.c   | 4 ++++
 g10/gpg.c            | 4 ++++
 g10/options.h        | 1 +
 tools/gpgconf-comp.c | 3 +++
 5 files changed, 15 insertions(+)

diff --git a/doc/gpg.texi b/doc/gpg.texi
index ba7f5a5..c71126a 100644
--- a/doc/gpg.texi
+++ b/doc/gpg.texi
@@ -1976,6 +1976,9 @@ file name.
 Specify a dirmngr program to be used for keyserver access.  The
 default value is @file{@value{BINDIR}/dirmngr}.
 
+ at item --disable-dirmngr
+Entirely disable the use of the Dirmngr.
+
 @item --no-autostart
 @opindex no-autostart
 Do not start the gpg-agent or the dirmngr if it has not yet been
diff --git a/g10/call-dirmngr.c b/g10/call-dirmngr.c
index 362731e..9bc90fb 100644
--- a/g10/call-dirmngr.c
+++ b/g10/call-dirmngr.c
@@ -184,6 +184,10 @@ create_context (ctrl_t ctrl, assuan_context_t *r_ctx)
   assuan_context_t ctx;
 
   *r_ctx = NULL;
+
+  if (opt.disable_dirmngr)
+    return gpg_error (GPG_ERR_NO_DIRMNGR);
+
   err = start_new_dirmngr (&ctx,
                            GPG_ERR_SOURCE_DEFAULT,
                            opt.dirmngr_program,
diff --git a/g10/gpg.c b/g10/gpg.c
index 4658a9f..c721cdc 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -374,6 +374,7 @@ enum cmd_and_opt_values
     oPersonalCompressPreferences,
     oAgentProgram,
     oDirmngrProgram,
+    oDisableDirmngr,
     oDisplay,
     oTTYname,
     oTTYtype,
@@ -837,6 +838,7 @@ static ARGPARSE_OPTS opts[] = {
 
   ARGPARSE_s_s (oAgentProgram, "agent-program", "@"),
   ARGPARSE_s_s (oDirmngrProgram, "dirmngr-program", "@"),
+  ARGPARSE_s_n (oDisableDirmngr, "disable-dirmngr", "@"),
   ARGPARSE_s_s (oDisplay,    "display",    "@"),
   ARGPARSE_s_s (oTTYname,    "ttyname",    "@"),
   ARGPARSE_s_s (oTTYtype,    "ttytype",    "@"),
@@ -1857,6 +1859,7 @@ gpgconf_list (const char *configfile)
   es_printf ("compliance:%lu:\"%s:\n", GC_OPT_FLAG_DEFAULT, "gnupg");
   es_printf ("default-new-key-algo:%lu:\n", GC_OPT_FLAG_NONE);
   es_printf ("trust-model:%lu:\n", GC_OPT_FLAG_NONE);
+  es_printf ("disable-dirmngr:%lu:\n", GC_OPT_FLAG_NONE);
 
   /* The next one is an info only item and should match the macros at
      the top of keygen.c  */
@@ -3388,6 +3391,7 @@ main (int argc, char **argv)
 	    break;
           case oAgentProgram: opt.agent_program = pargs.r.ret_str;  break;
           case oDirmngrProgram: opt.dirmngr_program = pargs.r.ret_str; break;
+	  case oDisableDirmngr: opt.disable_dirmngr = 1;  break;
           case oWeakDigest:
 	    additional_weak_digest(pargs.r.ret_str);
 	    break;
diff --git a/g10/options.h b/g10/options.h
index 8431f75..130bec8 100644
--- a/g10/options.h
+++ b/g10/options.h
@@ -121,6 +121,7 @@ struct
   int max_cert_depth;
   const char *agent_program;
   const char *dirmngr_program;
+  int disable_dirmngr;
 
   const char *def_new_key_algo;
 
diff --git a/tools/gpgconf-comp.c b/tools/gpgconf-comp.c
index 59a6398..b066dad 100644
--- a/tools/gpgconf-comp.c
+++ b/tools/gpgconf-comp.c
@@ -759,6 +759,9 @@ static gc_option_t gc_options_gpg[] =
      NULL, NULL, GC_ARG_TYPE_NONE, GC_BACKEND_GPG },
    { "no-auto-key-retrieve", GC_OPT_FLAG_NONE, GC_LEVEL_ADVANCED,
      NULL, NULL, GC_ARG_TYPE_NONE, GC_BACKEND_GPG },
+   { "disable-dirmngr", GC_OPT_FLAG_NONE, GC_LEVEL_EXPERT,
+     "gnupg", N_("disable all access to the dirmngr"),
+     GC_ARG_TYPE_NONE, GC_BACKEND_GPG },
 
 
    GC_OPTION_NULL

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list