Package: mutt
Version: 1.5.11-5
Tags: patch

When I use Mutt with gnome-gpg, it still prompts me for the
passphrase.  It shouldn't do so, since gnome-gpg takes care of reading
and caching the passphrase.

The attached patch adds a pgp_use_gnome_gpg configuration flag that,
when set, prevents Mutt from prompting for the passphrase.

-- 
Matt
diff -ru mutt-1.5.11/init.h mutt-1.5.11/init.h
--- mutt-1.5.11/init.h  2006-01-24 23:01:39.000000000 -0800
+++ mutt-1.5.11/init.h  2006-01-24 22:56:21.000000000 -0800
@@ -1464,6 +1464,12 @@
   ** you may unset this setting.
   ** (Crypto only)
   */
+  { "pgp_use_gnome_gpg", DT_BOOL, R_NONE, OPTUSEGNOMEGPG, 0},
+  /*
+  ** .pp
+  ** If set, mutt will use gnome-gpg process.
+  ** (PGP only)
+  */
   { "pgp_use_gpg_agent", DT_BOOL, R_NONE, OPTUSEGPGAGENT, 0},
   /*
   ** .pp
diff -ru mutt-1.5.11/mutt.h mutt-1.5.11/mutt.h
--- mutt-1.5.11/mutt.h  2006-01-24 23:01:38.000000000 -0800
+++ mutt-1.5.11/mutt.h  2006-01-24 22:55:15.000000000 -0800
@@ -441,6 +441,7 @@
   OPTUSE8BITMIME,
   OPTUSEDOMAIN,
   OPTUSEFROM,
+  OPTUSEGNOMEGPG,
   OPTUSEGPGAGENT,
 #ifdef HAVE_LIBIDN
   OPTUSEIDN,
diff -ru mutt-1.5.11/pgp.c mutt-1.5.11/pgp.c
--- mutt-1.5.11/pgp.c   2006-01-24 23:01:38.000000000 -0800
+++ mutt-1.5.11/pgp.c   2006-01-24 22:59:34.000000000 -0800
@@ -75,7 +75,7 @@
 {
   time_t now = time (NULL);
 
-  if (pgp_use_gpg_agent())
+  if (pgp_use_gpg_agent() || pgp_use_gnome_gpg())
     {
       *PgpPass = 0;
       return 1; /* handled by gpg-agent */
@@ -117,6 +117,11 @@
   return 1;
 }
 
+int pgp_use_gnome_gpg (void)
+{
+  return option (OPTUSEGNOMEGPG);
+}
+
 char *pgp_keyid(pgp_key_t k)
 {
   if((k->flags & KEYFLAG_SUBKEY) && k->parent && option(OPTPGPIGNORESUB))
@@ -358,7 +363,7 @@
          if (needpass)
          {
            if (!pgp_valid_passphrase ()) pgp_void_passphrase();
-            if (pgp_use_gpg_agent())
+            if (pgp_use_gnome_gpg() || pgp_use_gpg_agent())
               *PgpPass = 0;
            fprintf (pgpin, "%s\n", PgpPass);
          }
@@ -810,7 +815,7 @@
   /* send the PGP passphrase to the subprocess.  Never do this if the
      agent is active, because this might lead to a passphrase send as
      the message. */
-  if (!pgp_use_gpg_agent())
+  if (!pgp_use_gnome_gpg && !pgp_use_gpg_agent())
     fputs (PgpPass, pgpin);
   fputc ('\n', pgpin);
   fclose(pgpin);
@@ -1029,7 +1034,7 @@
     return NULL;
   }
   
-  if (!pgp_use_gpg_agent())
+  if (!pgp_use_gnome_gpg() && !pgp_use_gpg_agent())
      fputs(PgpPass, pgpin);
   fputc('\n', pgpin);
   fclose(pgpin);
@@ -1295,7 +1300,7 @@
 
   if (sign)
   {
-    if (!pgp_use_gpg_agent())
+    if (!pgp_use_gnome_gpg() && !pgp_use_gpg_agent())
        fputs (PgpPass, pgpin);
     fputc ('\n', pgpin);
   }
@@ -1468,7 +1473,7 @@
     return NULL;
   }
 
-  if (pgp_use_gpg_agent())
+  if (pgp_use_gnome_gpg() || pgp_use_gpg_agent())
     *PgpPass = 0;
   if (flags & SIGN)
     fprintf (pgpin, "%s\n", PgpPass);

Attachment: signature.asc
Description: Digital signature

Reply via email to