From: Brion Vibber Date: Thu, 16 Nov 2006 12:26:34 +0000 (+0000) Subject: add some debugging output to img_auth.php X-Git-Tag: 1.31.0-rc.0~55176 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=c3343c0f1af26713e04b68fdfca35997f284b21b;p=lhc%2Fweb%2Fwiklou.git add some debugging output to img_auth.php --- diff --git a/img_auth.php b/img_auth.php index cfe005e936..8794bc7869 100644 --- a/img_auth.php +++ b/img_auth.php @@ -12,31 +12,38 @@ wfProfileIn( 'img_auth.php' ); require_once( './includes/StreamFile.php' ); if( !isset( $_SERVER['PATH_INFO'] ) ) { + wfDebugLog( 'img_auth', "missing PATH_INFO" ); wfForbidden(); } # Get filenames/directories +wfDebugLog( 'img_auth', "PATH_INFO is: " . $_SERVER['PATH_INFO'] ); $filename = realpath( $wgUploadDirectory . $_SERVER['PATH_INFO'] ); $realUploadDirectory = realpath( $wgUploadDirectory ); $imageName = $wgContLang->getNsText( NS_IMAGE ) . ":" . wfBaseName( $_SERVER['PATH_INFO'] ); # Check if the filename is in the correct directory if ( substr( $filename, 0, strlen( $realUploadDirectory ) ) != $realUploadDirectory ) { + wfDebugLog( 'img_auth', "requested path not in upload dir: $filename" ); wfForbidden(); } if ( is_array( $wgWhitelistRead ) && !in_array( $imageName, $wgWhitelistRead ) && !$wgUser->getID() ) { + wfDebugLog( 'img_auth', "not logged in and requested file not in whitelist: $imageName" ); wfForbidden(); } if( !file_exists( $filename ) ) { + wfDebugLog( 'img_auth', "requested file does not exist: $filename" ); wfForbidden(); } if( is_dir( $filename ) ) { + wfDebugLog( 'img_auth', "requested file is a directory: $filename" ); wfForbidden(); } # Write file +wfDebugLog( 'img_auth', "streaming file: $filename" ); wfStreamFile( $filename ); wfLogProfilingData();