--- SQLBasedAddrList.pm.orig 2009-09-21 13:18:33.000000000 -0500 +++ SQLBasedAddrList.pm 2009-09-21 14:42:13.000000000 -0500 @@ -130,9 +130,28 @@ sub new_checker { my $dsn = $main->{conf}->{user_awl_dsn}; my $dbuser = $main->{conf}->{user_awl_sql_username}; my $dbpass = $main->{conf}->{user_awl_sql_password}; + + my $dbh; - my $dbh = DBI->connect($dsn, $dbuser, $dbpass, {'PrintError' => 0}); - + if( $dsn =~ /;/ ) { + ## + ## ok there's a semi-colon in there which means we're dealing + ## with multiple hosts + ## + my @multiple_dsns = split( /;/, $dsn); + dbg("auto-whitelist: sql-based: Multiple DSNs provided.:".$dsn); + for my $new_dsn (@multiple_dsns) { + $dbh = DBI->connect($new_dsn, $dbuser, $dbpass, {'PrintError' => 0}); + if (! $dbh) { + dbg("auto-whitelist: sql-based: Couldn't connect to dsn:$new_dsn.".DBI->errstr()); + } else { + last; + } + } + } else { + $dbh = DBI->connect($dsn, $dbuser, $dbpass, {'PrintError' => 0}); + } + if(!$dbh) { dbg("auto-whitelist: sql-based unable to connect to database ($dsn) : " . DBI::errstr); return undef;