Ajout de secu dans le checkpolicy

This commit is contained in:
Alan Garcia 2013-01-31 17:17:18 +00:00
parent f15b47b43a
commit e11ff7c263
3 changed files with 18 additions and 6 deletions

View File

@ -43,12 +43,6 @@ if ($password != $passwordconf) {
exit();
}
if (empty($password)) {
$error=_("Please enter a password");
include ("hta_adduser.php");
exit();
}
if (!$hta->add_user($user, $password, $dir)) {
$error=$err->errstr();
include ("hta_adduser.php");

View File

@ -1123,6 +1123,16 @@ EOF;
*/
function checkPolicy($policy,$login,$password) {
global $db,$err;
if (empty($login)) {
$err->raise("admin",_("-- Program error -- CheckPolicy need a login"));
return false;
}
if (empty($password)) {
$err->raise("admin",_("-- Program error -- CheckPolicy need a password"));
return false;
}
$pol=$this->listPasswordPolicies();
if (!$pol[$policy]) {
$err->raise("admin",_("-- Program error -- The requested password policy does not exist!"));

View File

@ -216,6 +216,14 @@ class m_hta {
function add_user($user,$password,$dir) {
global $err, $bro, $admin;
$err->log("hta","add_user",$user."/".$dir);
if (empty($user)) {
$err->raise('hta',_("Please enter a user"));
return false;
}
if (empty($password)) {
$err->raise('hta',_("Please enter a password"));
return false;
}
$absolute=$bro->convertabsolute($dir,0);
if (!file_exists($absolute)) {
$err->raise("hta",printf(("The folder '%s' does not exist"),$dir));