[Pkg-owncloud-commits] [owncloud] 24/27: memberOf resembles a DN as well and is actively used

David Prévot taffit at moszumanska.debian.org
Wed Oct 28 17:03:07 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v8.1.4RC2
in repository owncloud.

commit 9f3ea9116efcb559b7c8f6899d22c22b8a985235
Author: Arthur Schiwon <blizzz at owncloud.com>
Date:   Mon Sep 28 18:38:57 2015 +0200

    memberOf resembles a DN as well and is actively used
    
    Conflicts:
    	apps/user_ldap/tests/access.php
---
 apps/user_ldap/lib/access.php   |  4 +++-
 apps/user_ldap/tests/access.php | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php
index 483ca23..81b0974 100644
--- a/apps/user_ldap/lib/access.php
+++ b/apps/user_ldap/lib/access.php
@@ -215,7 +215,9 @@ class Access extends LDAPUtility implements user\IUserTools {
 		$resemblingAttributes = array(
 			'dn',
 			'uniquemember',
-			'member'
+			'member',
+			// memberOf is an "operational" attribute, without a definition in any RFC
+			'memberof'
 		);
 		return in_array($attr, $resemblingAttributes);
 	}
diff --git a/apps/user_ldap/tests/access.php b/apps/user_ldap/tests/access.php
index 5c53572..74615ce 100644
--- a/apps/user_ldap/tests/access.php
+++ b/apps/user_ldap/tests/access.php
@@ -270,4 +270,38 @@ class Test_Access extends \Test\TestCase {
 
 		$access->batchApplyUserAttributes($data);
 	}
+
+	public function dNAttributeProvider() {
+		// corresponds to Access::resemblesDN()
+		return array(
+			'dn' => array('dn'),
+			'uniqueMember' => array('uniquemember'),
+			'member' => array('member'),
+			'memberOf' => array('memberof')
+		);
+	}
+
+	/**
+	 * @dataProvider dNAttributeProvider
+	 */
+	public function testSanitizeDN($attribute) {
+		list($lw, $con, $um) = $this->getConnecterAndLdapMock();
+
+
+		$dnFromServer = 'cn=Mixed Cases,ou=Are Sufficient To,ou=Test,dc=example,dc=org';
+
+		$lw->expects($this->any())
+			->method('isResource')
+			->will($this->returnValue(true));
+
+		$lw->expects($this->any())
+			->method('getAttributes')
+			->will($this->returnValue(array(
+				$attribute => array('count' => 1, $dnFromServer)
+			)));
+
+		$access = new Access($con, $lw, $um);
+		$values = $access->readAttribute('uid=whoever,dc=example,dc=org', $attribute);
+		$this->assertSame($values[0], strtolower($dnFromServer));
+	}
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list