Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-10-28 13:09:01 +0300
committerThomas Müller <thomas.mueller@tmit.eu>2015-10-28 13:09:01 +0300
commit8e0cddbe017826b2daf69a2ba1b0d43fec9bb88d (patch)
treed151f2bc2c08819c83f810b472fd22ab4274ceb4
parent3387d05ca9e512b330b5879afd9f5d5583c04aa4 (diff)
parent3bad2ac1e5961a453099714c10c46681c354234f (diff)
Merge pull request #19512 from owncloud/backport-19419-stable8.1
[backport] [stable8.1] memberOf resembles a DN as well and is actively used
-rw-r--r--apps/user_ldap/lib/access.php4
-rw-r--r--apps/user_ldap/tests/access.php33
2 files changed, 36 insertions, 1 deletions
diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php
index 483ca232277..81b09740f87 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 5c535720fec..c7246dcb035 100644
--- a/apps/user_ldap/tests/access.php
+++ b/apps/user_ldap/tests/access.php
@@ -270,4 +270,37 @@ 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->getConnectorAndLdapMock();
+
+ $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));
+ }
}