diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-06-03 08:49:46 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-06-03 08:49:46 +0000 |
commit | 3142183b3052b520126645eaec01526810e2afff (patch) | |
tree | 2a39c8ef9d10dcc9e07ea892bcb4e92e9ff858dd /extra/svn | |
parent | ba25d27e3ade01f0bb9fb4dee960caea823e81ca (diff) | |
download | redmine-3142183b3052b520126645eaec01526810e2afff.tar.gz redmine-3142183b3052b520126645eaec01526810e2afff.zip |
Fixed that Redmine.pm does not support "bind as user" ldap authentication (#11046).
Patch contributed by Adi Kriegisch.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9755 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'extra/svn')
-rw-r--r-- | extra/svn/Redmine.pm | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/extra/svn/Redmine.pm b/extra/svn/Redmine.pm index 3125d510e..fbaf177a3 100644 --- a/extra/svn/Redmine.pm +++ b/extra/svn/Redmine.pm @@ -366,12 +366,19 @@ sub is_member { ); $sthldap->execute($auth_source_id); while (my @rowldap = $sthldap->fetchrow_array) { + my $bind_as = $rowldap[3] ? $rowldap[3] : ""; + my $bind_pw = $rowldap[4] ? $rowldap[4] : ""; + if ($bind_as =~ m/\$login/) { + # replace $login with $redmine_user and use $redmine_pass + $bind_as =~ s/\$login/$redmine_user/g; + $bind_pw = $redmine_pass + } my $ldap = Authen::Simple::LDAP->new( host => ($rowldap[2] eq "1" || $rowldap[2] eq "t") ? "ldaps://$rowldap[0]:$rowldap[1]" : $rowldap[0], port => $rowldap[1], basedn => $rowldap[5], - binddn => $rowldap[3] ? $rowldap[3] : "", - bindpw => $rowldap[4] ? $rowldap[4] : "", + binddn => $bind_as, + bindpw => $bind_pw, filter => "(".$rowldap[6]."=%s)" ); my $method = $r->method; |