diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-12-01 13:03:46 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-12-01 13:03:46 +0000 |
| commit | 0181c2c573613b6a1ee874b926291515b75a9c8f (patch) | |
| tree | d4ed134658381ffed910fc68ff12f45b1d11c2b7 | |
| parent | b6aa75b9d043cd15597f4b05ead6f8e579c311b6 (diff) | |
- Fix issue where "S: Error: Success" was printed to debug log
git-svn-id: https://svn.roundcube.net/trunk@5524 208e9e7b-5314-0410-a742-e7e81cd9613c
| -rw-r--r-- | roundcubemail/program/include/rcube_ldap.php | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/roundcubemail/program/include/rcube_ldap.php b/roundcubemail/program/include/rcube_ldap.php index aa8035696..b25751c21 100644 --- a/roundcubemail/program/include/rcube_ldap.php +++ b/roundcubemail/program/include/rcube_ldap.php @@ -663,14 +663,11 @@ class rcube_ldap extends rcube_addressbook $attrib = $count ? array('dn') : array_values($this->fieldmap); if ($result = @$func($this->conn, $m[1], $filter, - $attrib, 0, (int)$this->prop['sizelimit'], (int)$this->prop['timelimit'])) - { + $attrib, 0, (int)$this->prop['sizelimit'], (int)$this->prop['timelimit']) + ) { $this->_debug("S: ".ldap_count_entries($this->conn, $result)." record(s) for ".$m[1]); - if ($err = ldap_errno($this->conn)) - $this->_debug("S: Error: " .ldap_err2str($err)); } - else - { + else { $this->_debug("S: ".ldap_error($this->conn)); return $group_members; } @@ -1235,23 +1232,28 @@ class rcube_ldap extends rcube_addressbook // only fetch dn for count (should keep the payload low) $attrs = $count ? array('dn') : array_values($this->fieldmap); if ($this->ldap_result = @$function($this->conn, $this->base_dn, $filter, - $attrs, 0, (int)$this->prop['sizelimit'], (int)$this->prop['timelimit'])) - { + $attrs, 0, (int)$this->prop['sizelimit'], (int)$this->prop['timelimit']) + ) { // when running on a patched PHP we can use the extended functions to retrieve the total count from the LDAP search result - if ($this->vlv_active && function_exists('ldap_parse_virtuallist_control') && - ldap_parse_result($this->conn, $this->ldap_result, $errcode, $matcheddn, $errmsg, $referrals, $serverctrls)) { - ldap_parse_virtuallist_control($this->conn, $serverctrls, $last_offset, $this->vlv_count, $vresult); - $this->_debug("S: VLV result: last_offset=$last_offset; content_count=$this->vlv_count"); + if ($this->vlv_active && function_exists('ldap_parse_virtuallist_control')) { + if (ldap_parse_result($this->conn, $this->ldap_result, + $errcode, $matcheddn, $errmsg, $referrals, $serverctrls) + ) { + ldap_parse_virtuallist_control($this->conn, $serverctrls, + $last_offset, $this->vlv_count, $vresult); + $this->_debug("S: VLV result: last_offset=$last_offset; content_count=$this->vlv_count"); + } + else { + $this->_debug("S: ".($errmsg ? $errmsg : ldap_error($this->conn))); + } } - $this->_debug("S: ".ldap_count_entries($this->conn, $this->ldap_result)." record(s)"); - if ($err = ldap_errno($this->conn)) - $this->_debug("S: Error: " .ldap_err2str($err)); + $entries_count = ldap_count_entries($this->conn, $this->ldap_result); + $this->_debug("S: $entries_count record(s)"); - return $count ? ldap_count_entries($this->conn, $this->ldap_result) : true; + return $count ? $entries_count : true; } - else - { + else { $this->_debug("S: ".ldap_error($this->conn)); } } |
