Support FastGCI in http auth (patch #1192219)

This commit is contained in:
Michal Čihař
2005-07-10 18:03:19 +00:00
parent 678a4a1c77
commit ff0fe8ebaf
2 changed files with 20 additions and 3 deletions

View File

@@ -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)) {