From a4af287985031a66174c2c91f152d8aa90c83f85 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Wed, 8 Oct 2008 18:08:55 +0000 Subject: Write out file using fopen so that newlines are capable --- packages/autoconfigbackup/crypt_acb.php | 6 ++++-- 1 file 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"); -- cgit v1.2.3