index 516ac61bd3a1153c66050dd035957f938b576b48..d14308bcb45988897ccb484c7606655a47c14ebe 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");
// Fetch required attributes
foreach(array('shadowExpire','shadowLastChange','shadowMax','shadowMin',
- 'shadowInactive','shadowWarning') as $attr){
+ 'shadowInactive','shadowWarning','sambaKickoffTime') as $attr){
$$attr = (isset($attrs[$attr][0]))? $attrs[$attr][0] : null;
}
+ // Check if the account has reached its kick off limitations.
+ // ---------------------------------------------------------
+ // Once the accout reaches the kick off limit it has expired.
+ if($sambaKickoffTime !== null){
+ if(time() >= $sambaKickoffTime){
+ return(POSIX_ACCOUNT_EXPIRED);
+ }
+ }
+
+
// Check if the account has expired.
// ---------------------------------
// An account is locked/expired once its expiration date has reached (shadowExpire).
global $config;
if(!$config->configRegistry->propertyExists($class,$name)){
- trigger_error("No department mapping found for type ".$name);
+ if($config->boolValueIsTrue("core","developmentMode")){
+ trigger_error("No department mapping found for type ".$name);
+ }
return "";
}
@@ -2878,9 +2890,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(tr("Error"),tr("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());
}
}
$label= null;
// Bail out, if there's no style file
+ if(!class_exists('session')){
+ return "";
+ }
if(!session::global_is_set("img-styles")){
// Get theme
}
krsort($hits);
+ // Add lower case placeholders to avoid errors
+ foreach($attrs as $key => $attr) $attrs[strtolower($key)] = $attr;
+
// Replace the placeholder in the given string now.
foreach($hits as $match){
// Avoid errors about undefined index.
- $name = $match[2];
+ $name = strtolower($match[2]);
if(!isset($attrs[$name])) $attrs[$name] = $default;
// Calculate the replacement
if(!isset($match[5])){
$replacements[$match[0]][] = $attributes[$match[2]];
- // Start given but no end, so just add a simple character
+ // Start given but no end, so just add a single character
}elseif(!isset($match[7])){
if(isset($attributes[$match[2]][$match[5]])){
- $replacements[$match[0]][] = $attributes[$match[2]][$match[5]];
+ $tmp = " ".$attributes[$match[2]];
+ $replacements[$match[0]][] = trim($tmp[$match[5]]);
}
// Add all values in range
$str = "";
for($i=$match[5]; $i<= $match[7]; $i++){
if(isset($attributes[$match[2]][$i])){
- $str .= $attributes[$match[2]][$i];
- $replacements[$match[0]][] = $str;
+ $tmp = " ".$attributes[$match[2]];
+ $str .= $tmp[$i];
+ $replacements[$match[0]][] = trim($str);
}
}
}