Package: gnupg2 / 2.0.26-6+deb8u2

0005-gpg-Warn-about-but-don-t-fail-on-scdaemon-options-in.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
From c76117f8b0165fe5cec5e7f234f55f5a4cd7f0ab Mon Sep 17 00:00:00 2001
From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Date: Thu, 25 Sep 2014 14:45:37 -0400
Subject: [PATCH 05/31] gpg: Warn about (but don't fail) on scdaemon options in
 gpg.conf.

* 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

Program names factored out from obsolete_scdaemon_option to make
reuse without new translations easier. -wk

This is a backport of commit 371c2b14b0347209efd23b4e54e1981a12d7aeab
with parts of 20c6da50d4f6264d26d113d7de606971f719a0ca but without those
which would change existing translated strings. -wk
---
 g10/gpg.c  | 36 ++++++++++++++++++++++++++++++++----
 g10/main.h |  2 ++
 g10/misc.c | 14 ++++++++++++++
 3 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/g10/gpg.c b/g10/gpg.c
index 1a8e6e7..12d4295 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -358,6 +358,10 @@ enum cmd_and_opt_values
     oKeyidFormat,
     oExitOnStatusWriteError,
     oLimitCardInsertTries,
+    oReaderPort,
+    octapiDriver,
+    opcscDriver,
+    oDisableCCID,
     oRequireCrossCert,
     oNoRequireCrossCert,
     oAutoKeyLocate,
@@ -506,10 +510,6 @@ static ARGPARSE_OPTS opts[] = {
   ARGPARSE_s_n (oDryRun, "dry-run", N_("do not make any changes")),
   ARGPARSE_s_n (oInteractive, "interactive", N_("prompt before overwriting")),
 
-  ARGPARSE_s_n (oUseAgent,      "use-agent", "@"),
-  ARGPARSE_s_n (oNoUseAgent, "no-use-agent", "@"),
-  ARGPARSE_s_s (oGpgAgentInfo, "gpg-agent-info", "@"),
-
   ARGPARSE_s_n (oBatch, "batch", "@"),
   ARGPARSE_s_n (oAnswerYes, "yes", "@"),
   ARGPARSE_s_n (oAnswerNo, "no", "@"),
@@ -761,6 +761,21 @@ static ARGPARSE_OPTS opts[] = {
   ARGPARSE_s_s (oAutoKeyLocate, "auto-key-locate", "@"),
   ARGPARSE_s_n (oNoAutoKeyLocate, "no-auto-key-locate", "@"),
 
+  /* Dummy options with warnings.  */
+  ARGPARSE_s_n (oUseAgent,      "use-agent", "@"),
+  ARGPARSE_s_n (oNoUseAgent, "no-use-agent", "@"),
+  ARGPARSE_s_s (oGpgAgentInfo, "gpg-agent-info", "@"),
+  ARGPARSE_s_s (oReaderPort, "reader-port", "@"),
+  ARGPARSE_s_s (octapiDriver, "ctapi-driver", "@"),
+  ARGPARSE_s_s (opcscDriver, "pcsc-driver", "@"),
+  ARGPARSE_s_n (oDisableCCID, "disable-ccid", "@"),
+
+  /* Dummy options.  */
+  ARGPARSE_s_n (oNoop, "sk-comments", "@"),
+  ARGPARSE_s_n (oNoop, "no-sk-comments", "@"),
+  ARGPARSE_s_n (oNoop, "compress-keys", "@"),
+  ARGPARSE_s_n (oNoop, "compress-sigs", "@"),
+
   ARGPARSE_end ()
 };
 
@@ -2239,6 +2254,19 @@ main (int argc, char **argv)
 	    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;
 	  case oKeyring: append_to_strlist( &nrings, pargs.r.ret_str); break;
diff --git a/g10/main.h b/g10/main.h
index 9904820..226898d 100644
--- a/g10/main.h
+++ b/g10/main.h
@@ -118,6 +118,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 43ea0d2..ef03776 100644
--- a/g10/misc.c
+++ b/g10/misc.c
@@ -851,6 +851,20 @@ obsolete_option (const char *configname, unsigned int configlineno,
 }
 
 
+void
+obsolete_scdaemon_option (const char *configname, unsigned int configlineno,
+                          const char *name)
+{
+  if (configname)
+    log_info (_("%s:%u: \"%s%s\" is obsolete in this file"
+                " - it only has effect in %s\n"),
+              configname, configlineno, name, "--", "scdaemon.conf");
+  else
+    log_info (_("WARNING: \"%s%s\" is an obsolete option"
+                " - it has no effect except on %s\n"), "--", name, "scdaemon");
+}
+
+
 /*
  * Wrapper around gcry_cipher_map_name to provide a fallback using the
  * "Sn" syntax as used by the preference strings.
-- 
2.1.4