Modify

Opened 3 years ago

Closed 20 months ago

Last modified 20 months ago

#11361 closed defect (fixed)

name_attr ldap field is not being caught properly

Reported by: Estopero Owned by: branson
Priority: normal Component: DirectoryAuthPlugin
Severity: normal Keywords: ldap, custom fields
Cc: Trac Release: 1.0

Description (last modified by Ryan J Ollos)

First of all thanks for the plugin, is being very useful for us :)

I think some custom fields are not being caught properly, we are using openLDAP and these are our three fields for user, name and email:

[account-manager]
user_attr = uid
name_attr = cn
email_attr = mail

The user_attr is rightly mapped, and I think the email_attr field works because is similar to the ActiveDirectory one, however the name_attr is not being defined and is empty in the user list panel.

I think the problem is that the "displayName" is hardcoded in the attr list

auth.py: line 121
def check_password(self, user, password):
...
attrs = [ self.user_attr, 'mail', 'proxyAddress', 'displayName']
...
userinfo = self._get_userinfo(users[0][1])

directoryauthplugin/trunk/tracext/dirauth/auth.py@13391#L121

And in the _get_userinfo function you are looking for a attr field that will never exist if is not called "displayName":

auth.py: line 294
def _get_userinfo(self, attrs):
...
displayname = attrs.get(self.name_attr, [''])[0]

directoryauthplugin/trunk/tracext/dirauth/auth.py@13391#L294

I'm not a python developer so I'm not sure if this is being the problem but could be. What do you think? :)

Thanks and great work

Attachments (0)

Change History (5)

comment:1 Changed 3 years ago by Estopero

To solve the name_attr mapping issue is enough changing in the linea 121 of auth.py

attrs = [ self.user_attr, 'mail', 'proxyAddress', 'displayName']

by

attrs = [ self.user_attr, 'mail', 'proxyAddress', self.name_attr]

Probably the same happens with 'mail' but didn't try.

I've tried to do a commit but I have no permissions :). sandinak, Would you mind to fix it?

Thanks!

comment:2 Changed 3 years ago by Ryan J Ollos

Description: modified (diff)

comment:3 Changed 20 months ago by bebbo

In 14830:

refs #12068
refs #11686
refs #11361
refs #11307
refs #11304
refs #10878
refs #10715
refs #10667
refs #10632
refs #10631
refs #11015

various fixes

comment:4 Changed 20 months ago by bebbo

Resolution: fixed
Status: newclosed

added (and extended) the suggested fix.

comment:5 Changed 20 months ago by bebbo

In 14831:

refs #11361

fixed 2nd occurance

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain branson.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.