Commit 57d9a6a9317395ebe837d1fe64b684640a4b3a8c
1 parent
e0e003c5
KTS-1732
"RSS auth not authenticating correct user details. " Fixed. Reviewed By: Conrad git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@6340 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
17 additions
and
0 deletions
rss.php
| @@ -19,6 +19,23 @@ require_once(KT_LIB_DIR . "/browse/browseutil.inc.php"); | @@ -19,6 +19,23 @@ require_once(KT_LIB_DIR . "/browse/browseutil.inc.php"); | ||
| 19 | 19 | ||
| 20 | require_once(KT_LIB_DIR . '/mime.inc.php'); | 20 | require_once(KT_LIB_DIR . '/mime.inc.php'); |
| 21 | 21 | ||
| 22 | +// workaround to get http authentication working in cgi mode | ||
| 23 | +$altinfo = KTUtil::arrayGet( $_SERVER, 'kt_auth', KTUtil::arrayGet( $_SERVER, 'REDIRECT_kt_auth')); | ||
| 24 | +if ( !empty( $altinfo) && !isset( $_SERVER['PHP_AUTH_USER'])) { | ||
| 25 | + $val = $altinfo; | ||
| 26 | + $pieces = explode( ' ', $val); // bad. | ||
| 27 | + if ( $pieces[0] == 'Basic') { | ||
| 28 | + $chunk = $pieces[1]; | ||
| 29 | + $decoded = base64_decode( $chunk); | ||
| 30 | + $credential_info = explode( ':', $decoded); | ||
| 31 | + if ( count( $credential_info) == 2) { | ||
| 32 | + $_SERVER['PHP_AUTH_USER'] = $credential_info[0]; | ||
| 33 | + $_SERVER['PHP_AUTH_PW'] = $credential_info[1]; | ||
| 34 | + $_SERVER["AUTH_TYPE"] = 'Basic'; | ||
| 35 | + } | ||
| 36 | + } | ||
| 37 | +} | ||
| 38 | + | ||
| 22 | if (!validateUser($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])) { | 39 | if (!validateUser($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])) { |
| 23 | header('WWW-Authenticate: Basic realm="KnowledgeTree DMS"'); | 40 | header('WWW-Authenticate: Basic realm="KnowledgeTree DMS"'); |
| 24 | header('HTTP/1.0 401 Unauthorized'); | 41 | header('HTTP/1.0 401 Unauthorized'); |