Add some checks on directories
This commit is contained in:
parent
b6792f3b72
commit
861b644b9e
7 changed files with 83 additions and 40 deletions
|
|
@ -26,33 +26,37 @@ function new_client($name)
|
|||
{
|
||||
//TODO handle if already exist
|
||||
putenv("OPENSSL_CONF=".ONYX. '../misc/openssl.cnf');
|
||||
putenv("TOP_DIR=".ONYX. '../misc/fic_pki');
|
||||
putenv("TOP_DIR=".ONYX. '../misc/pki');
|
||||
$output = shell_exec(ONYX . "../misc/CA.sh -newclient $name");
|
||||
}
|
||||
|
||||
if (isset($_GET['newca']))
|
||||
if (!empty($p[2]))
|
||||
{
|
||||
if ($p[2] == "newca")
|
||||
{
|
||||
//TODO handle if already exist
|
||||
putenv("OPENSSL_CONF=".ONYX. '../misc/openssl.cnf');
|
||||
putenv("TOP_DIR=".ONYX. '../misc/fic_pki');
|
||||
putenv("TOP_DIR=".ONYX. '../misc/pki');
|
||||
$output = shell_exec(ONYX . '../misc/CA.sh -newca');
|
||||
|
||||
//TODO handle the path ?
|
||||
$ca_file = ONYX . '../misc/fic_pki/cacert.crt';
|
||||
$ca_file = ONYX . '../misc/pki/cacert.crt';
|
||||
//TODO check permission ?
|
||||
if (file_exists($ca_file))
|
||||
{
|
||||
$data = openssl_x509_parse(file_get_contents(ONYX . '../misc/fic_pki/cacert.crt'));
|
||||
$template->assign("cert", $data);
|
||||
$data = openssl_x509_parse(file_get_contents(ONYX . '../misc/pki/cacert.crt'));
|
||||
$template->assign("cert", $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['deleteca']))
|
||||
{
|
||||
elseif ($p[2] == "deleteca")
|
||||
{
|
||||
//TODO handle var path
|
||||
$dir = ONYX . '../misc/fic_pki';
|
||||
$dir = ONYX . '../misc/pki';
|
||||
|
||||
remove_directory($dir);
|
||||
}
|
||||
}
|
||||
|
||||
return "admin/home";
|
||||
//header("Location: /admin/");
|
||||
//exit;
|
||||
Reference in a new issue