Some additional beautification

This commit is contained in:
Michael Vogel 2016-09-22 18:18:26 +00:00
parent abbf501602
commit 6fd54df940

View file

@ -152,7 +152,9 @@ class exAuth {
if (!isset($aCommand[1])) { if (!isset($aCommand[1])) {
$this->writeLog("[exAuth] invalid isuser command, no username given"); $this->writeLog("[exAuth] invalid isuser command, no username given");
fwrite(STDOUT, pack("nn", 2, 0)); fwrite(STDOUT, pack("nn", 2, 0));
} else { return;
}
// Now we check if the given user is valid // Now we check if the given user is valid
$sUser = str_replace(array("%20", "(a)"), array(" ", "@"), $aCommand[1]); $sUser = str_replace(array("%20", "(a)"), array(" ", "@"), $aCommand[1]);
$this->writeDebugLog("[debug] checking isuser for ". $sUser."@".$aCommand[2]); $this->writeDebugLog("[debug] checking isuser for ". $sUser."@".$aCommand[2]);
@ -166,6 +168,7 @@ class exAuth {
$r = q($sQuery); $r = q($sQuery);
$found = dbm::is_result($r); $found = dbm::is_result($r);
} }
if ($found) { if ($found) {
// The user is okay // The user is okay
$this->writeLog("[exAuth] valid user: ". $sUser); $this->writeLog("[exAuth] valid user: ". $sUser);
@ -176,7 +179,6 @@ class exAuth {
fwrite(STDOUT, pack("nn", 2, 0)); fwrite(STDOUT, pack("nn", 2, 0));
} }
} }
}
/** /**
* @brief Check remote user existance via HTTP(S) * @brief Check remote user existance via HTTP(S)
@ -218,7 +220,9 @@ class exAuth {
if (sizeof($aCommand) != 4) { if (sizeof($aCommand) != 4) {
$this->writeLog("[exAuth] invalid auth command, data missing"); $this->writeLog("[exAuth] invalid auth command, data missing");
fwrite(STDOUT, pack("nn", 2, 0)); fwrite(STDOUT, pack("nn", 2, 0));
} else { return;
}
// We now check if the password match // We now check if the password match
$sUser = str_replace(array("%20", "(a)"), array(" ", "@"), $aCommand[1]); $sUser = str_replace(array("%20", "(a)"), array(" ", "@"), $aCommand[1]);
$this->writeDebugLog("[debug] doing auth for ".$sUser."@".$aCommand[2]); $this->writeDebugLog("[debug] doing auth for ".$sUser."@".$aCommand[2]);
@ -243,6 +247,7 @@ class exAuth {
$Error = ($aCommand[3] != $oConfig[0]["v"]); $Error = ($aCommand[3] != $oConfig[0]["v"]);
} }
} }
if ($Error) { if ($Error) {
$this->writeLog("[exAuth] authentification failed for user ".$sUser."@". $aCommand[2]); $this->writeLog("[exAuth] authentification failed for user ".$sUser."@". $aCommand[2]);
fwrite(STDOUT, pack("nn", 2, 0)); fwrite(STDOUT, pack("nn", 2, 0));
@ -251,7 +256,6 @@ class exAuth {
fwrite(STDOUT, pack("nn", 2, 1)); fwrite(STDOUT, pack("nn", 2, 1));
} }
} }
}
/** /**
* @brief Check remote credentials via HTTP(S) * @brief Check remote credentials via HTTP(S)