From 89b29b183967b517129d5095c145c5582af5b6bf Mon Sep 17 00:00:00 2001 From: Donncha O'Cearbhaill Date: Sun, 21 Jul 2013 01:29:58 +0100 Subject: [PATCH 1/3] Run perl script with UID to match EUID This helps avoid an error where GnuPG won't run if the uid does not match the euid returning error like "Error: secmem usage: 0/0 bytes in 0/0 blocks" --- gpgit | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gpgit b/gpgit index 55937b9..8e63293 100755 --- a/gpgit +++ b/gpgit @@ -58,6 +58,9 @@ use MIME::Parser; ## Set the home environment variable from the user running the script $ENV{HOME} = (getpwuid($>))[7]; +## Set the UID to match the EUID to prevent errors from GnuPG. + $< = $>; + ## Object for GPG encryption my $gpg = new Mail::GnuPG(); From 3ed318e47d90fcba06f33b7f3dd7f08f14a897ca Mon Sep 17 00:00:00 2001 From: Donncha O'Cearbhaill Date: Sun, 21 Jul 2013 14:08:17 +0100 Subject: [PATCH 2/3] Use explict form of specifing $REAL_USER_ID and $EFFECTIVE_USER_ID Dovecot can be setup to run as a virtual user, for example 'vmail'. Sieve scripts are then run with the UID of root but the EUID of the vmail user. GnuPG will not run if the EUID does not match the UID as a measure to prevent the system letting it keep root privs. http://lists.gnupg.org/pipermail/gnupg-users/2006-August/029109.html --- gpgit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gpgit b/gpgit index 8e63293..de7fac5 100755 --- a/gpgit +++ b/gpgit @@ -59,7 +59,7 @@ use MIME::Parser; $ENV{HOME} = (getpwuid($>))[7]; ## Set the UID to match the EUID to prevent errors from GnuPG. - $< = $>; + $REAL_USER_ID = $EFFECTIVE_USER_ID; ## Object for GPG encryption my $gpg = new Mail::GnuPG(); From 595a9514a8b3bb3f704e4606f1ca2cb315dfc78d Mon Sep 17 00:00:00 2001 From: Donncha O'Cearbhaill Date: Sun, 21 Jul 2013 14:24:35 +0100 Subject: [PATCH 3/3] Add 'use English' for special variable names --- gpgit | 1 + 1 file changed, 1 insertion(+) diff --git a/gpgit b/gpgit index de7fac5..e31fd82 100755 --- a/gpgit +++ b/gpgit @@ -22,6 +22,7 @@ use strict; use warnings; +use English; use Mail::GnuPG; use MIME::Parser;