1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
Description: Don't count LDAP objects if search/list result is false (bool).
Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
--- a/include/functions.inc
+++ b/include/functions.inc
@@ -3803,7 +3803,12 @@
array('dn'));
// If we haven't created the character-detection object, then create it now.
- $cnt = ldap_count_entries($ldapCID, $res);
+ if ($res) {
+ $cnt = ldap_count_entries($ldapCID, $res);
+ }
+ else {
+ $cnt = 0;
+ }
if(!$cnt){
$obj = array();
$obj['objectClass'] = array('top','organization');
@@ -3819,7 +3824,12 @@
$res = ldap_list($ldapCID, $config->current['BASE'],
"(&(o=".$filterName.")(objectClass=organization))",
array('dn','o'));
- $cnt = ldap_count_entries($ldapCID, $res);
+ if ($res) {
+ $cnt = ldap_count_entries($ldapCID, $res);
+ }
+ else {
+ $cnt = 0;
+ }
if($cnt != 1 || !$res){
trigger_error("GOsa couldn't detect the special character handling used by your ldap!");
return(NULL);
|