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

Re: mutt/2114: S/MIME algorithm choice too long



The following reply was made to PR mutt/2114; it has been noted by GNATS.

From: TAKAHASHI Tamotsu <ttakah@xxxxxxxxxxxxxxxxx>
To: bug-any@xxxxxxxxxxxxx, Mutt Developers <mutt-dev@xxxxxxxx>
Cc: 
Subject: Re: mutt/2114: S/MIME algorithm choice too long
Date: Mon, 17 Oct 2005 18:06:24 +0900

 --DWg365Y4B18r8evw
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 * Mon Oct 17 2005 Thomas Roessler <roessler@xxxxxxxxxxxxxxxxxx>
 > On 2005-10-17 06:15:04 +0200, TAKAHASHI Tamotsu wrote:
 > >  But I, as a user, prefer yours.
 > 
 > So do I.
 
 Thanks for the comment.
 If you are too busy to implement it, see the attached patch.
 
 -- 
 tamo
 
 --DWg365Y4B18r8evw
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="patch-1.5.11cvs.tamo.too_long_alg.2"
 
 diff -r abc296776f28 smime.c
 --- a/smime.c  Sun Oct 16 10:36:09 2005
 +++ b/smime.c  Mon Oct 17 17:48:28 2005
 @@ -1950,37 +1950,71 @@
      break;
  
    case 3: /* encrypt (w)ith */
 -    msg->security |= ENCRYPT;
 -    switch (mutt_multi_choice (_("1: DES, 2: Triple-DES, 3: RC2-40,"
 -                               " 4: RC2-64, 5: RC2-128, 6: AES128,"
 -                               " 7: AES192, 8: AES256, or (f)orget it? "),
 -                             _("12345678f"))) {
 -    case 1:
 -      mutt_str_replace (&SmimeCryptAlg, "des");
 -      break;
 -    case 2:
 -      mutt_str_replace (&SmimeCryptAlg, "des3");
 -      break;
 -    case 3:
 -      mutt_str_replace (&SmimeCryptAlg, "rc2-40");
 -      break;
 -    case 4:
 -      mutt_str_replace (&SmimeCryptAlg, "rc2-64");
 -      break;
 -    case 5:
 -      mutt_str_replace (&SmimeCryptAlg, "rc2-128");
 -      break;
 -    case 6:
 -        mutt_str_replace (&SmimeCryptAlg, "aes128");
 -        break;
 -    case 7:
 -        mutt_str_replace (&SmimeCryptAlg, "aes192");
 -        break;
 -    case 8:
 -        mutt_str_replace (&SmimeCryptAlg, "aes256");
 -        break;
 -    case 9: /* forget it */
 -        break;
 +    {
 +      int choice = 0;
 +
 +      msg->security |= ENCRYPT;
 +      do
 +      {
 +        /* I use "dra" because "123" is recognized anyway */
 +        switch (mutt_multi_choice (_("Choose algorithm family:"
 +                                     " 1: DES, 2: RC2, 3: AES,"
 +                                     " or (c)lear? "),
 +                                   _("drac")))
 +        {
 +        case 1:
 +          switch (choice = mutt_multi_choice (_("1: DES, 2: Triple-DES "),
 +                                              _("dt")))
 +          {
 +          case 1:
 +            mutt_str_replace (&SmimeCryptAlg, "des");
 +            break;
 +          case 2:
 +            mutt_str_replace (&SmimeCryptAlg, "des3");
 +            break;
 +          }
 +          break;
 +
 +        case 2:
 +          switch (choice = mutt_multi_choice (_("1: RC2-40, 2: RC2-64, 3: 
RC2-128 "),
 +                                              _("468")))
 +          {
 +          case 1:
 +            mutt_str_replace (&SmimeCryptAlg, "rc2-40");
 +            break;
 +          case 2:
 +            mutt_str_replace (&SmimeCryptAlg, "rc2-64");
 +            break;
 +          case 3:
 +            mutt_str_replace (&SmimeCryptAlg, "rc2-128");
 +            break;
 +          }
 +          break;
 +
 +        case 3:
 +          switch (choice = mutt_multi_choice (_("1: AES128, 2: AES192, 3: 
AES256 "),
 +                                              _("895")))
 +          {
 +          case 1:
 +            mutt_str_replace (&SmimeCryptAlg, "aes128");
 +            break;
 +          case 2:
 +            mutt_str_replace (&SmimeCryptAlg, "aes192");
 +            break;
 +          case 3:
 +            mutt_str_replace (&SmimeCryptAlg, "aes256");
 +            break;
 +          }
 +          break;
 +
 +        case 4: /* (c)lear */
 +          FREE (&SmimeCryptAlg);
 +          /* fallback */
 +        case -1: /* Ctrl-G or Enter */
 +          choice = 0;
 +          break;
 +        }
 +      } while (choice == -1);
      }
      break;
  
 
 --DWg365Y4B18r8evw--