Bugzilla – Attachment 123282 Details for
Bug 28780
Auth_with_ldap only searches tree with anon_bind
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Auth_with_ldap patch to add tree searching wtih service account
Auth_with_ldap_20210728.patch (text/plain), 2.12 KB, created by
Jerry Marceau
on 2021-07-29 13:14:38 UTC
(
hide
)
Description:
Auth_with_ldap patch to add tree searching wtih service account
Filename:
MIME Type:
Creator:
Jerry Marceau
Created:
2021-07-29 13:14:38 UTC
Size:
2.12 KB
patch
obsolete
>--- a/Auth_with_ldap.pm 2021-07-28 16:07:06.881785587 -0400 >+++ b/Auth_with_ldap.pm 2021-07-28 16:06:36.333919147 -0400 >@@ -126,7 +126,10 @@ > # first, LDAP authentication > if ( $ldap->{auth_by_bind} ) { > my $principal_name; >- if ( $config{anonymous} ) { >+ >+ # If anon bind, bind and search >+ >+ if ( $config{anonymous} ) { > > # Perform an anonymous bind > my $res = $db->bind; >@@ -134,14 +137,38 @@ > warn "Anonymous LDAP bind failed: " . description($res); > return 0; > } >- >+ > # Perform a LDAP search for the given username > my $search = search_method( $db, $userid ) >- or return 0; # warnings are in the sub >+ or return 0; # warnings are in the sub >+ $userldapentry = $search->shift_entry; >+ $principal_name = $userldapentry->dn; >+ } >+ # if not anon bind, but we have a service account, search wtih that. >+ # $ldapname is the service account, if that is defined we assume >+ # we search wtih that. >+ >+ elsif ($ldapname) { >+ >+ # Perform an authenticated bind with the service account >+ my $res = $db->bind($ldapname, password => $ldappassword); >+ if ( $res->code ) { >+ warn "Authenticated LDAP bind failed: " . description($res); >+ return 0; >+ } >+ >+ # Perform a LDAP search for the given username >+ my $search = search_method( $db, $userid ) >+ or return 0; # warnings are in the sub > $userldapentry = $search->shift_entry; > $principal_name = $userldapentry->dn; > } >- else { >+ >+ # And if we don't have a service account, we use principal_name to >+ # figoure out our base DN. Hope all our users are in the same OU. >+ >+ else { >+ > $principal_name = $ldap->{principal_name}; > if ( $principal_name and $principal_name =~ /\%/ ) { > $principal_name = sprintf( $principal_name, $userid );
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 28780
: 123282