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

[PATCH] Make %p escapes work with gnupg-agent



  This is quite a trivial patch, but handy to make the ggp.rc file work
  for everybody, using the agent or not. Patch adds a check in
  pgpinvoke.c, and fixes gpg.rc to add %p escapes where they were
  missing.

  patch.asp.%p-escape-agent-compatible.1
  --------------------------------------

    Make the %?p? escape work for $pgp_*_commands when the gnupg agent
    is in use. Update variable definitions in contrib/gpg.rc so that the
    %p escape is used when appropriate.


-- 
Adeodato Simó
    EM: asp16 [ykwim] alu.ua.es | PK: DA6AE621
 
It is impossible to make anything foolproof because fools are so ingenious.
--- a/pgpinvoke.c
+++ b/pgpinvoke.c
@@ -123,7 +123,7 @@
        snprintf (fmt, sizeof (fmt), "%%%ss", prefix);
        snprintf (dest, destlen, fmt, cctx->need_passphrase ? "PGPPASSFD=0" : 
"");
       }
-      else if (!cctx->need_passphrase)
+      else if (!cctx->need_passphrase || pgp_use_gpg_agent())
        optional = 0;
       break;
     }
--- a/contrib/gpg.rc
+++ b/contrib/gpg.rc
@@ -37,15 +37,15 @@
 set pgp_verify_command="/usr/bin/gpg   --no-verbose --quiet  --batch  --output 
- --verify %s %f"
 
 # decrypt a pgp/mime attachment
-set pgp_decrypt_command="/usr/bin/gpg   --passphrase-fd 0 --no-verbose --quiet 
 --batch  --output - %f"
+set pgp_decrypt_command="/usr/bin/gpg   %?p?--passphrase-fd 0? --no-verbose 
--quiet  --batch  --output - %f"
 
 # create a pgp/mime signed attachment
 # set pgp_sign_command="/usr/bin/gpg-2comp --comment '' --no-verbose --batch  
--output - --passphrase-fd 0 --armor --detach-sign --textmode %?a?-u %a? %f"
-set pgp_sign_command="/usr/bin/gpg    --no-verbose --batch --quiet   --output 
- --passphrase-fd 0 --armor --detach-sign --textmode %?a?-u %a? %f"
+set pgp_sign_command="/usr/bin/gpg    --no-verbose --batch --quiet   --output 
- %?p?--passphrase-fd 0? --armor --detach-sign --textmode %?a?-u %a? %f"
 
 # create a application/pgp signed (old-style) message
 # set pgp_clearsign_command="/usr/bin/gpg-2comp --comment ''  --no-verbose 
--batch  --output - --passphrase-fd 0 --armor --textmode --clearsign %?a?-u %a? 
%f"
-set pgp_clearsign_command="/usr/bin/gpg   --charset utf-8 --no-verbose --batch 
--quiet   --output - --passphrase-fd 0 --armor --textmode --clearsign %?a?-u 
%a? %f"
+set pgp_clearsign_command="/usr/bin/gpg   --charset utf-8 --no-verbose --batch 
--quiet   --output - %?p?--passphrase-fd 0? --armor --textmode --clearsign 
%?a?-u %a? %f"
 
 # create a pgp/mime encrypted attachment
 # set pgp_encrypt_only_command="pgpewrap gpg-2comp  -v --batch  --output - 
--encrypt --textmode --armor --always-trust -- -r %r -- %f"
@@ -53,7 +53,7 @@
 
 # create a pgp/mime encrypted and signed attachment
 # set pgp_encrypt_sign_command="pgpewrap gpg-2comp  --passphrase-fd 0 -v 
--batch  --output - --encrypt --sign %?a?-u %a? --armor --always-trust -- -r %r 
-- %f"
-set pgp_encrypt_sign_command="pgpewrap /usr/bin/gpg  --charset utf-8 
--passphrase-fd 0  --batch --quiet  --no-verbose  --textmode --output - 
--encrypt --sign %?a?-u %a? --armor --always-trust -- -r %r -- %f"
+set pgp_encrypt_sign_command="pgpewrap /usr/bin/gpg  --charset utf-8 
%?p?--passphrase-fd 0?  --batch --quiet  --no-verbose  --textmode --output - 
--encrypt --sign %?a?-u %a? --armor --always-trust -- -r %r -- %f"
 
 # import a key into the public key ring
 set pgp_import_command="/usr/bin/gpg  --no-verbose --import %f"