@@ -41,8 +41,7 class AuthSourceLdap < AuthSource | |||
|
41 | 41 | dn = String.new |
|
42 | 42 | ldap_con.search( :base => self.base_dn, |
|
43 | 43 | :filter => object_filter & login_filter, |
|
44 | # only ask for the DN if on-the-fly registration is disabled | |
|
45 | :attributes=> (onthefly_register? ? ['dn', self.attr_firstname, self.attr_lastname, self.attr_mail] : ['dn'])) do |entry| | |
|
44 | :attributes=> search_attributes) do |entry| | |
|
46 | 45 | dn = entry.dn |
|
47 | 46 | attrs = get_user_attributes_from_ldap_entry(entry) if onthefly_register? |
|
48 | 47 | logger.debug "DN found for #{login}: #{dn}" if logger && logger.debug? |
@@ -95,6 +94,16 class AuthSourceLdap < AuthSource | |||
|
95 | 94 | ] |
|
96 | 95 | end |
|
97 | 96 | |
|
97 | # Return the attributes needed for the LDAP search. It will only | |
|
98 | # include the user attributes if on-the-fly registration is enabled | |
|
99 | def search_attributes | |
|
100 | if onthefly_register? | |
|
101 | ['dn', self.attr_firstname, self.attr_lastname, self.attr_mail] | |
|
102 | else | |
|
103 | ['dn'] | |
|
104 | end | |
|
105 | end | |
|
106 | ||
|
98 | 107 | # Check if a DN (user record) authenticates with the password |
|
99 | 108 | def authenticate_dn(dn, password) |
|
100 | 109 | if dn.present? && password.present? |
General Comments 0
You need to be logged in to leave comments.
Login now