auth_vpopmail_sql: wrap DB connect attempt in eval

This commit is contained in:
Matt Simerson 2014-09-15 13:32:52 -07:00
parent 7396dbbf5f
commit 0b38c21f40

View File

@ -94,8 +94,11 @@ sub get_db_handle {
my $dbuser = $self->qp->config("vpopmail_mysql_user") || "vpopmailuser"; my $dbuser = $self->qp->config("vpopmail_mysql_user") || "vpopmailuser";
my $dbpass = $self->qp->config("vpopmail_mysql_pass") || "vpoppasswd"; my $dbpass = $self->qp->config("vpopmail_mysql_pass") || "vpoppasswd";
my $dbh = DBI->connect($dsn, $dbuser, $dbpass) or do { my $dbh;
$self->log(LOGERROR, "skip: db connection failed"); eval { $dbh = DBI->connect($dsn, $dbuser, $dbpass); };
if (!$dbh) {
$self->log(LOGERROR, "skip: db connection failed: $!");
$self->log(LOGERROR, $@) if $@;
return; return;
}; };
$dbh->{ShowErrorStatement} = 1; $dbh->{ShowErrorStatement} = 1;