index ed0491bd325cabd9f927c973a49f87672453bbbd..c7acab6c24524d2180e2d1ff481f6b58189ecb94 100644 (file)
define('DES3_CBC_SHA1',16);
/* Include required files */
-require_once("class_location.inc");
+include_once("class_location.inc");
require_once ("functions_debug.inc");
require_once ("accept-to-gettext.inc");
if($config->get_cfg_value("core","loginAttribute") != ""){
$tmp = explode(",", $config->get_cfg_value("core","loginAttribute"));
foreach($tmp as $attr){
- if(in_array($attr,$allowed_attributes)){
+ if(in_array_strict($attr,$allowed_attributes)){
$verify_attr[] = $attr;
}
}
@@ -2907,9 +2907,14 @@ function change_password ($dn, $password, $mode=FALSE, $hash= "", $old_password
$attrs= array();
if (!$mode && !empty($tmp)){
$attrs= generate_smb_nt_hash($password);
- $shadow = (isset($attrs["shadowLastChange"][0]))?(int)(date("U") / 86400):0;
- if ($shadow != 0){
- $attrs['shadowLastChange']= $shadow;
+ if(!count($attrs) || !is_array($attrs)){
+ msg_dialog::display(_("Error"),_("Cannot generate SAMBA hash!"),ERROR_DIALOG);
+ return(FALSE);
+ }else{
+ $shadow = (isset($attrs["shadowLastChange"][0]))?(int)(date("U") / 86400):0;
+ if ($shadow != 0){
+ $attrs['shadowLastChange']= $shadow;
+ }
}
}
$hash = $rpc->mksmbhash($password);
if(!$rpc->success()){
msg_dialog::display(_("Error"),msgPool::rpcError($rpc->get_error()),ERROR_DIALOG);
- return("");
+ return(array());
}
}elseif ($config->get_cfg_value("core","gosaSupportURI") != ""){
if ($hash == "") {
msg_dialog::display(_("Configuration error"), sprintf(_("Generating SAMBA hash by running %s failed: check %s!"), bold($config->get_cfg_value("core",'sambaHashHook'), bold("sambaHashHook"))), ERROR_DIALOG);
- return ("");
+ return(array());
}
}
$base= get_base_from_hook($dn, $attrib);
}
for ($id= $base; $id++; $id < pow(2,32)){
- if (!in_array($id, $ids)){
+ if (!in_array_strict($id, $ids)){
return ($id);
}
}
$label= null;
// Bail out, if there's no style file
+ if(!class_exists('session')){
+ return "";
+ }
if(!session::global_is_set("img-styles")){
// Get theme
/*\brief Our own in_array method which defaults to a strict mode.
*/
-function in_array_strict($needle, $haystack, $strict = TRUE){
+function in_array_strict($needle, $haystack, $strict = TRUE)
+{
return(in_array($needle, $haystack, $strict));
}