[Web] Fix autodiscover triggering fail2ban implementation, fixes #1069
This commit is contained in:
parent
035b153445
commit
eb4dd632ae
@ -36,9 +36,8 @@ $opt = [
|
|||||||
$pdo = new PDO($dsn, $database_user, $database_pass, $opt);
|
$pdo = new PDO($dsn, $database_user, $database_pass, $opt);
|
||||||
$login_user = strtolower(trim($_SERVER['PHP_AUTH_USER']));
|
$login_user = strtolower(trim($_SERVER['PHP_AUTH_USER']));
|
||||||
$login_pass = trim(htmlspecialchars_decode($_SERVER['PHP_AUTH_PW']));
|
$login_pass = trim(htmlspecialchars_decode($_SERVER['PHP_AUTH_PW']));
|
||||||
$login_role = check_login($login_user, $login_pass);
|
|
||||||
|
|
||||||
if (!isset($_SERVER['PHP_AUTH_USER']) OR $login_role !== "user") {
|
if (empty($_SERVER['PHP_AUTH_USER']) || empty($_SERVER['PHP_AUTH_PW'])) {
|
||||||
try {
|
try {
|
||||||
$json = json_encode(
|
$json = json_encode(
|
||||||
array(
|
array(
|
||||||
@ -62,8 +61,9 @@ if (!isset($_SERVER['PHP_AUTH_USER']) OR $login_role !== "user") {
|
|||||||
header('HTTP/1.0 401 Unauthorized');
|
header('HTTP/1.0 401 Unauthorized');
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
|
$login_role = check_login($login_user, $login_pass);
|
||||||
|
|
||||||
if ($login_role === "user") {
|
if ($login_role === "user") {
|
||||||
header("Content-Type: application/xml");
|
header("Content-Type: application/xml");
|
||||||
echo '<?xml version="1.0" encoding="utf-8" ?>' . PHP_EOL;
|
echo '<?xml version="1.0" encoding="utf-8" ?>' . PHP_EOL;
|
||||||
@ -215,6 +215,4 @@ else {
|
|||||||
</Autodiscover>
|
</Autodiscover>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user