From ee385c93da32df2d6d956d537a4508f874679945 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Wed, 31 May 2006 04:17:34 +0000 Subject: Bug 320751: LDAP: Ability to have Bugzilla use the LDAP username directly as the Bugzilla username Patch By guillomovitch@zarb.org r=mkanat, a=myk --- Bugzilla/Auth/Verify/LDAP.pm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Auth/Verify/LDAP.pm b/Bugzilla/Auth/Verify/LDAP.pm index 848018549..dccfa0b7c 100644 --- a/Bugzilla/Auth/Verify/LDAP.pm +++ b/Bugzilla/Auth/Verify/LDAP.pm @@ -86,13 +86,18 @@ sub check_credentials { my $user_entry = $detail_result->shift_entry; my $mail_attr = Param("LDAPmailattribute"); - if (!$user_entry->exists($mail_attr)) { - return { failure => AUTH_ERROR, - error => "ldap_cannot_retreive_attr", - details => {attr => $mail_attr} }; + if ($mail_attr) { + if (!$user_entry->exists($mail_attr)) { + return { failure => AUTH_ERROR, + error => "ldap_cannot_retreive_attr", + details => {attr => $mail_attr} }; + } + + $params->{bz_username} = $user_entry->get_value($mail_attr); + } else { + $params->{bz_username} = $username; } - $params->{bz_username} = $user_entry->get_value($mail_attr); $params->{realname} ||= $user_entry->get_value("displayName"); $params->{realname} ||= $user_entry->get_value("cn"); -- cgit v1.2.3-24-g4f1b