summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Tänzer <neo@nhng.de>2013-08-07 01:45:09 +0200
committerMichael Tänzer <neo@nhng.de>2013-08-07 01:45:09 +0200
commit79a582ee1a478fc5b1858d9752226640f63af55d (patch)
treec85ac7fd096ebe8c35db6ed501aee6f93a5ed933
parent8fa82f2cbd17e3f32a537cd405b01d6b6c623ea0 (diff)
downloadcacert-devel-79a582ee1a478fc5b1858d9752226640f63af55d.tar.gz
cacert-devel-79a582ee1a478fc5b1858d9752226640f63af55d.tar.xz
cacert-devel-79a582ee1a478fc5b1858d9752226640f63af55d.zip
bug 1200: Use runCommand() to execute gpg to avoid using an unneeded tempfile
Signed-off-by: Michael Tänzer <neo@nhng.de>
-rw-r--r--www/gpg.php21
1 files changed, 13 insertions, 8 deletions
diff --git a/www/gpg.php b/www/gpg.php
index c3ba98d..813ee31 100644
--- a/www/gpg.php
+++ b/www/gpg.php
@@ -17,6 +17,7 @@
*/ ?>
<?
require_once("../includes/loggedin.php");
+ require_once("../includes/lib/general.php");
$id = 0; if(array_key_exists('id',$_REQUEST)) $id=intval($_REQUEST['id']);
$oldid = $_REQUEST['oldid'] = array_key_exists('oldid',$_REQUEST) ? intval($_REQUEST['oldid']) : 0;
@@ -82,17 +83,21 @@ function verifyEmail($email)
$state=0;
if($oldid == "0" && $CSR != "")
{
- $gpgkey = clean_gpgcsr($CSR);
+ if (runCommand('gpg --with-colons --homedir /tmp 2>&1',
+ clean_gpgcsr($CSR),
+ $gpg))
+ {
+ showheader(_("Welcome to CAcert.org"));
- $tnam = tempnam('/tmp/', '__gpg');
- $fp = fopen($tnam, 'w');
- fwrite($fp, $gpgkey);
- fclose($fp);
- $gpg = trim(`gpg --with-colons --homedir /tmp 2>&1 < $tnam`);
- unlink($tnam);
+ echo "<p style='color:#ff0000'>"._("There was an error parsing your key.")."</p>";
+ unset($_REQUEST['process']);
+ $id = $oldid;
+ unset($oldid);
+ exit();
+ }
$lines = "";
- $gpgarr = explode("\n", $gpg);
+ $gpgarr = explode("\n", trim($gpg));
foreach($gpgarr as $line)
{
#echo "Line[]: $line <br/>\n";