aboutsummaryrefslogtreecommitdiffstats
path: root/packages/autoconfigbackup
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2008-10-08 18:08:55 +0000
committerScott Ullrich <sullrich@pfsense.org>2008-10-08 18:08:55 +0000
commita4af287985031a66174c2c91f152d8aa90c83f85 (patch)
treeca07da900a26073fd0626b931f8f01f656ea4dd6 /packages/autoconfigbackup
parented4fa6f84bfbc11da71522ada3ce411876d6ea61 (diff)
downloadpfsense-packages-a4af287985031a66174c2c91f152d8aa90c83f85.tar.gz
pfsense-packages-a4af287985031a66174c2c91f152d8aa90c83f85.tar.bz2
pfsense-packages-a4af287985031a66174c2c91f152d8aa90c83f85.zip
Write out file using fopen so that newlines are capable
Diffstat (limited to 'packages/autoconfigbackup')
-rw-r--r--packages/autoconfigbackup/crypt_acb.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/packages/autoconfigbackup/crypt_acb.php b/packages/autoconfigbackup/crypt_acb.php
index 6c2dfa04..3fdfb4f2 100644
--- a/packages/autoconfigbackup/crypt_acb.php
+++ b/packages/autoconfigbackup/crypt_acb.php
@@ -30,8 +30,10 @@
*/
function crypt_data($val, $pass, $opt) {
- $file = tempnam('','php-encrypt-');
- exec("echo -E '$val' > $file.dec");
+ $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}");
$myfile = file("$file.enc");
exec("rm $file");