[PATCH] added vpopmail_sql db connect error handling.

[email protected] (Matt Simerson)
Newsgroups perl.qpsmtpd
Message-ID <[email protected]>
added vpopmail_sql db connect error handling.

---
plugins/auth/auth_vpopmail_sql |    6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/plugins/auth/auth_vpopmail_sql b/plugins/auth/auth_vpopmail_sql
index 99b4f1d..1f9e302 100644
--- a/plugins/auth/auth_vpopmail_sql
+++ b/plugins/auth/auth_vpopmail_sql
@@ -84,8 +84,10 @@ sub auth_vmysql {
    my $dbuser = $self->qp->config("vpopmail_mysql_user") || "vpopmailuser";
    my $dbpass = $self->qp->config("vpopmail_mysql_pass") || "vpoppasswd";

-    my $dbh = DBI->connect( $dsn, $dbuser, $dbpass );
-
+    my $dbh = DBI->connect( $dsn, $dbuser, $dbpass ) or do {
+            $self->log(LOGERROR, "auth_vpopmail_sql: db connection failed");
+            return DECLINED;
+        };
    $dbh->{ShowErrorStatement} = 1;

    my ( $pw_name, $pw_domain ) = split '@', lc($user);
-- 
1.7.9.6
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.