summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2010-06-09 15:54:41 -0400
committerjim-p <jimp@pfsense.org>2010-06-09 15:54:41 -0400
commit3be0dff4f741ef54ee435bfbe3990c90914d857b (patch)
tree8ec39494f1c12ef0941e4d8f2891b989be2dea9a /etc
parente22eca366211bbde2a82acbc4fd0c1ca2b9e35d0 (diff)
downloadpfsense-3be0dff4f741ef54ee435bfbe3990c90914d857b.zip
pfsense-3be0dff4f741ef54ee435bfbe3990c90914d857b.tar.gz
Clean up this code a little.
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/crypt.inc14
1 files changed, 6 insertions, 8 deletions
diff --git a/etc/inc/crypt.inc b/etc/inc/crypt.inc
index dcc359f..dc40eb9 100644
--- a/etc/inc/crypt.inc
+++ b/etc/inc/crypt.inc
@@ -34,14 +34,12 @@
function crypt_data($val, $pass, $opt) {
$file = tempnam("/tmp", "php-encrypt");
- $fd = fopen("$file.dec", "w");
- fwrite($fd, $val);
- fclose($fd);
- exec("/usr/bin/openssl enc {$opt} -aes-256-cbc -in $file.dec -out $file.enc -k {$pass}");
- $result = file_get_contents("$file.enc");
- exec("rm $file");
- exec("rm $file.dec");
- exec("rm $file.enc");
+ file_put_contents("{$file}.dec", $val);
+ exec("/usr/bin/openssl enc {$opt} -aes-256-cbc -in {$file}.dec -out {$file}.enc -k {$pass}");
+ $result = file_get_contents("{$file}.enc");
+ unlink($file);
+ unlink("{$file}.dec");
+ unlink("{$file}.enc");
return $result;
}
OpenPOWER on IntegriCloud