From 33e9399ba35b468131cfc25c62cdd961080b3c9c Mon Sep 17 00:00:00 2001
From: Arthur Schiwon <blizzz@owncloud.com>
Date: Mon, 1 Oct 2012 18:27:52 +0200
Subject: [PATCH] LDAP: fix sharing doesn't work with ldap groups, oc-1819

---
 apps/user_ldap/group_ldap.php | 2 +-
 apps/user_ldap/lib/access.php | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/apps/user_ldap/group_ldap.php b/apps/user_ldap/group_ldap.php
index 389679b80b..bd9f7e0c55 100644
--- a/apps/user_ldap/group_ldap.php
+++ b/apps/user_ldap/group_ldap.php
@@ -237,7 +237,7 @@ class GROUP_LDAP extends lib\Access implements \OCP\GroupInterface {
 		}
 
 		//getting dn, if false the group does not exist. If dn, it may be mapped only, requires more checking.
-		$dn = $this->username2dn($gid);
+		$dn = $this->groupname2dn($gid);
 		if(!$dn) {
 			$this->connection->writeToCache('groupExists'.$gid, false);
 			return false;
diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php
index d855ae2a16..66007d0953 100644
--- a/apps/user_ldap/lib/access.php
+++ b/apps/user_ldap/lib/access.php
@@ -123,7 +123,13 @@ abstract class Access {
 	 * returns the LDAP DN for the given internal ownCloud name of the group
 	 */
 	public function groupname2dn($name) {
-		return $this->ocname2dn($name, false);
+		$dn = $this->ocname2dn($name, false);
+
+		if($dn) {
+			return $dn;
+		}
+
+		return false;
 	}
 
 	/**
-- 
GitLab