]> git.sur5r.net Git - bacula/bacula/commitdiff
baculum: Fix working with php-fpm
authorMarcin Haba <marcin.haba@bacula.pl>
Sun, 13 Dec 2015 16:50:02 +0000 (17:50 +0100)
committerMarcin Haba <marcin.haba@bacula.pl>
Sun, 13 Dec 2015 17:11:23 +0000 (18:11 +0100)
gui/baculum/protected/Class/BaculumAPI.php

index 67f5e22fa669af677cd367444e287d5b1942c9e6..94236f66899ed0a3807fbc6288ec23ddc7c6713c 100644 (file)
@@ -53,7 +53,11 @@ abstract class BaculumAPI extends TPage
                if(is_null($this->user) && $this->Application->getModule('configuration')->isApplicationConfig() === true) {
                        $appConfig = ConfigurationManager::getApplicationConfig();
                        // @TOFIX: Baculum API layer should not use $_SERVER variables.
-                       $this->user = isset($_SERVER['PHP_AUTH_USER']) && $_SERVER['PHP_AUTH_USER'] != $appConfig['baculum']['login'] ? $_SERVER['PHP_AUTH_USER'] : null;
+                       if (isset($_SERVER['PHP_AUTH_USER'])) {
+                               // NOTE: With php-fpm $_SERVER['PHP_AUTH_USER'] value is empty string here
+                               $user = trim($_SERVER['PHP_AUTH_USER']);
+                               $this->user = (!empty($user) && $user != $appConfig['baculum']['login']) ? $user : null;
+                       }
                }
 
                switch($_SERVER['REQUEST_METHOD']) {