diff --git a/lib/functions.php b/lib/functions.php index 0442c53..c6ea9a4 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -1,5 +1,5 @@ $attrs) { + $entry = array(); + switch ($type) { case 'uid' : if (isset($attrs['uidNumber'])) { @@ -799,6 +804,8 @@ function get_next_uid_number($ldapserver,$startbase='',$type='uid') { $entry['uniqnumber'] = $attrs['gidNumber']; } break; + default : + pla_error(sprintf('Unknown type [%s] in search',$type)); } $results[] = $entry; } @@ -807,7 +814,8 @@ function get_next_uid_number($ldapserver,$startbase='',$type='uid') { # construct a list of used numbers $autonum = array(); foreach ($results as $result) - $autonum[] = $result['uniqnumber']; + if (isset($result['uniqnumber'])) + $autonum[] = $result['uniqnumber']; $autonum = array_unique($autonum); if (count($autonum) == 0)