Skip to content

Commit

Permalink
Setting the Password to an arbitrary value was dumb.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zegnat committed Nov 4, 2015
1 parent 85d8d10 commit 02928ff
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,27 @@

/**
* Double check if a password has been configured. If there has not and we are
* testing the server, exit with HTTP code 401. Otherwise treat it as an empty
* string.
* testing the server, exit with HTTP code 401.
*/
if (!isset($Password) || !is_string($Password)) {
if (
$testing &&
(
!isset($Password) ||
!is_string($Password)
)
) {
if ($testing) {
header($protocol . ' 401 Unauthorized');
exit();
}
$Password = '';
}

/**
* If the client did not submit a password, or the submitted password did not
* match this server's password, exit with HTTP code 403.
*/
if (
!isset($Password) ||
!isset($_POST['password']) ||
$_POST['password'] !== hash('sha512', $Password)
) {
Expand Down

0 comments on commit 02928ff

Please sign in to comment.