index 961abc56a65296dd2956d70ccedb1935c1750b08..18bac90a470d8c41a84dcec4c83fbffc25b70dee 100644 (file)
define ("CONFIG_DIR", "/etc/gosa");
define ("CONFIG_FILE", "gosa.conf");
define ("CONFIG_TEMPLATE_DIR", "../contrib/");
+define ("TEMP_DIR","/var/cache/gosa/tmp");
/* Define get_list flags */
define("GL_NONE", 0);
/* Build a sub-directory style list of the tree level
specified in $dn */
+ global $config;
+ $dn = preg_replace("/".normalizePreg($config->current['BASE'])."$/i","",$dn);
+ if(empty($dn)) return("/");
+
foreach (split(',', $dn) as $rdn){
/* We're only interested in organizational units... */
@@ -2361,6 +2366,16 @@ function get_languages($languages_in_own_language = FALSE,$strip_region_tag = FA
if($languages_in_own_language){
$old_lang = setlocale(LC_ALL, 0);
+
+ /* If the locale wasn't correclty set before, there may be an incorrect
+ locale returned. Something like this:
+ C_CTYPE=de_DE.UTF-8;LC_NUMERIC=C;LC_TIME=de_DE.UTF-8;LC ...
+ Extract the locale name from this string and use it to restore old locale.
+ */
+ if(preg_match("/LC_CTYPE/",$old_lang)){
+ $old_lang = preg_replace("/^.*LC_CTYPE=([^;]*).*$/","\\1",$old_lang);
+ }
+
foreach($tmp as $key => $name){
$lang = $key.".UTF-8";
setlocale(LC_ALL, $lang);
/* Extract used hash */
if ($hash == ""){
- $test = passwordMethod::get_method($attrs['userPassword'][0]);
+ $test = passwordMethod::get_method($attrs['userPassword'][0],$dn);
} else {
- $test = new $available[$hash]($config);
+ $test = new $available[$hash]($config,$dn);
$test->set_hash($hash);
}
} else {
/* Run backend method for change/create */
- $test->set_password($password);
+ if(!$test->set_password($password)){
+ return(FALSE);
+ }
/* Find postmodify entries for this class */
$command= $config->search("password", "POSTMODIFY",array('menu'));
}
}
}
+ return(TRUE);
}
header("Cache-Control: post-check=0, pre-check=0");
header("Content-type: ".$type."");
+ $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
+
/* force download dialog */
if (preg_match('/MSIE 5.5/', $HTTP_USER_AGENT) || preg_match('/MSIE 6.0/', $HTTP_USER_AGENT)) {
header('Content-Disposition: filename="'.$name.'"');
} else {
return (chr ($randno + 59)); // Lowercase
}
- }
+}
+
+
+function cred_encrypt($input, $password) {
+
+ $size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
+ $iv = mcrypt_create_iv($size, MCRYPT_DEV_RANDOM);
+
+ return bin2hex(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $password, $input, MCRYPT_MODE_ECB, $iv));
+
+}
+
+function cred_decrypt($input,$password) {
+ $size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
+ $iv = mcrypt_create_iv($size, MCRYPT_DEV_RANDOM);
+
+ return mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $password, pack("H*", $input), MCRYPT_MODE_ECB, $iv);
+}
+
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>