Bugzilla – Attachment 4069 Details for
Bug 4993
ldap search always anonymous when using auth_by_bind
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Signed off patch
0001-Bug-4993-checkpw_ldap-do-bind-just-once.patch (text/plain), 1.95 KB, created by
Chris Cormack
on 2011-05-09 21:59:26 UTC
(
hide
)
Description:
Signed off patch
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2011-05-09 21:59:26 UTC
Size:
1.95 KB
patch
obsolete
>From e60ec6bb70f705a7868927797683a4c53e5f408e Mon Sep 17 00:00:00 2001 >From: Dobrica Pavlinusic <dpavlin@rot13.org> >Date: Tue, 13 Jul 2010 20:48:41 +0200 >Subject: [Signed Off] [PATCH] Bug 4993 checkpw_ldap - do bind just once > >When using auth_by_bind, search was always done as anonymous user. >This is a problem if we want to fetch LDAP values which have ACL >permissions only for users. > >This change moves bind from search_method back into checkpw_ldap, >making code cleaner and easier to understand > >Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> >--- > C4/Auth_with_ldap.pm | 10 +++++----- > 1 files changed, 5 insertions(+), 5 deletions(-) > >diff --git a/C4/Auth_with_ldap.pm b/C4/Auth_with_ldap.pm >index acbd923..3613acf 100644 >--- a/C4/Auth_with_ldap.pm >+++ b/C4/Auth_with_ldap.pm >@@ -82,11 +82,6 @@ sub search_method { > my $userid = shift or return; > my $uid_field = $mapping{userid}->{is} or die ldapserver_error("mapping for 'userid'"); > my $filter = Net::LDAP::Filter->new("$uid_field=$userid") or die "Failed to create new Net::LDAP::Filter"; >- my $res = ($config{anonymous}) ? $db->bind : $db->bind($ldapname, password=>$ldappassword); >- if ($res->code) { # connection refused >- warn "LDAP bind failed as ldapuser " . ($ldapname || '[ANONYMOUS]') . ": " . description($res); >- return 0; >- } > my $search = $db->search( > base => $base, > filter => $filter, >@@ -128,6 +123,11 @@ sub checkpw_ldap { > $userldapentry = $search->shift_entry; > > } else { >+ my $res = ($config{anonymous}) ? $db->bind : $db->bind($ldapname, password=>$ldappassword); >+ if ($res->code) { # connection refused >+ warn "LDAP bind failed as ldapuser " . ($ldapname || '[ANONYMOUS]') . ": " . description($res); >+ return 0; >+ } > my $search = search_method($db, $userid) or return 0; # warnings are in the sub > $userldapentry = $search->shift_entry; > my $cmpmesg = $db->compare( $userldapentry, attr=>'userpassword', value => $password ); >-- >1.7.4.1 >
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 4993
:
2357
| 4069