summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a5f4bd6)
raw | patch | inline | side by side (parent: a5f4bd6)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 15 Sep 2009 16:20:51 +0000 (16:20 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 15 Sep 2009 16:20:51 +0000 (16:20 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14254 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/include/functions.inc | patch | blob | history |
index cfe1aa99ad8c8f1a6799fa0b6622407581e473b5..1e6cba28f2f643811e65615d8c08b342646a1106 100644 (file)
/* Recurse through all possible combinations */
$proposed= recurse($stripped, $variables);
-# /* Get list of used ID's */
+ /* Get list of used ID's */
$ldap= $config->get_ldap_link();
$ldap->cd($config->current['BASE']);
$number= sprintf("%0".$size."d", $i);
$res= preg_replace('/{id:(\d+)}/', $number, $uid);
- $ldap->search("uid={$res}",array('dn'));
- if(!$ldap->count()){
+ $ldap->search("(uid=".preg_replace('/[{}]/', '', $res).")",array('dn'));
+ if($ldap->count() == 0){
$uid= $res;
break;
}
mt_srand((double) microtime()*1000000);
$number= sprintf("%0".$size."d", mt_rand(0, pow(10, $size)-1));
$res= preg_replace('/{id#(\d+)}/', $number, $uid);
- $ldap->search("uid={$res}",array('dn'));
- if(!$ldap->count()){
+ $ldap->search("(uid=".preg_replace('/[{}]/', '', $res).")",array('dn'));
+ if($ldap->count() == 0){
$uid= $res;
break;
}
}
/* Don't assign used ones */
- $ldap->search("uid={$uid}",array('dn'));
- if(!$ldap->count()){
+ $ldap->search("(uid=".preg_replace('/[{}]/', '', $uid).")",array('dn'));
+ if($ldap->count() == 0){
/* Add uid, but remove {} first. These are invalid anyway. */
$ret[]= preg_replace('/[{}]/', '', $uid);
}