<<< Date Index >>>     <<< Thread Index >>>

Re: Security issue / bad UI design in mutt CVS (encryption options)



On 2004-08-07 20:33:02 +0200, Thomas Glanzmann wrote:

> * Thomas Roessler <roessler@xxxxxxxxxxxxxxxxxx> [040807 11:28]:

>> What do you guys think -- should the "encrypt" option disable
>> signing, and should "sign" disable encryption, with "both"
>> being the only way to get both security functions?  ~~~~~~

> I think excatly the way I quoted above together from your initial
> post.

Here's a proposed patch that I'd consider reasonable:

* This makes the S/MIME and PGP menus consistent.
* "sign" and "encrypt" now mean "sign only" and "encrypt only."
* "forget it" is now called "clear", and has (c) as a new shortcut.
  (f) continues to be accepted, but isn't documented in the menu.
* Bailing out of the prompt of "sign as" does not clear a
  previously-set "sign" flag.
* The PGP menu says "(i)nline" or "PGP/M(i)ME", depending on context.

Comments before I commit this?
-- 
Thomas Roessler · Personal soap box at <http://log.does-not-exist.org/>.
Index: pgp.c
===================================================================
RCS file: /cvs/mutt/mutt/pgp.c,v
retrieving revision 3.30
diff -u -r3.30 pgp.c
--- pgp.c       19 Jul 2004 21:41:43 -0000      3.30
+++ pgp.c       8 Aug 2004 11:01:52 -0000
@@ -1459,18 +1459,25 @@
   pgp_key_t p;
   char input_signas[SHORT_STRING];
 
+  char prompt[LONG_STRING];
+  
   if (!(WithCrypto & APPLICATION_PGP))
     return msg->security;
-
-  switch (mutt_multi_choice (_("PGP (e)ncrypt, (s)ign, sign (a)s, (b)oth, 
(i)nline, or (f)orget it? "),
-                            _("esabif")))
+  
+  snprintf (prompt, sizeof (prompt), 
+           _("PGP (e)ncrypt, (s)ign, sign (a)s, (b)oth, %s, or (c)lear? "),
+           (msg->security & INLINE) ? _("PGP/M(i)ME") : _("(i)nline"));
+  
+  switch (mutt_multi_choice (prompt, _("esabifc")))
   {
   case 1: /* (e)ncrypt */
-    msg->security ^= ENCRYPT;
+    msg->security |= ENCRYPT;
+    msg->security &= ~SIGN;
     break;
 
   case 2: /* (s)ign */
-    msg->security ^= SIGN;
+    msg->security |= SIGN;
+    msg->security &= ~ENCRYPT;
     break;
 
   case 3: /* sign (a)s */
@@ -1487,19 +1494,18 @@
        
       crypt_pgp_void_passphrase ();  /* probably need a different passphrase */
     }
+#if 0
     else
     {
       msg->security &= ~SIGN;
     }
+#endif
 
     *redraw = REDRAW_FULL;
     break;
 
   case 4: /* (b)oth */
-    if ((msg->security & (ENCRYPT | SIGN)) == (ENCRYPT | SIGN))
-      msg->security = 0;
-    else
-      msg->security |= (ENCRYPT | SIGN);
+    msg->security |= (ENCRYPT | SIGN);
     break;
 
   case 5: /* (i)nline */
@@ -1510,6 +1516,7 @@
     break;
 
   case 6: /* (f)orget it */
+  case 7: /* (c)lear     */
     msg->security = 0;
     break;
   }
Index: smime.c
===================================================================
RCS file: /cvs/mutt/mutt/smime.c,v
retrieving revision 3.33
diff -u -r3.33 smime.c
--- smime.c     17 Jun 2004 20:39:20 -0000      3.33
+++ smime.c     8 Aug 2004 11:01:53 -0000
@@ -1940,11 +1940,12 @@
   if (!(WithCrypto & APPLICATION_SMIME))
     return msg->security;
 
-  switch (mutt_multi_choice (_("S/MIME (e)ncrypt, (s)ign, encrypt (w)ith, sign 
(a)s, (b)oth, or (f)orget it? "),
-                            _("eswabf")))
+  switch (mutt_multi_choice (_("S/MIME (e)ncrypt, (s)ign, encrypt (w)ith, sign 
(a)s, (b)oth, or (c)lear? "),
+                            _("eswabfc")))
   {
   case 1: /* (e)ncrypt */
-    msg->security ^= ENCRYPT;
+    msg->security |= ENCRYPT;
+    msg->security &= ~SIGN;
     break;
 
   case 3: /* encrypt (w)ith */
@@ -1975,14 +1976,18 @@
   case 2: /* (s)ign */
       
     if(!SmimeDefaultKey)
-       mutt_message("Can\'t sign: No key specified. use sign(as).");
+       mutt_message("Can\'t sign: No key specified. Use Sign As.");
     else
-       msg->security ^= SIGN;
+    {
+      msg->security |= SIGN;
+      msg->security &= ~ENCRYPT;
+    }
     break;
 
   case 4: /* sign (a)s */
 
-    if ((p = smime_ask_for_key (_("Sign as: "), NULL, 0))) {
+    if ((p = smime_ask_for_key (_("Sign as: "), NULL, 0))) 
+    {
       p[mutt_strlen (p)-1] = '\0';
       mutt_str_replace (&SmimeDefaultKey, p);
        
@@ -1991,8 +1996,10 @@
       /* probably need a different passphrase */
       crypt_smime_void_passphrase ();
     }
+#if 0
     else
       msg->security &= ~SIGN;
+#endif
 
     *redraw = REDRAW_FULL;
     break;
@@ -2002,6 +2009,7 @@
     break;
 
   case 6: /* (f)orget it */
+  case 7: /* (c)lear */
     msg->security = 0;
     break;
   }

Attachment: pgpGAiRe8EOdA.pgp
Description: PGP signature