From ff0fe8ebaf1461891e11d960b50f18ce411c28c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Sun, 10 Jul 2005 18:03:19 +0000 Subject: [PATCH] Support FastGCI in http auth (patch #1192219) --- ChangeLog | 6 +++++- libraries/auth/http.auth.lib.php | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4584ad4e5..63e402498 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ phpMyAdmin - Changelog $Id$ $Source$ +2005-07-10 Michal ÄŒihaÅ™ + * libraries/auth/http.auth.lib.php: Support FastGCI in http auth (patch + #1192219) + 2005-07-10 Marc Delisle * libraries/display_tbl.lib.php: bug #1235473 display_tbl.lib.php, Undefined variable order_img @@ -34,7 +38,7 @@ $Source$ instructions, thanks to Isaac Bennetch - ibennetch 2005-06-30 Marc Delisle - * lang/hungarian update, thanks to Mihály Mészáros + * lang/hungarian update, thanks to Mihály Mészáros * lang/japanese: updated, thanks to Tadashi Jokagi (elf2000) * lang/chinese_traditional: Updates, thanks to Siu Sun * lang/catalan update, thanks to Xavier Navarro (xavin). diff --git a/libraries/auth/http.auth.lib.php b/libraries/auth/http.auth.lib.php index bea056cdf..1dd070f82 100644 --- a/libraries/auth/http.auth.lib.php +++ b/libraries/auth/http.auth.lib.php @@ -186,8 +186,7 @@ function PMA_auth_check() } } // Gets authenticated user settings with IIS - if (empty($PHP_AUTH_USER) && empty($PHP_AUTH_PW) - && function_exists('base64_decode')) { + if (empty($PHP_AUTH_USER) && empty($PHP_AUTH_PW)) { if (!empty($HTTP_AUTHORIZATION) && substr($HTTP_AUTHORIZATION, 0, 6) == 'Basic ') { list($PHP_AUTH_USER, $PHP_AUTH_PW) = explode(':', base64_decode(substr($HTTP_AUTHORIZATION, 6))); @@ -203,6 +202,20 @@ function PMA_auth_check() } } // end IIS + // Gets authenticated user settings with FastCGI + // set FastCGI option '-pass-header Authorization' + if (empty($PHP_AUTH_USER) && empty($PHP_AUTH_PW)) { + if (!empty($_ENV) + && isset($_ENV['Authorization']) + && substr($_ENV['Authorization'], 0, 6) == 'Basic ') { + list($PHP_AUTH_USER, $PHP_AUTH_PW) = explode(':', base64_decode(substr($_ENV['Authorization'], 6))); + } + else if (@getenv('Authorization') + && substr(getenv('Authorization'), 0, 6) == 'Basic ') { + list($PHP_AUTH_USER, $PHP_AUTH_PW) = explode(':', base64_decode(substr(getenv('Authorization'), 6))); + } + } // end FastCGI + // User logged out -> ensure the new username is not the same if (!empty($old_usr) && (isset($PHP_AUTH_USER) && $old_usr == $PHP_AUTH_USER)) {