From f3fa74302222a142165450a12fd69595960464de Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 6 Mar 2015 11:03:45 +0100 Subject: [PATCH] Fix login when using a PostgreSQL database as authentication backend fixes #8524 --- library/Icinga/Authentication/Backend/DbUserBackend.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/library/Icinga/Authentication/Backend/DbUserBackend.php b/library/Icinga/Authentication/Backend/DbUserBackend.php index 42322a575..12fa0392f 100644 --- a/library/Icinga/Authentication/Backend/DbUserBackend.php +++ b/library/Icinga/Authentication/Backend/DbUserBackend.php @@ -96,10 +96,15 @@ class DbUserBackend extends UserBackend 'SELECT password_hash FROM icingaweb_user WHERE name = :name AND active = 1' ); } + $stmt->execute(array(':name' => $username)); $stmt->bindColumn(1, $lob, PDO::PARAM_LOB); $stmt->fetch(PDO::FETCH_BOUND); - return is_resource($lob) ? stream_get_contents($lob) : $lob; + if (is_resource($lob)) { + $lob = stream_get_contents($lob); + } + + return $this->conn->getDbType() === 'pgsql' ? pg_unescape_bytea($lob) : $lob; } /**