]> granicus.if.org Git - neomutt/commitdiff
move sensitive flag to type
authorRichard Russon <rich@flatcap.org>
Sat, 8 Jun 2019 22:16:51 +0000 (23:16 +0100)
committerRichard Russon <rich@flatcap.org>
Wed, 12 Jun 2019 23:23:35 +0000 (00:23 +0100)
Rename F_SENSITIVE to DT_SENSITIVE.
Move it from a general flags field, to the type field (with the other
type modifying flags).

config/dump.c
config/types.h
init.h
test/config/dump.c

index f3f7356436bed253b12549dfa4aa86e0782e67e3..2f53814c02f0a9c48c7e32391ff7a9d1f8d5d463 100644 (file)
@@ -276,8 +276,8 @@ bool dump_config(struct ConfigSet *cs, enum CsDumpStyle style,
         }
 
         const struct ConfigDef *cdef = he->data;
-        if (IS_SENSITIVE(*cdef) && (flags & CS_DUMP_HIDE_SENSITIVE) &&
-            !mutt_buffer_is_empty(value))
+        if ((type == DT_STRING) && IS_SENSITIVE(*cdef) &&
+            (flags & CS_DUMP_HIDE_SENSITIVE) && !mutt_buffer_is_empty(value))
         {
           mutt_buffer_reset(value);
           mutt_buffer_addstr(value, "***");
index c46a5ef1f909160f304772478570342ad6fe8450..de0fa87f5b61a5c0d6280605cfd5d3c6155e796f 100644 (file)
@@ -48,6 +48,9 @@
 #define DT_NOT_EMPTY     (1 << 6)  ///< Empty strings are not allowed
 #define DT_NOT_NEGATIVE  (1 << 7)  ///< Negative numbers are not allowed
 #define DT_MAILBOX       (1 << 8)  ///< DT_PATH: Don't perform path expansions
+#define DT_SENSITIVE     (1 << 9)  ///< Contains sensitive value, e.g. password
+
+#define IS_SENSITIVE(x) (((x).type & DT_SENSITIVE) == DT_SENSITIVE)
 
 /* subtypes for... */
 #define DT_SUBTYPE_MASK  0x0FE0  ///< Mask for the Data Subtype
@@ -64,9 +67,6 @@ typedef uint16_t ConfigRedrawFlags; ///< Flags for redraw/resort, e.g. #R_INDEX
 #define R_REFLOW       (1 << 7)     ///< Reflow window layout and full redraw
 #define R_SIDEBAR      (1 << 8)     ///< Redraw the sidebar
 #define R_MENU         (1 << 9)     ///< Redraw all menus
-#define F_SENSITIVE    (1 << 10)    ///< Config item contains sensitive value (will be OR'd with R_ flags above)
-
-#define IS_SENSITIVE(x) (((x).flags & F_SENSITIVE) == F_SENSITIVE)
 
 /* Private config item flags */
 #define DT_INHERITED    (1 << 28)  ///< Config item is inherited
diff --git a/init.h b/init.h
index 6b5e3b91b6b1074647aff8ba7a52c647e96a5928..c843326f158db5fdb697e2c948e4c4d3c1da6833 100644 (file)
--- a/init.h
+++ b/init.h
@@ -1638,14 +1638,14 @@ struct ConfigDef MuttVars[] = {
   ** only subscribed folders or all folders.  This can be toggled in the
   ** IMAP browser with the \fC<toggle-subscribed>\fP function.
   */
-  { "imap_login",       DT_STRING,  R_NONE|F_SENSITIVE, &C_ImapLogin, 0 },
+  { "imap_login",       DT_STRING|DT_SENSITIVE,  R_NONE, &C_ImapLogin, 0 },
   /*
   ** .pp
   ** Your login name on the IMAP server.
   ** .pp
   ** This variable defaults to the value of $$imap_user.
   */
-  { "imap_oauth_refresh_command", DT_STRING, R_NONE|F_SENSITIVE, &C_ImapOauthRefreshCommand, 0 },
+  { "imap_oauth_refresh_command", DT_STRING|DT_SENSITIVE, R_NONE, &C_ImapOauthRefreshCommand, 0 },
   /*
   ** .pp
   ** The command to run to generate an OAUTH refresh token for
@@ -1653,7 +1653,7 @@ struct ConfigDef MuttVars[] = {
   ** run on every connection attempt that uses the OAUTHBEARER authentication
   ** mechanism.  See "$oauth" for details.
   */
-  { "imap_pass",        DT_STRING,  R_NONE|F_SENSITIVE, &C_ImapPass, 0 },
+  { "imap_pass",        DT_STRING|DT_SENSITIVE,  R_NONE, &C_ImapPass, 0 },
   /*
   ** .pp
   ** Specifies the password for your IMAP account.  If \fIunset\fP, NeoMutt will
@@ -1729,7 +1729,7 @@ struct ConfigDef MuttVars[] = {
   ** server which are out of the users' hands, you may wish to suppress
   ** them at some point.
   */
-  { "imap_user",        DT_STRING,  R_NONE|F_SENSITIVE, &C_ImapUser, 0 },
+  { "imap_user",        DT_STRING|DT_SENSITIVE,  R_NONE, &C_ImapUser, 0 },
   /*
   ** .pp
   ** The name of the user whose mail you intend to access on the IMAP
@@ -2426,7 +2426,7 @@ struct ConfigDef MuttVars[] = {
   ** must be loaded when newsgroup is added to list (first time list
   ** loading or new newsgroup adding).
   */
-  { "nntp_pass",        DT_STRING, R_NONE|F_SENSITIVE, &C_NntpPass, 0 },
+  { "nntp_pass",        DT_STRING|DT_SENSITIVE, R_NONE, &C_NntpPass, 0 },
   /*
   ** .pp
   ** Your password for NNTP account.
@@ -2439,7 +2439,7 @@ struct ConfigDef MuttVars[] = {
   ** recheck newsgroup on each operation in index (stepping, read article,
   ** etc.).
   */
-  { "nntp_user",        DT_STRING, R_NONE|F_SENSITIVE, &C_NntpUser, 0 },
+  { "nntp_user",        DT_STRING|DT_SENSITIVE, R_NONE, &C_NntpUser, 0 },
   /*
   ** .pp
   ** Your login name on the NNTP server.  If \fIunset\fP and NNTP server requires
@@ -3007,7 +3007,7 @@ struct ConfigDef MuttVars[] = {
   ** for retrieving only unread messages from the POP server when using
   ** the \fC$<fetch-mail>\fP function.
   */
-  { "pop_oauth_refresh_command", DT_STRING, R_NONE|F_SENSITIVE, &C_PopOauthRefreshCommand, 0 },
+  { "pop_oauth_refresh_command", DT_STRING|DT_SENSITIVE, R_NONE, &C_PopOauthRefreshCommand, 0 },
   /*
   ** .pp
   ** The command to run to generate an OAUTH refresh token for
@@ -3015,7 +3015,7 @@ struct ConfigDef MuttVars[] = {
   ** run on every connection attempt that uses the OAUTHBEARER authentication
   ** mechanism.  See "$oauth" for details.
   */
-  { "pop_pass",         DT_STRING,  R_NONE|F_SENSITIVE, &C_PopPass, 0 },
+  { "pop_pass",         DT_STRING|DT_SENSITIVE,  R_NONE, &C_PopPass, 0 },
   /*
   ** .pp
   ** Specifies the password for your POP account.  If \fIunset\fP, NeoMutt will
@@ -3031,7 +3031,7 @@ struct ConfigDef MuttVars[] = {
   ** Controls whether or not NeoMutt will try to reconnect to the POP server if
   ** the connection is lost.
   */
-  { "pop_user",         DT_STRING,  R_NONE|F_SENSITIVE, &C_PopUser, 0 },
+  { "pop_user",         DT_STRING|DT_SENSITIVE,  R_NONE, &C_PopUser, 0 },
   /*
   ** .pp
   ** Your login name on the POP server.
@@ -4072,7 +4072,7 @@ struct ConfigDef MuttVars[] = {
   ** set smtp_authenticators="digest-md5:cram-md5"
   ** .te
   */
-  { "smtp_oauth_refresh_command", DT_STRING, R_NONE|F_SENSITIVE, &C_SmtpOauthRefreshCommand, 0 },
+  { "smtp_oauth_refresh_command", DT_STRING|DT_SENSITIVE, R_NONE, &C_SmtpOauthRefreshCommand, 0 },
   /*
   ** .pp
   ** The command to run to generate an OAUTH refresh token for
@@ -4080,7 +4080,7 @@ struct ConfigDef MuttVars[] = {
   ** run on every connection attempt that uses the OAUTHBEARER authentication
   ** mechanism.  See "$oauth" for details.
   */
-  { "smtp_pass",        DT_STRING,  R_NONE|F_SENSITIVE, &C_SmtpPass, 0 },
+  { "smtp_pass",        DT_STRING|DT_SENSITIVE,  R_NONE, &C_SmtpPass, 0 },
   /*
   ** .pp
   ** Specifies the password for your SMTP account.  If \fIunset\fP, NeoMutt will
@@ -4091,7 +4091,7 @@ struct ConfigDef MuttVars[] = {
   ** fairly secure machine, because the superuser can read your neomuttrc even
   ** if you are the only one who can read the file.
   */
-  { "smtp_url",         DT_STRING, R_NONE|F_SENSITIVE, &C_SmtpUrl, 0 },
+  { "smtp_url",         DT_STRING|DT_SENSITIVE, R_NONE, &C_SmtpUrl, 0 },
   /*
   ** .pp
   ** Defines the SMTP smarthost where sent messages should relayed for
index c297211add492cab948e2527dc17bc95810d96f5..cece27ea96241e803cd75e39b472eb4c27428971 100644 (file)
@@ -57,7 +57,7 @@ static struct ConfigDef Vars[] = {
   { "Kumquat",    DT_QUAD,                 0, &VarKumquat,    0,                           NULL },
   { "Lemon",      DT_REGEX,                0, &VarLemon,      0,                           NULL },
   { "Mango",      DT_SORT,                 0, &VarMango,      1,                           NULL },
-  { "Nectarine",  DT_STRING,     F_SENSITIVE, &VarNectarine,  IP "nectarine",              NULL },
+  { "Nectarine",  DT_STRING|DT_SENSITIVE,  0, &VarNectarine,  IP "nectarine",              NULL },
   { NULL },
 };
 // clang-format on