diff -Nru postfixadmin-3.0.2/debian/changelog postfixadmin-3.0.2/debian/changelog --- postfixadmin-3.0.2/debian/changelog 2017-02-10 14:08:46.000000000 +0000 +++ postfixadmin-3.0.2/debian/changelog 2017-04-27 10:43:15.000000000 +0000 @@ -1,3 +1,11 @@ +postfixadmin (3.0.2-2) unstable; urgency=medium + + * fix mysql connection problems (closes: #861260) see: + https://github.com/postfixadmin/postfixadmin/issues/38 and + https://github.com/postfixadmin/postfixadmin/commit/6ee85ac6cc427392a1d37339e45a5dbb4b96461c + + -- Christoph Martin Thu, 27 Apr 2017 12:43:15 +0200 + postfixadmin (3.0.2-1) unstable; urgency=high [ David Goodwin ] diff -Nru postfixadmin-3.0.2/debian/patches/0002-dovecotpw.patch postfixadmin-3.0.2/debian/patches/0002-dovecotpw.patch --- postfixadmin-3.0.2/debian/patches/0002-dovecotpw.patch 2017-02-10 14:08:46.000000000 +0000 +++ postfixadmin-3.0.2/debian/patches/0002-dovecotpw.patch 2017-04-27 10:43:15.000000000 +0000 @@ -8,7 +8,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ --- a/config.inc.php +++ b/config.inc.php -@@ -150,7 +150,7 @@ $CONF['authlib_default_flavor'] = 'md5ra +@@ -165,7 +165,7 @@ $CONF['authlib_default_flavor'] = 'md5ra // for dovecot 1.x // $CONF['dovecotpw'] = "/usr/sbin/dovecotpw"; // for dovecot 2.x (dovecot 2.0.0 - 2.0.7 is not supported!) diff -Nru postfixadmin-3.0.2/debian/patches/0003-mysql-connection.patch postfixadmin-3.0.2/debian/patches/0003-mysql-connection.patch --- postfixadmin-3.0.2/debian/patches/0003-mysql-connection.patch 1970-01-01 00:00:00.000000000 +0000 +++ postfixadmin-3.0.2/debian/patches/0003-mysql-connection.patch 2017-04-27 10:43:15.000000000 +0000 @@ -0,0 +1,35 @@ +--- a/functions.inc.php ++++ b/functions.inc.php +@@ -1244,7 +1244,14 @@ function db_connect ($ignore_errors = 0) + global $DEBUG_TEXT; + if ($ignore_errors != 0) $DEBUG_TEXT = ''; + $error_text = ''; +- $link = 0; ++ ++ static $link; ++ if (isset($link) && $link) { ++ if ($ignore_errors) { ++ return array($link, $error_text); ++ } ++ return $link; ++ } $link = 0; + + if ($CONF['database_type'] == "mysql") { + if (function_exists ("mysql_connect")) { +@@ -1412,14 +1419,11 @@ function db_query ($query, $ignore_error + global $DEBUG_TEXT; + $result = ""; + $number_rows = ""; +- static $link; ++ $link = db_connect (); + $error_text = ""; + if ($ignore_errors) $DEBUG_TEXT = ""; + +- # mysql and pgsql $link are resources, mysqli $link is an object +- if (! (is_resource($link) || is_object($link) ) ) $link = db_connect (); +- +- if ($CONF['database_type'] == "mysql") $result = @mysql_query ($query, $link) ++ if ($CONF['database_type'] == "mysql") $result = @mysql_query ($query, $link) + or $error_text = "Invalid query: " . mysql_error($link); + if ($CONF['database_type'] == "mysqli") $result = @mysqli_query ($link, $query) + or $error_text = "Invalid query: " . mysqli_error($link); diff -Nru postfixadmin-3.0.2/debian/patches/series postfixadmin-3.0.2/debian/patches/series --- postfixadmin-3.0.2/debian/patches/series 2017-02-10 14:08:46.000000000 +0000 +++ postfixadmin-3.0.2/debian/patches/series 2017-04-27 10:43:15.000000000 +0000 @@ -1,2 +1,3 @@ 0001-db_credentials.patch 0002-dovecotpw.patch +0003-mysql-connection.patch