Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117800586
D565.1775267552.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D565.1775267552.diff
View Options
diff --git a/plugins/kolab_auth/kolab_auth_ldap.php b/plugins/kolab_auth/kolab_auth_ldap.php
--- a/plugins/kolab_auth/kolab_auth_ldap.php
+++ b/plugins/kolab_auth/kolab_auth_ldap.php
@@ -37,6 +37,9 @@
$this->conf = $p;
$this->conf['kolab_auth_user_displayname'] = $rcmail->config->get('kolab_auth_user_displayname', '{name}');
+ $this->conf['kolab_domain_name_attribute'] = $rcmail->config->get('kolab_domain_name_attribute', 'associateddomain');
+ $this->conf['kolab_domain_base_dn'] = $rcmail->config->get('kolab_domain_base_dn', 'cn=kolab,cn=config');
+ $this->conf['debug_level'] = $rcmail->config->get('debug_level', 0);
$this->fieldmap = $p['fieldmap'];
$this->fieldmap['uid'] = 'uid';
@@ -103,6 +106,48 @@
}
/**
+ * Get the mail address of the user uniquely identified with the UID, checking all domains available
+ */
+ function get_mail_of_user_across_domains($user, $filter)
+ {
+ $count = 0;
+ $mail = '';
+
+ if ($result = parent::search($this->conf['kolab_domain_base_dn'], '', '', array($this->conf['kolab_domain_name_attribute']))) {
+ if ($result->count() > 0) {
+ foreach ($result->entries(true) as $dn => $attrs) {
+ $domain = $attrs[$this->conf['kolab_domain_name_attribute']];
+ if (is_array($domain)) {
+ $dc = $this->domain_root_dn($domain[0]);
+ } else {
+ $dc = $this->domain_root_dn($domain);
+ }
+
+ // check if the user lives in this domain
+ if ($result2 = parent::search('ou=people,'.$dc, $filter, '', array('mail'))) {
+ $count += $result2->count();
+ if ($result2->count() == 1) {
+ $entries = $result2->entries(true);
+ $entry = array_pop($entries);
+ $mail = $entry['mail'];
+ }
+ }
+ }
+ }
+ }
+
+ if ($count == 1) {
+ if ($this->conf['debug_level'] > 0) {
+ rcube::console("Authentication: use mail address $mail for user with UID $user");
+ }
+ return $mail;
+ } else if ($count > 0) {
+ rcube::write_log('errors', "Authentication: found multiple users with UID $user, therefore cancelling login");
+ }
+ return False;
+ }
+
+ /**
* Fetches user data from LDAP addressbook
*/
function get_user_record($user, $host)
@@ -124,6 +169,10 @@
$entry = $this->field_mapping($dn, $entry);
return $entry;
+ } else {
+ if ($mail = $this->get_mail_of_user_across_domains($user, $filter)) {
+ return $this->get_user_record($mail, $host);
+ }
}
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 4, 1:52 AM (20 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18823979
Default Alt Text
D565.1775267552.diff (2 KB)
Attached To
Mode
D565: add patch for canonification in Roundcube. You can now authenticate with just the UID even if there are multiple domains. The condition is that the UID must be unique across the domains, otherwise the authentication will fail.
Attached
Detach File
Event Timeline