1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-12-19 15:01:14 +00:00

Merged r9755 from trunk.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/2.0-stable@9756 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-06-03 08:50:26 +00:00
parent b88c95b0fb
commit 5f23ebc31c

View File

@ -366,12 +366,19 @@ sub is_member {
); );
$sthldap->execute($auth_source_id); $sthldap->execute($auth_source_id);
while (my @rowldap = $sthldap->fetchrow_array) { 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( my $ldap = Authen::Simple::LDAP->new(
host => ($rowldap[2] eq "1" || $rowldap[2] eq "t") ? "ldaps://$rowldap[0]:$rowldap[1]" : $rowldap[0], host => ($rowldap[2] eq "1" || $rowldap[2] eq "t") ? "ldaps://$rowldap[0]:$rowldap[1]" : $rowldap[0],
port => $rowldap[1], port => $rowldap[1],
basedn => $rowldap[5], basedn => $rowldap[5],
binddn => $rowldap[3] ? $rowldap[3] : "", binddn => $bind_as,
bindpw => $rowldap[4] ? $rowldap[4] : "", bindpw => $bind_pw,
filter => "(".$rowldap[6]."=%s)" filter => "(".$rowldap[6]."=%s)"
); );
my $method = $r->method; my $method = $r->method;