Commit bc7387355f7de205906e616aa712e809bf2deb38
1 parent
4c2facdd
Added workaround for mod_auth with php in cgi mode
PT: 1627005 Committed by: Megan Watson
Showing
4 changed files
with
20 additions
and
1 deletions
.htaccess
| @@ -95,6 +95,11 @@ php_value max_execution_time 0 | @@ -95,6 +95,11 @@ php_value max_execution_time 0 | ||
| 95 | php_value error_reporting 5 | 95 | php_value error_reporting 5 |
| 96 | </IfModule> | 96 | </IfModule> |
| 97 | 97 | ||
| 98 | +# Workaround for mod_auth when running php cgi | ||
| 99 | +<IfModule mod_rewrite.c> | ||
| 100 | +RewriteEngine on | ||
| 101 | +RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] | ||
| 102 | +</IfModule> | ||
| 98 | 103 | ||
| 99 | #<IfModule mod_rewrite.c> | 104 | #<IfModule mod_rewrite.c> |
| 100 | #RewriteEngine On | 105 | #RewriteEngine On |
ktwebdav/lib/KTWebDAVServer.inc.php
| @@ -372,6 +372,11 @@ class KTWebDAVServer extends HTTP_WebDAV_Server | @@ -372,6 +372,11 @@ class KTWebDAVServer extends HTTP_WebDAV_Server | ||
| 372 | { | 372 | { |
| 373 | $this->ktwebdavLog('Entering _check_auth...', 'info', true); | 373 | $this->ktwebdavLog('Entering _check_auth...', 'info', true); |
| 374 | 374 | ||
| 375 | + // Workaround for mod_auth when running php cgi | ||
| 376 | + if(!isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['HTTP_AUTHORIZATION'])){ | ||
| 377 | + list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':' , base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6))); | ||
| 378 | + } | ||
| 379 | + | ||
| 375 | if (method_exists($this, 'checkAuth')) { | 380 | if (method_exists($this, 'checkAuth')) { |
| 376 | // PEAR style method name | 381 | // PEAR style method name |
| 377 | return $this->checkAuth(@$_SERVER['AUTH_TYPE'], | 382 | return $this->checkAuth(@$_SERVER['AUTH_TYPE'], |
rss.php
| @@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
| 5 | * KnowledgeTree Community Edition | 5 | * KnowledgeTree Community Edition |
| 6 | * Document Management Made Simple | 6 | * Document Management Made Simple |
| 7 | * Copyright (C) 2008, 2009 KnowledgeTree Inc. | 7 | * Copyright (C) 2008, 2009 KnowledgeTree Inc. |
| 8 | - * | 8 | + * |
| 9 | * | 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify it under | 10 | * This program is free software; you can redistribute it and/or modify it under |
| 11 | * the terms of the GNU General Public License version 3 as published by the | 11 | * the terms of the GNU General Public License version 3 as published by the |
| @@ -40,6 +40,9 @@ require_once(KT_LIB_DIR .'/authentication/DBAuthenticator.inc'); | @@ -40,6 +40,9 @@ require_once(KT_LIB_DIR .'/authentication/DBAuthenticator.inc'); | ||
| 40 | require_once(KT_LIB_DIR .'/authentication/authenticationutil.inc.php'); | 40 | require_once(KT_LIB_DIR .'/authentication/authenticationutil.inc.php'); |
| 41 | require_once(KT_DIR. '/plugins/rssplugin/KTrss.inc.php'); | 41 | require_once(KT_DIR. '/plugins/rssplugin/KTrss.inc.php'); |
| 42 | 42 | ||
| 43 | +// Workaround for mod_auth when running php cgi | ||
| 44 | +list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':' , base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6))); | ||
| 45 | + | ||
| 43 | // workaround to get http authentication working in cgi mode | 46 | // workaround to get http authentication working in cgi mode |
| 44 | $altinfo = KTUtil::arrayGet( $_SERVER, 'kt_auth', KTUtil::arrayGet( $_SERVER, 'REDIRECT_kt_auth')); | 47 | $altinfo = KTUtil::arrayGet( $_SERVER, 'kt_auth', KTUtil::arrayGet( $_SERVER, 'REDIRECT_kt_auth')); |
| 45 | if ( !empty( $altinfo) && !isset( $_SERVER['PHP_AUTH_USER'])) { | 48 | if ( !empty( $altinfo) && !isset( $_SERVER['PHP_AUTH_USER'])) { |
webservice/classes/atompub/KT_atom_HTTPauth.inc.php
| 1 | <?php | 1 | <?php |
| 2 | class KT_atom_HTTPauth{ | 2 | class KT_atom_HTTPauth{ |
| 3 | public static function getCredentials(){ | 3 | public static function getCredentials(){ |
| 4 | + | ||
| 5 | + // Workaround for mod_auth when running php cgi | ||
| 6 | + if(!isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['HTTP_AUTHORIZATION'])){ | ||
| 7 | + list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':' , base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6))); | ||
| 8 | + } | ||
| 9 | + | ||
| 4 | $credentials=array('user'=>'','pass'=>'','method'=>''); | 10 | $credentials=array('user'=>'','pass'=>'','method'=>''); |
| 5 | if(isset($_SERVER['PHP_AUTH_USER'])){ | 11 | if(isset($_SERVER['PHP_AUTH_USER'])){ |
| 6 | $credentials['user']=$_SERVER['PHP_AUTH_USER']; | 12 | $credentials['user']=$_SERVER['PHP_AUTH_USER']; |