[PATCH] warn about (but don't fail) on scdaemon options in gpg.conf

Daniel Kahn Gillmor dkg at fifthhorseman.net
Thu Sep 25 20:45:37 CEST 2014


* g10/gpg.c: add config options that should belong in scdaemon.conf
* g10/main.h, g10/misc.c (obsolete_scdaemon_option): new

--

In gpg2, the following options are only relevant for scdaemon:

 reader-port
 ctapi-driver
 pcsc-driver
 disable-ccid

but in gpg1, they are options for gpg itself.

Some users of gpg1 might have these options in their
~/.gnupg/gpg.conf, which causes gpg2 to fail hard if it reads that
config file.

gpg2 should not fail hard, though giving a warning (and suggesting a
move to scdaemon.conf) seems OK.

This patch does *not* reintroduce any documentation for these options
in gpg.texi, even to indicate that they are "dummy" options, since
scdaemon.texi contains the appropriate documentation.

Debian-bug-id: 762844
---
 g10/gpg.c  | 21 +++++++++++++++++++++
 g10/main.h |  2 ++
 g10/misc.c | 12 ++++++++++++
 3 files changed, 35 insertions(+)

diff --git a/g10/gpg.c b/g10/gpg.c
index a9d248d..334b7e0 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -366,6 +366,10 @@ enum cmd_and_opt_values
     oKeyidFormat,
     oExitOnStatusWriteError,
     oLimitCardInsertTries,
+    oReaderPort,
+    octapiDriver,
+    opcscDriver,
+    oDisableCCID,
     oRequireCrossCert,
     oNoRequireCrossCert,
     oAutoKeyLocate,
@@ -764,6 +768,11 @@ static ARGPARSE_OPTS opts[] = {
   ARGPARSE_s_n (oExitOnStatusWriteError, "exit-on-status-write-error", "@"),
   ARGPARSE_s_i (oLimitCardInsertTries, "limit-card-insert-tries", "@"),
 
+  ARGPARSE_s_s (oReaderPort, "reader-port", "@"),
+  ARGPARSE_s_s (octapiDriver, "ctapi-driver", "@"),
+  ARGPARSE_s_s (opcscDriver, "pcsc-driver", "@"),
+  ARGPARSE_s_n (oDisableCCID, "disable-ccid", "@"),
+
   ARGPARSE_s_n (oAllowMultisigVerification,
                 "allow-multisig-verification", "@"),
   ARGPARSE_s_n (oEnableDSA2, "enable-dsa2", "@"),
@@ -2350,6 +2359,18 @@ main (int argc, char **argv)
 	  case oGpgAgentInfo:
 	    obsolete_option (configname, configlineno, "--gpg-agent-info");
             break;
+          case oReaderPort:
+	    obsolete_scdaemon_option (configname, configlineno, "--reader-port");
+            break;
+          case octapiDriver:
+	    obsolete_scdaemon_option (configname, configlineno, "--ctapi-driver");
+            break;
+          case opcscDriver:
+	    obsolete_scdaemon_option (configname, configlineno, "--pcsc-driver");
+            break;
+          case oDisableCCID:
+	    obsolete_scdaemon_option (configname, configlineno, "--disable-ccid");
+            break;
 
 	  case oAnswerYes: opt.answer_yes = 1; break;
 	  case oAnswerNo: opt.answer_no = 1; break;
diff --git a/g10/main.h b/g10/main.h
index 44c4478..62b770f 100644
--- a/g10/main.h
+++ b/g10/main.h
@@ -136,6 +136,8 @@ void deprecated_warning(const char *configname,unsigned int configlineno,
 void deprecated_command (const char *name);
 void obsolete_option (const char *configname, unsigned int configlineno,
                       const char *name);
+void obsolete_scdaemon_option (const char *configname, unsigned int configlineno,
+                               const char *name);
 
 int string_to_cipher_algo (const char *string);
 int string_to_digest_algo (const char *string);
diff --git a/g10/misc.c b/g10/misc.c
index 54c2f89..825581a 100644
--- a/g10/misc.c
+++ b/g10/misc.c
@@ -1042,6 +1042,18 @@ obsolete_option (const char *configname, unsigned int configlineno,
               name);
 }
 
+void
+obsolete_scdaemon_option (const char *configname, unsigned int configlineno,
+                          const char *name)
+{
+  if(configname)
+    log_info (_("%s:%u: \"%s\" is obsolete in this file - it only has effect in scdaemon.conf\n"),
+              configname, configlineno, name);
+  else
+    log_info (_("WARNING: \"%s\" is an obsolete option - it has no effect except on scdaemon\n"),
+              name);
+}
+
 
 /*
  * Wrapper around gcry_cipher_map_name to provide a fallback using the
-- 
2.1.0




More information about the Gnupg-devel mailing list