Skip to content

Commit d151a12

Browse files
committed
Cleanup SSL certificate tempfiles
1 parent 9e79206 commit d151a12

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

web/edit/web/index.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,21 @@
280280
$v_ssl_crt = $_POST['v_ssl_crt'];
281281
$v_ssl_key = $_POST['v_ssl_key'];
282282
$v_ssl_ca = $_POST['v_ssl_ca'];
283+
284+
// Cleanup certificate tempfiles
285+
if (!empty($_POST['v_ssl_crt'])) {
286+
unlink($tmpdir."/".$_POST['v_domain'].".crt");
287+
}
288+
289+
if (!empty($_POST['v_ssl_key'])) {
290+
unlink($tmpdir."/".$_POST['v_domain'].".key");
291+
}
292+
293+
if (!empty($_POST['v_ssl_ca'])) {
294+
unlink($tmpdir."/".$_POST['v_domain'].".ca");
295+
}
296+
297+
rmdir($tmpdir);
283298
}
284299
}
285300

@@ -332,6 +347,21 @@
332347
$v_ssl_key = $_POST['v_ssl_key'];
333348
$v_ssl_ca = $_POST['v_ssl_ca'];
334349
$v_ssl_home = $_POST['v_ssl_home'];
350+
351+
// Cleanup certificate tempfiles
352+
if (!empty($_POST['v_ssl_crt'])) {
353+
unlink($tmpdir."/".$_POST['v_domain'].".crt");
354+
}
355+
356+
if (!empty($_POST['v_ssl_key'])) {
357+
unlink($tmpdir."/".$_POST['v_domain'].".key");
358+
}
359+
360+
if (!empty($_POST['v_ssl_ca'])) {
361+
unlink($tmpdir."/".$_POST['v_domain'].".ca");
362+
}
363+
364+
rmdir($tmpdir);
335365
}
336366
}
337367

0 commit comments

Comments
 (0)