summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Auth
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2007-03-08 03:43:43 +0100
committermkanat%bugzilla.org <>2007-03-08 03:43:43 +0100
commitc423290c20a482c6984df52999eacf2a5242d7f3 (patch)
tree8978aca7f2bd8a582b32bf3b2ca9b003fdef739a /Bugzilla/Auth
parent558b05ca68f3987fa9020554b2170b6de8ad33f7 (diff)
downloadbugzilla-c423290c20a482c6984df52999eacf2a5242d7f3.tar.gz
bugzilla-c423290c20a482c6984df52999eacf2a5242d7f3.tar.xz
Bug 367480: [LDAP] Try a list of servers in order until we connect successfully
Patch By Tony Bajan <firefox@tonyb.me.uk> r=mkanat, a=mkanat
Diffstat (limited to 'Bugzilla/Auth')
-rw-r--r--Bugzilla/Auth/Verify/LDAP.pm13
1 files changed, 9 insertions, 4 deletions
diff --git a/Bugzilla/Auth/Verify/LDAP.pm b/Bugzilla/Auth/Verify/LDAP.pm
index 343f7952c..0176abdcb 100644
--- a/Bugzilla/Auth/Verify/LDAP.pm
+++ b/Bugzilla/Auth/Verify/LDAP.pm
@@ -37,6 +37,7 @@ use fields qw(
use Bugzilla::Constants;
use Bugzilla::Error;
+use Bugzilla::Util;
use Net::LDAP;
@@ -134,11 +135,15 @@ sub ldap {
my ($self) = @_;
return $self->{ldap} if $self->{ldap};
- my $server = Bugzilla->params->{"LDAPserver"};
- ThrowCodeError("ldap_server_not_defined") unless $server;
+ my @servers = split(/[\s,]+]/, Bugzilla->params->{"LDAPserver"});
+ ThrowCodeError("ldap_server_not_defined") unless @servers;
- $self->{ldap} = new Net::LDAP($server)
- || ThrowCodeError("ldap_connect_failed", { server => $server });
+ foreach (@servers) {
+ $self->{ldap} = new Net::LDAP(trim($_));
+ last if $self->{ldap};
+ }
+ ThrowCodeError("ldap_connect_failed", { server => join(", ", @servers) })
+ unless $self->{ldap};
# try to start TLS if needed
if (Bugzilla->params->{"LDAPstarttls"}) {