From d151a124b5e3009f7e48dc8b0033ad7917d4481f Mon Sep 17 00:00:00 2001 From: Thijs Houtenbos Date: Sun, 21 Sep 2014 12:19:09 +0200 Subject: [PATCH] Cleanup SSL certificate tempfiles --- web/edit/web/index.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/web/edit/web/index.php b/web/edit/web/index.php index 992b35941..4373c59b9 100644 --- a/web/edit/web/index.php +++ b/web/edit/web/index.php @@ -280,6 +280,21 @@ if (!empty($_POST['save'])) { $v_ssl_crt = $_POST['v_ssl_crt']; $v_ssl_key = $_POST['v_ssl_key']; $v_ssl_ca = $_POST['v_ssl_ca']; + + // Cleanup certificate tempfiles + if (!empty($_POST['v_ssl_crt'])) { + unlink($tmpdir."/".$_POST['v_domain'].".crt"); + } + + if (!empty($_POST['v_ssl_key'])) { + unlink($tmpdir."/".$_POST['v_domain'].".key"); + } + + if (!empty($_POST['v_ssl_ca'])) { + unlink($tmpdir."/".$_POST['v_domain'].".ca"); + } + + rmdir($tmpdir); } } @@ -332,6 +347,21 @@ if (!empty($_POST['save'])) { $v_ssl_key = $_POST['v_ssl_key']; $v_ssl_ca = $_POST['v_ssl_ca']; $v_ssl_home = $_POST['v_ssl_home']; + + // Cleanup certificate tempfiles + if (!empty($_POST['v_ssl_crt'])) { + unlink($tmpdir."/".$_POST['v_domain'].".crt"); + } + + if (!empty($_POST['v_ssl_key'])) { + unlink($tmpdir."/".$_POST['v_domain'].".key"); + } + + if (!empty($_POST['v_ssl_ca'])) { + unlink($tmpdir."/".$_POST['v_domain'].".ca"); + } + + rmdir($tmpdir); } }