NeoMutt  2021-02-05-666-ge300cd
Teaching an old dog new tricks
DOXYGEN
config.c
Go to the documentation of this file.
1 
29 #include "config.h"
30 #include <stddef.h>
31 #include <config/lib.h>
32 #include <stdbool.h>
33 #include "mutt/lib.h"
34 
38 const struct Mapping SortKeyMethods[] = {
39  // clang-format off
40  { "address", SORT_ADDRESS },
41  { "date", SORT_DATE },
42  { "keyid", SORT_KEYID },
43  { "trust", SORT_TRUST },
44  { NULL, 0 },
45  // clang-format on
46 };
47 
48 static struct ConfigDef NcryptVars[] = {
49  // clang-format off
50  { "crypt_confirm_hook", DT_BOOL, true, 0, NULL,
51  "Prompt the user to confirm keys before use"
52  },
53  { "crypt_opportunistic_encrypt", DT_BOOL, false, 0, NULL,
54  "Enable encryption when the recipient's key is available"
55  },
56  { "crypt_opportunistic_encrypt_strong_keys", DT_BOOL, false, 0, NULL,
57  "Enable encryption only when strong a key is available"
58  },
59  { "crypt_protected_headers_read", DT_BOOL, true, 0, NULL,
60  "Display protected headers (Memory Hole) in the pager"
61  },
62  { "crypt_protected_headers_subject", DT_STRING, IP "...", 0, NULL,
63  "Use this as the subject for encrypted emails"
64  },
65  { "crypt_protected_headers_write", DT_BOOL, false, 0, NULL,
66  "Generate protected header (Memory Hole) for signed and encrypted emails"
67  },
68  { "crypt_timestamp", DT_BOOL, true, 0, NULL,
69  "Add a timestamp to PGP or SMIME output to prevent spoofing"
70  },
71 #ifdef CRYPT_BACKEND_GPGME
72  { "crypt_use_gpgme", DT_BOOL, true, 0, NULL,
73  "Use GPGME crypto backend"
74  },
75  { "crypt_use_pka", DT_BOOL, false, 0, NULL,
76  "Use GPGME to use PKA (lookup PGP keys using DNS)"
77  },
78 #endif
79  { "envelope_from_address", DT_ADDRESS, 0, 0, NULL,
80  "Manually set the sender for outgoing messages"
81  },
82  { "pgp_auto_inline", DT_BOOL, false, 0, NULL,
83  "Use old-style inline PGP messages (not recommended)"
84  },
85 #ifdef CRYPT_BACKEND_CLASSIC_PGP
86  { "pgp_check_exit", DT_BOOL, true, 0, NULL,
87  "Check the exit code of PGP subprocess"
88  },
89  { "pgp_check_gpg_decrypt_status_fd", DT_BOOL, true, 0, NULL,
90  "File descriptor used for status info"
91  },
92  { "pgp_clear_sign_command", DT_STRING|DT_COMMAND, 0, 0, NULL,
93  "(pgp) External command to inline-sign a message"
94  },
95  { "pgp_decode_command", DT_STRING|DT_COMMAND, 0, 0, NULL,
96  "(pgp) External command to decode a PGP attachment"
97  },
98  { "pgp_decrypt_command", DT_STRING|DT_COMMAND, 0, 0, NULL,
99  "(pgp) External command to decrypt a PGP message"
100  },
101  { "pgp_decryption_okay", DT_REGEX, 0, 0, NULL,
102  "Text indicating a successful decryption"
103  },
104 #endif
105  { "pgp_default_key", DT_STRING, 0, 0, NULL,
106  "Default key to use for PGP operations"
107  },
108 #ifdef CRYPT_BACKEND_CLASSIC_PGP
109  { "pgp_encrypt_only_command", DT_STRING|DT_COMMAND, 0, 0, NULL,
110  "(pgp) External command to encrypt, but not sign a message"
111  },
112  { "pgp_encrypt_sign_command", DT_STRING|DT_COMMAND, 0, 0, NULL,
113  "(pgp) External command to encrypt and sign a message"
114  },
115 #endif
116  { "pgp_entry_format", DT_STRING|DT_NOT_EMPTY, IP "%4n %t%f %4l/0x%k %-4a %2c %u", 0, NULL,
117  "printf-like format string for the PGP key selection menu"
118  },
119 #ifdef CRYPT_BACKEND_CLASSIC_PGP
120  { "pgp_export_command", DT_STRING|DT_COMMAND, 0, 0, NULL,
121  "(pgp) External command to export a public key from the user's keyring"
122  },
123  { "pgp_get_keys_command", DT_STRING|DT_COMMAND, 0, 0, NULL,
124  "(pgp) External command to download a key for an email address"
125  },
126  { "pgp_good_sign", DT_REGEX, 0, 0, NULL,
127  "Text indicating a good signature"
128  },
129 #endif
130  { "pgp_ignore_subkeys", DT_BOOL, true, 0, NULL,
131  "Only use the principal PGP key"
132  },
133 #ifdef CRYPT_BACKEND_CLASSIC_PGP
134  { "pgp_import_command", DT_STRING|DT_COMMAND, 0, 0, NULL,
135  "(pgp) External command to import a key into the user's keyring"
136  },
137  { "pgp_list_pubring_command", DT_STRING|DT_COMMAND, 0, 0, NULL,
138  "(pgp) External command to list the public keys in a user's keyring"
139  },
140  { "pgp_list_secring_command", DT_STRING|DT_COMMAND, 0, 0, NULL,
141  "(pgp) External command to list the private keys in a user's keyring"
142  },
143 #endif
144  { "pgp_long_ids", DT_BOOL, true, 0, NULL,
145  "Display long PGP key IDs to the user"
146  },
147  { "pgp_mime_auto", DT_QUAD, MUTT_ASKYES, 0, NULL,
148  "Prompt the user to use MIME if inline PGP fails"
149  },
150  { "pgp_retainable_sigs", DT_BOOL, false, 0, NULL,
151  "Create nested multipart/signed or encrypted messages"
152  },
153  { "pgp_self_encrypt", DT_BOOL, true, 0, NULL,
154  "Encrypted messages will also be encrypted to $pgp_default_key too"
155  },
156  { "pgp_show_unusable", DT_BOOL, true, 0, NULL,
157  "Show non-usable keys in the key selection"
158  },
159  { "pgp_sign_as", DT_STRING, 0, 0, NULL,
160  "Use this alternative key for signing messages"
161  },
162 #ifdef CRYPT_BACKEND_CLASSIC_PGP
163  { "pgp_sign_command", DT_STRING|DT_COMMAND, 0, 0, NULL,
164  "(pgp) External command to create a detached PGP signature"
165  },
166 #endif
167  { "pgp_sort_keys", DT_SORT|DT_SORT_REVERSE, SORT_ADDRESS, IP SortKeyMethods, NULL,
168  "Sort order for PGP keys"
169  },
170  { "pgp_strict_enc", DT_BOOL, true, 0, NULL,
171  "Encode PGP signed messages with quoted-printable (don't unset)"
172  },
173 #ifdef CRYPT_BACKEND_CLASSIC_PGP
174  { "pgp_timeout", DT_LONG|DT_NOT_NEGATIVE, 300, 0, NULL,
175  "Time in seconds to cache a passphrase"
176  },
177  { "pgp_use_gpg_agent", DT_BOOL, true, 0, NULL,
178  "Use a PGP agent for caching passwords"
179  },
180  { "pgp_verify_command", DT_STRING|DT_COMMAND, 0, 0, NULL,
181  "(pgp) External command to verify PGP signatures"
182  },
183  { "pgp_verify_key_command", DT_STRING|DT_COMMAND, 0, 0, NULL,
184  "(pgp) External command to verify key information"
185  },
186 #endif
187 #ifdef CRYPT_BACKEND_CLASSIC_SMIME
188  { "smime_ask_cert_label", DT_BOOL, true, 0, NULL,
189  "Prompt the user for a label for SMIME certificates"
190  },
191  { "smime_ca_location", DT_PATH|DT_PATH_FILE, 0, 0, NULL,
192  "File containing trusted certificates"
193  },
194  { "smime_certificates", DT_PATH|DT_PATH_DIR, 0, 0, NULL,
195  "File containing user's public certificates"
196  },
197  { "smime_decrypt_command", DT_STRING|DT_COMMAND, 0, 0, NULL,
198  "(smime) External command to decrypt an SMIME message"
199  },
200  { "smime_decrypt_use_default_key", DT_BOOL, true, 0, NULL,
201  "Use the default key for decryption"
202  },
203 #endif
204  { "smime_default_key", DT_STRING, 0, 0, NULL,
205  "Default key for SMIME operations"
206  },
207 #ifdef CRYPT_BACKEND_CLASSIC_SMIME
208  { "smime_encrypt_command", DT_STRING|DT_COMMAND, 0, 0, NULL,
209  "(smime) External command to encrypt a message"
210  },
211 #endif
212  { "smime_encrypt_with", DT_STRING, IP "aes256", 0, NULL,
213  "Algorithm for encryption"
214  },
215 #ifdef CRYPT_BACKEND_CLASSIC_SMIME
216  { "smime_get_cert_command", DT_STRING|DT_COMMAND, 0, 0, NULL,
217  "(smime) External command to extract a certificate from a message"
218  },
219  { "smime_get_cert_email_command", DT_STRING|DT_COMMAND, 0, 0, NULL,
220  "(smime) External command to get a certificate for an email"
221  },
222  { "smime_get_signer_cert_command", DT_STRING|DT_COMMAND, 0, 0, NULL,
223  "(smime) External command to extract a certificate from an email"
224  },
225  { "smime_import_cert_command", DT_STRING|DT_COMMAND, 0, 0, NULL,
226  "(smime) External command to import a certificate"
227  },
228 #endif
229 #ifdef CRYPT_BACKEND_CLASSIC_SMIME
230  { "smime_keys", DT_PATH|DT_PATH_DIR, 0, 0, NULL,
231  "File containing user's private certificates"
232  },
233  { "smime_pk7out_command", DT_STRING|DT_COMMAND, 0, 0, NULL,
234  "(smime) External command to extract a public certificate"
235  },
236 #endif
237  { "smime_self_encrypt", DT_BOOL, true, 0, NULL,
238  "Encrypted messages will also be encrypt to $smime_default_key too"
239  },
240  { "smime_sign_as", DT_STRING, 0, 0, NULL,
241  "Use this alternative key for signing messages"
242  },
243 #ifdef CRYPT_BACKEND_CLASSIC_SMIME
244  { "smime_sign_command", DT_STRING|DT_COMMAND, 0, 0, NULL,
245  "(smime) External command to sign a message"
246  },
247  { "smime_sign_digest_alg", DT_STRING, IP "sha256", 0, NULL,
248  "Digest algorithm"
249  },
250  { "smime_timeout", DT_NUMBER|DT_NOT_NEGATIVE, 300, 0, NULL,
251  "Time in seconds to cache a passphrase"
252  },
253  { "smime_verify_command", DT_STRING|DT_COMMAND, 0, 0, NULL,
254  "(smime) External command to verify a signed message"
255  },
256  { "smime_verify_opaque_command", DT_STRING|DT_COMMAND, 0, 0, NULL,
257  "(smime) External command to verify a signature"
258  },
259 #endif
260  { "smime_is_default", DT_BOOL, false, 0, NULL,
261  "Use SMIME rather than PGP by default"
262  },
263  { "pgp_auto_decode", DT_BOOL, false, 0, NULL,
264  "Automatically decrypt PGP messages"
265  },
266  { "crypt_verify_sig", DT_QUAD, MUTT_YES, 0, NULL,
267  "Verify PGP or SMIME signatures"
268  },
269  { "crypt_protected_headers_save", DT_BOOL, false, 0, NULL,
270  "Save the cleartext Subject with the headers"
271  },
272 
273  { "crypt_confirmhook", DT_SYNONYM, IP "crypt_confirm_hook", },
274  { "pgp_autoinline", DT_SYNONYM, IP "pgp_auto_inline", },
275 #ifdef CRYPT_BACKEND_CLASSIC_PGP
276  { "pgp_clearsign_command", DT_SYNONYM, IP "pgp_clear_sign_command", },
277 #endif
278  { "pgp_create_traditional", DT_SYNONYM, IP "pgp_auto_inline", },
279 #ifdef CRYPT_BACKEND_CLASSIC_PGP
280  { "pgp_getkeys_command", DT_SYNONYM, IP "pgp_get_keys_command", },
281 #endif
282  { "pgp_self_encrypt_as", DT_SYNONYM, IP "pgp_default_key", },
283  { "pgp_verify_sig", DT_SYNONYM, IP "crypt_verify_sig", },
284  { "smime_self_encrypt_as", DT_SYNONYM, IP "smime_default_key", },
285 
286  { "pgp_encrypt_self", DT_DEPRECATED|DT_QUAD, MUTT_NO },
287  { "smime_encrypt_self", DT_DEPRECATED|DT_QUAD, MUTT_NO },
288 
289  { NULL },
290  // clang-format on
291 };
292 
297 {
298  return cs_register_variables(cs, NcryptVars, 0);
299 }
Container for lots of config items.
Definition: set.h:259
#define IP
Definition: set.h:54
bool config_init_ncrypt(struct ConfigSet *cs)
Register ncrypt config variables - Implements module_init_config_t -.
Definition: config.c:296
#define DT_LONG
a number (long)
Definition: types.h:33
#define DT_NOT_EMPTY
Empty strings are not allowed.
Definition: types.h:46
#define DT_REGEX
regular expressions
Definition: types.h:38
#define DT_SORT
sorting methods
Definition: types.h:40
Sort by email address.
Definition: sort2.h:54
#define DT_NOT_NEGATIVE
Negative numbers are not allowed.
Definition: types.h:47
#define DT_SORT_REVERSE
Sort flag for -reverse prefix.
Definition: sort2.h:36
Definition: set.h:63
#define DT_QUAD
quad-option (no/yes/ask-no/ask-yes)
Definition: types.h:37
Convenience wrapper for the config headers.
#define DT_PATH_DIR
Path is a directory.
Definition: types.h:53
bool cs_register_variables(const struct ConfigSet *cs, struct ConfigDef vars[], uint32_t flags)
Register a set of config items.
Definition: set.c:276
#define DT_PATH_FILE
Path is a file.
Definition: types.h:54
#define DT_ADDRESS
e-mail address
Definition: types.h:29
#define DT_STRING
a string
Definition: types.h:41
Sort by encryption key&#39;s trust level.
Definition: sort2.h:56
#define DT_PATH
a path to a file/directory
Definition: types.h:36
#define DT_DEPRECATED
Config item shouldn&#39;t be used any more.
Definition: types.h:77
#define DT_COMMAND
A command.
Definition: types.h:50
Ask the user, defaulting to &#39;Yes&#39;.
Definition: quad.h:41
#define DT_SYNONYM
synonym for another variable
Definition: types.h:42
Mapping between user-readable string and a constant.
Definition: mapping.h:31
User answered &#39;No&#39;, or assume &#39;No&#39;.
Definition: quad.h:38
Sort by the encryption key&#39;s ID.
Definition: sort2.h:55
const struct Mapping SortKeyMethods[]
Sort methods for encryption keys.
Definition: config.c:38
Sort by the date the email was sent.
Definition: sort2.h:43
Convenience wrapper for the library headers.
#define DT_NUMBER
a number
Definition: types.h:35
#define DT_BOOL
boolean option
Definition: types.h:30
User answered &#39;Yes&#39;, or assume &#39;Yes&#39;.
Definition: quad.h:39