Skip to content

Commit

Permalink
checkSendingAuthHeader is of no use anymore, since handling basic aut…
Browse files Browse the repository at this point in the history
…h has been removed entirely and the main logic has been commented because of problems anyway already. If it only sends a 403-header these days, all other checks are unnecessary and make unnecessary problems, so I've removed them and renamed the function. (websvnphp#84)

websvnphp#81
  • Loading branch information
ams-tschoening authored May 24, 2019
1 parent 72bc3cf commit 3a0956e
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 21 deletions.
2 changes: 1 addition & 1 deletion blame.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@

if (!$rep->hasReadAccess($path, false)) {
$vars['error'] = $lang['NOACCESS'];
checkSendingAuthHeader($rep);
sendHeaderForbidden();
}

} else {
Expand Down
2 changes: 1 addition & 1 deletion comp.php
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ function clearVars() {
}
if (count($restricted) && !count($listing)) {
$vars['error'] = $lang['NOACCESS'];
checkSendingAuthHeader($rep);
sendHeaderForbidden();
}
}

Expand Down
2 changes: 1 addition & 1 deletion diff.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@

if (!$rep->hasReadAccess($path, false)) {
$vars['error'] = $lang['NOACCESS'];
checkSendingAuthHeader($rep);
sendHeaderForbidden();
}

} else {
Expand Down
2 changes: 1 addition & 1 deletion filedetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@

if (!$rep->hasReadAccess($path)) {
$vars['error'] = $lang['NOACCESS'];
checkSendingAuthHeader($rep);
sendHeaderForbidden();
} else if (!$svnrep->isFile($path, $rev, $peg)) {
http_response_code(404);
$vars['error'] = $lang['NOPATH'];
Expand Down
14 changes: 3 additions & 11 deletions include/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

$contentType = array(
'.dwg' => 'application/acad', // AutoCAD Drawing files
'.arj' => 'application/arj', //  
'.arj' => 'application/arj', //
'.ccad' => 'application/clariscad', // ClarisCAD files
'.drw' => 'application/drafting', // MATRA Prelude drafting
'.dxf' => 'application/dxf', // DXF (AutoCAD)
Expand All @@ -68,7 +68,7 @@
'.wri' => 'application/mswrite', // Microsoft Write
'.bin' => 'application/octet-stream', // Uninterpreted binary
'.exe' => 'application/x-msdownload', // Windows EXE
'.oda' => 'application/oda', //  
'.oda' => 'application/oda', //
'.pdf' => 'application/pdf', // PDF (Adobe Acrobat)
'.ai' => 'application/postscript', // PostScript
'.ps' => 'application/postscript', // PostScript
Expand Down Expand Up @@ -557,14 +557,6 @@ function createRevisionSelectionForm() {
$vars['revision_endform'] = '</form>';
}

function checkSendingAuthHeader($rep = false) {
global $config;
$authz = null;
if ($rep) {
$authz =& $rep->getAuthz();
} else {
$authz =& $config->getAuthz();
}
$loggedin = $authz->hasUsername();
function sendHeaderForbidden() {
http_response_code(403);
}
4 changes: 2 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
if ($config->showLastModInIndex()) {
$svnrep = new SVNRepository($project);
$log = $svnrep->getLog('/', '', '', true, 1);

if (isset($log->entries[0])) {
$head = $log->entries[0];
$listvar['revision'] = $head->rev;
Expand Down Expand Up @@ -107,7 +107,7 @@

if (empty($listing) && !empty($projects)) {
$vars['error'] = $lang['NOACCESS'];
checkSendingAuthHeader();
sendHeaderForbidden();
}

$vars['flatview'] = $config->flatIndex;
Expand Down
2 changes: 1 addition & 1 deletion listing.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ function showTreeDir($svnrep, $path, $rev, $peg, $listing) {

if (!$rep->hasReadAccess($path)) {
$vars['error'] = $lang['NOACCESS'];
checkSendingAuthHeader($rep);
sendHeaderForbidden();
}
$vars['restricted'] = !$rep->hasReadAccess($path, false);

Expand Down
2 changes: 1 addition & 1 deletion log.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ function removeAccents($string) {

if (!$rep->hasReadAccess($path, false)) {
$vars['error'] = $lang['NOACCESS'];
checkSendingAuthHeader($rep);
sendHeaderForbidden();
}

} else {
Expand Down
4 changes: 2 additions & 2 deletions revision.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,13 @@
}

if (isset($prevRev)) {
$vars['compareurl'] = $config->getURL($rep, '', 'comp').'compare[]='.urlencode($prevPath).'@'.$prevRev. '&amp;compare[]='.urlencode($path).'@'.$rev;
$vars['compareurl'] = $config->getURL($rep, '', 'comp').'compare[]='.urlencode($prevPath).'@'.$prevRev. '&amp;compare[]='.urlencode($path).'@'.$rev;
$vars['comparelink'] = '<a href="'.$vars['compareurl'].'">'.$lang['DIFFPREV'].'</a>';
}

if (!$rep->hasReadAccess($path)) {
$vars['error'] = $lang['NOACCESS'];
checkSendingAuthHeader($rep);
sendHeaderForbidden();
}
$vars['restricted'] = !$rep->hasReadAccess($path, false);

Expand Down

0 comments on commit 3a0956e

Please sign in to comment.