From: Arthur Schiwon Date: Thu, 7 Jun 2012 11:36:34 +0000 (+0200) Subject: ldap: correct query condition and determining of success X-Git-Tag: v4.5.0beta1~74^2~423^2~15 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6894882ca95033882526306b6a6794f41706eec2;p=nextcloud-server.git ldap: correct query condition and determining of success --- diff --git a/apps/user_ldap/lib_ldap.php b/apps/user_ldap/lib_ldap.php index 6f4c0b0aad9..753243f2c4a 100644 --- a/apps/user_ldap/lib_ldap.php +++ b/apps/user_ldap/lib_ldap.php @@ -380,12 +380,22 @@ class OC_LDAP { SELECT 1 FROM '.$table.' WHERE ldap_dn = ? - AND owncloud_name = ? ) + OR owncloud_name = ? ) '); $res = $insert->execute(array($dn, $ocname, $dn, $ocname)); - return !OCP\DB::isError($res); + if(OCP\DB::isError($res)) { + return false; + } + + $insRows = $res->numRows(); + + if($insRows == 0) { + return false; + } + + return true; } static public function fetchListOfUsers($filter, $attr) {