]> git.pld-linux.org Git - packages/mutt.git/commitdiff
- updated from http://www.woolridge.ca/mutt/patches/patch-1.5.6.dw.crypt-hook-both.1
authorJakub Bogusz <qboosh@pld-linux.org>
Sun, 3 Jun 2007 12:12:56 +0000 (12:12 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    mutt-pgp_hook.patch -> 1.5

mutt-pgp_hook.patch

index 7fd47b92f681434c8aabcf439a88858f3f755b90..c63c26cf377c521a2a72cffc72a5c0b3622c5c17 100644 (file)
@@ -1,62 +1,24 @@
-diff -rU3 --new-file mutt-1.3.99-vanilla/PATCHES mutt-1.3.99/PATCHES
---- mutt-1.3.99-vanilla/PATCHES        Thu May 23 14:12:14 2002
-+++ mutt-1.3.99/PATCHES        Thu May 23 14:13:33 2002
-@@ -1,3 +1,4 @@
-+patch-1.3.28.dw.pgp-hook.3
- vvv.quote
- patch-1.3.27.cd.signatures_menu.2.1
- patch-1.3.25.cd.purge_command.2
-diff -rU3 --new-file mutt-1.3.99-vanilla/doc/manual.sgml.head mutt-1.3.99/doc/manual.sgml.head
---- mutt-1.3.99-vanilla/doc/manual.sgml.head   Thu May 23 14:12:14 2002
-+++ mutt-1.3.99/doc/manual.sgml.head   Thu May 23 14:13:33 2002
-@@ -1389,7 +1389,9 @@
- or because, for some reasons, you need to override the key Mutt would
- normally use.  The pgp-hook command provides a method by which you can
- specify the ID of the public key to be used when encrypting messages to
--a certain recipient.
-+a certain recipient.  You may use multiple pgp-hook's with the same
-+pattern; multiple matching pgp-hook's result in the use of multiple
-+keyids for recipient.
- <sect1>Adding key sequences to the keyboard buffer<label id="push">
- <p>
-diff -rU3 --new-file mutt-1.3.99-vanilla/doc/muttrc.man.head mutt-1.3.99/doc/muttrc.man.head
---- mutt-1.3.99-vanilla/doc/muttrc.man.head    Thu May 23 14:12:13 2002
-+++ mutt-1.3.99/doc/muttrc.man.head    Thu May 23 14:15:38 2002
-@@ -257,7 +257,9 @@
- \fBpgp-hook\fP \fIpattern\fP \fIkey-id\fP
- The pgp-hook command provides a method by which you can
- specify the ID of the public key to be used when encrypting messages
--to a certain recipient.
-+to a certain recipient.  You may use multiple \fBpgp-hook\fPs with the
-+same \fIpattern\fP; multiple matching \fBpgp-hook\fPs result in the use
-+of multiple \fIkey-id\fPs for recipient.
- .PP
- .nf
- \fBopen-hook\fP \fIregexp\fP "\fIcommand\fP"
-diff -rU3 --new-file mutt-1.3.99-vanilla/hook.c mutt-1.3.99/hook.c
---- mutt-1.3.99-vanilla/hook.c Thu May 23 14:12:13 2002
-+++ mutt-1.3.99/hook.c Thu May 23 14:13:33 2002
-@@ -129,7 +129,11 @@
-       ptr->rx.not == not &&
-       !mutt_strcmp (pattern.data, ptr->rx.pattern))
+--- crypt-hook-both/PATCHES Dec 2002 17:44:54 -0000    3.6
++++ crypt-hook-both/PATCHES Feb 2004 13:19:43 -0000
+@@ -0,0 +1,2 @@
++patch-1.5.6.dw.confirm-crypt-hook.1
++patch-1.5.6.dw.multiple-crypt-hook.2
+--- crypt-hook-both/hook.c Jan 2004 09:52:55 -0000     3.8
++++ crypt-hook-both/hook.c Feb 2004 13:19:43 -0000
+@@ -119,3 +119,7 @@ int mutt_parse_hook (BUFFER *buf, BUFFER
      {
-+#ifdef M_PGPHOOK
-+      if (data & (M_FOLDERHOOK | M_SENDHOOK | M_MESSAGEHOOK | M_ACCOUNTHOOK | M_PGPHOOK))
++#ifdef M_CRYPTHOOK
++      if (data & (M_FOLDERHOOK | M_SENDHOOK | M_MESSAGEHOOK | M_ACCOUNTHOOK | M_REPLYHOOK | M_CRYPTHOOK))
 +#else
-       if (data & (M_FOLDERHOOK | M_SENDHOOK | M_MESSAGEHOOK | M_ACCOUNTHOOK))
-+#endif /* M_PGPHOOK */
+       if (data & (M_FOLDERHOOK | M_SENDHOOK | M_MESSAGEHOOK | M_ACCOUNTHOOK | M_REPLYHOOK))
++#endif
        {
-       /* these hooks allow multiple commands with the same
-        * pattern, so if we've already seen this pattern/command pair, just
-@@ -456,9 +460,25 @@
- }
+@@ -445,5 +449,21 @@ char *mutt_iconv_hook (const char *chs)
  
- #ifdef HAVE_PGP
--char *mutt_pgp_hook (ADDRESS *adr)
-+LIST *mutt_pgp_hook (ADDRESS *adr)
+-char *mutt_crypt_hook (ADDRESS *adr)
++LIST *mutt_crypt_hook (ADDRESS *adr)
  {
--  return _mutt_string_hook (adr->mailbox, M_PGPHOOK);
+-  return _mutt_string_hook (adr->mailbox, M_CRYPTHOOK);
 +  HOOK *hook;
 +  LIST *key_list = NULL;
 +
@@ -67,7 +29,7 @@ diff -rU3 --new-file mutt-1.3.99-vanilla/hook.c mutt-1.3.99/hook.c
 +  {
 +    if (!hook->command)
 +      continue;
-+    if (!(hook->type & M_PGPHOOK))
++    if (!(hook->type & M_CRYPTHOOK))
 +      continue;
 +
 +    if ((regexec (hook->rx.rx, adr->mailbox, 0, NULL, 0) == 0) ^ hook->rx.not)
@@ -75,84 +37,43 @@ diff -rU3 --new-file mutt-1.3.99-vanilla/hook.c mutt-1.3.99/hook.c
 +  }
 +  return (key_list);
  }
- #endif /* HAVE_PGP */
-diff -rU3 --new-file mutt-1.3.99-vanilla/init.h mutt-1.3.99/init.h
---- mutt-1.3.99-vanilla/init.h Thu May 23 14:12:14 2002
-+++ mutt-1.3.99/init.h Thu May 23 14:13:33 2002
-@@ -1183,6 +1183,14 @@
- #ifdef HAVE_PGP
-+  { "pgp_autoselectkey",      DT_BOOL, R_NONE, OPTPGPAUTOSELECT, 0 },
-+  /*
-+  ** .pp
-+  ** If set, then a list of keys is not presented for selection when only
-+  ** one matching key is available.  This may be useful in conjunction with
-+  ** the \fIpgp-hook\fP command (with ``$$pgp_confirmhook'' set) and the
-+  ** ``$$pgp_ignore_subkeys'' variable.
-+  */
-   { "pgp_autosign",   DT_BOOL, R_NONE, OPTPGPAUTOSIGN, 0 },
-   /*
-   ** .pp
-@@ -1200,6 +1208,14 @@
-   ** \fIpgp-menu\fP, when encryption is not required or signing is
-   ** requested as well.
+--- crypt-hook-both/init.h Feb 2004 17:10:43 -0000     3.43
++++ crypt-hook-both/init.h Feb 2004 13:19:43 -0000
+@@ -1230,2 +1230,11 @@ struct option_t MuttVars[] = {
    */
-+  { "pgp_confirmhook",        DT_BOOL, R_NONE, OPTPGPCONFIRMHOOK, 1 },
++  { "pgp_confirmhook",                DT_SYN, R_NONE, UL "crypt_confirmhook", 1 },
++  { "crypt_confirmhook",      DT_BOOL, R_NONE, OPTCRYPTCONFIRMHOOK, 1 },
 +  /*
 +  ** .pp
 +  ** If set, then you will be prompted for confirmation of keys when using
-+  ** the \fIpgp-hook\fP command.  If unset, no such confirmation prompt will
++  ** the \fIcrypt-hook\fP command.  If unset, no such confirmation prompt will
 +  ** be presented.  This is generally considered unsafe, especially where
 +  ** typos are concerned.
 +  */
    { "pgp_ignore_subkeys", DT_BOOL, R_NONE, OPTPGPIGNORESUB, 1},
-   /*
-   ** .pp
-diff -rU3 --new-file mutt-1.3.99-vanilla/mutt-1.3.28/PATCHES mutt-1.3.99/mutt-1.3.28/PATCHES
---- mutt-1.3.99-vanilla/mutt-1.3.28/PATCHES    Thu Jan  1 01:00:00 1970
-+++ mutt-1.3.99/mutt-1.3.28/PATCHES    Thu May 23 14:13:28 2002
-@@ -0,0 +1 @@
-+patch-1.3.28.dw.pgp-hook.3
-diff -rU3 --new-file mutt-1.3.99-vanilla/mutt.h mutt-1.3.99/mutt.h
---- mutt-1.3.99-vanilla/mutt.h Thu May 23 14:12:14 2002
-+++ mutt-1.3.99/mutt.h Thu May 23 14:13:33 2002
-@@ -427,8 +427,10 @@
-   /* PGP options */
-   
- #ifdef HAVE_PGP
-+  OPTPGPAUTOSELECT,
-   OPTPGPAUTOSIGN,
-   OPTPGPAUTOENCRYPT,
-+  OPTPGPCONFIRMHOOK,
+--- crypt-hook-both/mutt.h Feb 2004 17:10:43 -0000     3.23
++++ crypt-hook-both/mutt.h Feb 2004 13:19:44 -0000
+@@ -442,2 +442,3 @@ enum
+   OPTSDEFAULTDECRYPTKEY,
++  OPTCRYPTCONFIRMHOOK,
    OPTPGPIGNORESUB,
-   OPTPGPLONGIDS,
-   OPTPGPREPLYENCRYPT,
-diff -rU3 --new-file mutt-1.3.99-vanilla/pgp.c mutt-1.3.99/pgp.c
---- mutt-1.3.99-vanilla/pgp.c  Wed Jan  9 16:39:28 2002
-+++ mutt-1.3.99/pgp.c  Thu May 23 14:13:33 2002
-@@ -1327,6 +1327,8 @@
-   char *keyID, *keylist = NULL, *t;
-   size_t keylist_size = 0;
+--- crypt-hook-both/pgp.c Sep 2003 13:03:26 -0000      3.26
++++ crypt-hook-both/pgp.c Feb 2004 13:19:44 -0000
+@@ -1018,2 +1018,4 @@ char *pgp_findKeys (ADDRESS *to, ADDRESS
    size_t keylist_used = 0;
 +  LIST *hook_list = NULL;
 +  LIST *hook = NULL;
    ADDRESS *tmp = NULL, *addr = NULL;
-   ADDRESS **last = &tmp;
-   ADDRESS *p, *q;
-@@ -1360,62 +1362,88 @@
-     char buf[LONG_STRING];
+@@ -1051,66 +1053,93 @@ char *pgp_findKeys (ADDRESS *to, ADDRESS
      q = p;
 -    k_info = NULL;
  
--    if ((keyID = mutt_pgp_hook (p)) != NULL)
+-    if ((keyID = mutt_crypt_hook (p)) != NULL)
 +    /*
 +     * grab the list of matching hooks (matching on recipient address)
 +     * process each entry singly so that auto key selection still works
 +     */
-+    hook_list = mutt_pgp_hook (p);
++    hook_list = mutt_crypt_hook (p);
 +    hook = hook_list;
 +    while (1)
      {
@@ -161,18 +82,25 @@ diff -rU3 --new-file mutt-1.3.99-vanilla/pgp.c mutt-1.3.99/pgp.c
 -      if ((r = mutt_yesorno (buf, M_YES)) == M_YES)
 +
 +      k_info = NULL;
++      key = NULL;
 +
 +      if (hook)
        {
--      /* check for e-mail address */
--      if ((t = strchr (keyID, '@')) && 
--          (addr = rfc822_parse_adrlist (NULL, keyID)))
+-      if (is_numerical_keyid (keyID))
 +      keyID = (char *)hook->data;
 +      snprintf (buf, sizeof (buf), _("Use keyID = \"%s\" for %s?"), keyID, p->mailbox);
-+      if (!option(OPTPGPCONFIRMHOOK) || (r = mutt_yesorno (buf, M_YES)) == M_YES)
++      if (!option(OPTCRYPTCONFIRMHOOK) || (r = mutt_yesorno (buf, M_YES)) == M_YES)
        {
--        if (fqdn) rfc822_qualify (addr, fqdn);
--        q = addr;
+-        if (strncmp (keyID, "0x", 2) == 0)
+-          keyID += 2;
+-        goto bypass_selection;                /* you don't see this. */
++        if (is_numerical_keyid (keyID))
++        {
++          if (strncmp (keyID, "0x", 2) == 0)
++            keyID += 2;
++          goto bypass_selection;              /* you don't see this. */
++        }
++
 +        /* check for e-mail address */
 +        if ((t = strchr (keyID, '@')) && 
 +            (addr = rfc822_parse_adrlist (NULL, keyID)))
@@ -182,13 +110,19 @@ diff -rU3 --new-file mutt-1.3.99-vanilla/pgp.c mutt-1.3.99/pgp.c
 +        }
 +        else
 +          k_info = pgp_getkeybystr (keyID, KEYFLAG_CANENCRYPT, PGP_PUBRING);
-+      }
+       }
+-      
+-      /* check for e-mail address */
+-      if ((t = strchr (keyID, '@')) && 
+-          (addr = rfc822_parse_adrlist (NULL, keyID)))
 +      else if (r == -1)
-+      {
+       {
+-        if (fqdn) rfc822_qualify (addr, fqdn);
+-        q = addr;
 +        /*
 +         * yes, this implies that if one key fails they all do
 +         */
-+        safe_free ((void **) &keylist);
++        FREE (&keylist);
 +        rfc822_free_address (&tmp);
 +        rfc822_free_address (&addr);
 +        mutt_free_list (&hook_list);
@@ -196,30 +130,30 @@ diff -rU3 --new-file mutt-1.3.99-vanilla/pgp.c mutt-1.3.99/pgp.c
        }
 -      else
 -        k_info = pgp_getkeybystr (keyID, KEYFLAG_CANENCRYPT, PGP_PUBRING);
--      }
+       }
 -      else if (r == -1)
 -      {
--      safe_free ((void **) &keylist);
+-      FREE (&keylist);
 -      rfc822_free_address (&tmp);
 -      rfc822_free_address (&addr);
 -      return NULL;
-       }
+-      }
 -    }
  
 -    if (k_info == NULL)
 -      pgp_invoke_getkeys (q);
-+      if (k_info == NULL)
-+      pgp_invoke_getkeys (q);
+-
 -    if (k_info == NULL && (k_info = pgp_getkeybyaddr (q, KEYFLAG_CANENCRYPT, PGP_PUBRING)) == NULL)
 -    {
 -      snprintf (buf, sizeof (buf), _("Enter keyID for %s: "), q->mailbox);
--
++      if (k_info == NULL)
++      pgp_invoke_getkeys (q);
 -      if ((key = pgp_ask_for_key (buf, q->mailbox,
 -                                KEYFLAG_CANENCRYPT, PGP_PUBRING)) == NULL)
 +      if (k_info == NULL && (k_info = pgp_getkeybyaddr (q, KEYFLAG_CANENCRYPT, PGP_PUBRING)) == NULL)
        {
--      safe_free ((void **)&keylist);
+-      FREE (&keylist);
 -      rfc822_free_address (&tmp);
 -      rfc822_free_address (&addr);
 -      return NULL;
@@ -228,7 +162,7 @@ diff -rU3 --new-file mutt-1.3.99-vanilla/pgp.c mutt-1.3.99/pgp.c
 +      if ((key = pgp_ask_for_key (buf, q->mailbox,
 +                                  KEYFLAG_CANENCRYPT, PGP_PUBRING)) == NULL)
 +      {
-+        safe_free ((void **)&keylist);
++        FREE (&keylist);
 +        rfc822_free_address (&tmp);
 +        rfc822_free_address (&addr);
 +        mutt_free_list (&hook_list);
@@ -242,20 +176,22 @@ diff -rU3 --new-file mutt-1.3.99-vanilla/pgp.c mutt-1.3.99/pgp.c
 +      key = k_info;
  
 -    keyID = pgp_keyid (key);
--    
++      keyID = pgp_keyid (key);
+     
+   bypass_selection:
 -    keylist_size += mutt_strlen (keyID) + 4;
--    safe_realloc ((void **)&keylist, keylist_size);
+-    safe_realloc (&keylist, keylist_size);
 -    sprintf (keylist + keylist_used, "%s0x%s", keylist_used ? " " : "",       /* __SPRINTF_CHECKED__ */
 -           keyID);
 -    keylist_used = mutt_strlen (keylist);
-+      keyID = pgp_keyid (key);
-+      
 +      keylist_size += mutt_strlen (keyID) + 4;
-+      safe_realloc ((void **)&keylist, keylist_size);
++      safe_realloc (&keylist, keylist_size);
 +      sprintf (keylist + keylist_used, "%s0x%s", keylist_used ? " " : "",     /* __SPRINTF_CHECKED__ */
 +             keyID);
 +      keylist_used = mutt_strlen (keylist);
-+
+-    pgp_free_key (&key);
+-    rfc822_free_address (&addr);
 +      pgp_free_key (&key);
 +      rfc822_free_address (&addr);
 +
@@ -265,87 +201,33 @@ diff -rU3 --new-file mutt-1.3.99-vanilla/pgp.c mutt-1.3.99/pgp.c
 +      hook = hook->next;
 +      if (!hook)
 +      break;
--    pgp_free_key (&key);
--    rfc822_free_address (&addr);
-+    }
-+    mutt_free_list (&hook_list);
-   }
-   rfc822_free_address (&tmp);
-diff -rU3 --new-file mutt-1.3.99-vanilla/pgpkey.c mutt-1.3.99/pgpkey.c
---- mutt-1.3.99-vanilla/pgpkey.c       Tue Jan 15 10:04:28 2002
-+++ mutt-1.3.99/pgpkey.c       Thu May 23 14:13:33 2002
-@@ -435,6 +435,11 @@
-   return rv;
- }
-+
-+#define pgp_trusted_id(uid) (!option(OPTPGPCHECKTRUST) \
-+                           || (pgp_id_is_valid((uid)) \
-+                               && pgp_id_is_strong((uid))))
 +
- static pgp_key_t *pgp_select_key (pgp_key_t *keys,
-                                 ADDRESS * p, const char *s)
- {
-@@ -450,6 +455,7 @@
-   pgp_uid_t *a;
-   int (*f) (const void *, const void *);
-+  int keymatch = 0;           /* count matching keys */
-   int unusable = 0;
-   keymax = 0;
-@@ -479,6 +485,7 @@
-       
-       KeyTable[i++] = a;
-     }
-+    keymatch++;
-   }
-   if (!i && unusable)
-@@ -487,6 +494,21 @@
-     mutt_sleep (1);
-     return NULL;
-   }
-+  else if (keymatch == 1 && option(OPTPGPAUTOSELECT))
-+  {
-+    /*
-+     * Only one matching key...see if there's an id with enough trust to auto-select
-+     */
-+    kp = KeyTable[0]->parent;
-+    for (a = kp->address; a; a = a->next)
-+    {
-+      if (pgp_trusted_id(a))
-+      {
-+      safe_free ((void **) &KeyTable);
-+      return (kp);
-+      }
 +    }
-+  }
++    mutt_free_list (&hook_list);
  
-   switch (PgpSortKeys & SORT_MASK)
-   {
-@@ -597,9 +619,7 @@
-         break;
-       }
-       
--      if (option (OPTPGPCHECKTRUST) &&
--        (!pgp_id_is_valid (KeyTable[menu->current])
--         || !pgp_id_is_strong (KeyTable[menu->current])))
-+      if (!pgp_trusted_id(KeyTable[menu->current]))
-       {
-       char *s = "";
-       char buff[LONG_STRING];
-diff -rU3 --new-file mutt-1.3.99-vanilla/protos.h mutt-1.3.99/protos.h
---- mutt-1.3.99-vanilla/protos.h       Thu May 23 14:12:14 2002
-+++ mutt-1.3.99/protos.h       Thu May 23 14:13:33 2002
-@@ -130,7 +130,7 @@
- char *mutt_get_name (ADDRESS *);
+--- crypt-hook-both/protos.h Feb 2004 17:10:43 -0000   3.19
++++ crypt-hook-both/protos.h Feb 2004 13:19:44 -0000
+@@ -131,3 +131,3 @@ const char *mutt_get_name (ADDRESS *);
  char *mutt_get_parameter (const char *, PARAMETER *);
- #ifdef HAVE_PGP
--char *mutt_pgp_hook (ADDRESS *);
-+LIST *mutt_pgp_hook (ADDRESS *);
- #endif /* HAVE_PGP */
+-char *mutt_crypt_hook (ADDRESS *);
++LIST *mutt_crypt_hook (ADDRESS *);
  char *mutt_make_date (char *, size_t);
+--- crypt-hook-both/doc/manual.sgml.head Feb 2004 17:45:33 -0000       3.26
++++ crypt-hook-both/doc/manual.sgml.head Feb 2004 13:19:44 -0000
+@@ -1450,3 +1450,5 @@ normally use.  The crypt-hook command pr
+ specify the ID of the public key to be used when encrypting messages to
+-a certain recipient.
++a certain recipient.  You may use multiple pgp-hook's with the same
++pattern; multiple matching pgp-hook's result in the use of multiple
++keyids for recipient.
  
+--- crypt-hook-both/doc/muttrc.man.head Feb 2004 17:10:43 -0000        3.10
++++ crypt-hook-both/doc/muttrc.man.head Feb 2004 13:19:44 -0000
+@@ -297,3 +297,6 @@ to a certain recipient.  The meaning of 
+ broadly: This can be a different e-mail address, a numerical key ID,
+-or even just an arbitrary search string.
++or even just an arbitrary search string.  You may use multiple
++\fBpgp-hook\fPs with the same \fIpattern\fP; multiple matching
++\fBpgp-hook\fPs result in the use of multiple \fIkey-id\fPs for
++recipient.
+ .TP
This page took 0.086478 seconds and 4 git commands to generate.