From: Mark Huang Date: Fri, 5 Jan 2007 18:50:40 +0000 (+0000) Subject: - use temporary home directory since apache user does not have write X-Git-Tag: pycurl-7_13_1~165 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=444fb00ab548e2c35d9d933f38977cde212ce7d3;p=plcapi.git - use temporary home directory since apache user does not have write access to its own home directory or /etc/planetlab --- diff --git a/PLC/GPG.py b/PLC/GPG.py index ce864221..0101e470 100644 --- a/PLC/GPG.py +++ b/PLC/GPG.py @@ -7,7 +7,7 @@ # Mark Huang # Copyright (C) 2006 The Trustees of Princeton University # -# $Id$ +# $Id: GPG.py,v 1.1 2006/12/15 18:21:57 mlhuang Exp $ # import xmlrpclib @@ -45,7 +45,9 @@ def gpg_sign(methodname, args, secret_keyring, keyring): message = canonicalize(methodname, args) + homedir = mkdtemp() p = Popen(["gpg", "--batch", "--no-tty", + "--homedir", homedir, "--no-default-keyring", "--secret-keyring", secret_keyring, "--keyring", keyring, @@ -55,6 +57,10 @@ def gpg_sign(methodname, args, secret_keyring, keyring): p.stdin.close() signature = p.stdout.read() rc = p.wait() + + # Clean up + shutil.rmtree(homedir) + if rc: raise PLCAuthenticationFailure, "GPG signing failed with return code %d" % rc