aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2012-06-07 13:36:34 +0200
committerArthur Schiwon <blizzz@owncloud.com>2012-06-07 13:39:42 +0200
commit6894882ca95033882526306b6a6794f41706eec2 (patch)
tree804334570f28c8a351371a3383d10ce5515d1b08
parent470cb17f90840e9bb997d30c0e4575384fc5df72 (diff)
downloadnextcloud-server-6894882ca95033882526306b6a6794f41706eec2.tar.gz
nextcloud-server-6894882ca95033882526306b6a6794f41706eec2.zip
ldap: correct query condition and determining of success
-rw-r--r--apps/user_ldap/lib_ldap.php14
1 files changed, 12 insertions, 2 deletions
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) {