1
0
mirror of https://github.com/Yubico/yubikey-val.git synced 2025-03-05 06:29:36 +01:00

Refactor.

- check for empty request first,
	before opening up syslog.
This commit is contained in:
Jean Paul Galea 2015-07-16 23:44:35 +02:00
parent ea97dbf73d
commit d8e5a1324b

@ -36,18 +36,17 @@ $allowed = $baseParams['__YKVAL_ALLOWED_SYNC_POOL__'];
header('content-type: text/plain');
$myLog = new Log('ykval-sync');
$myLog->addField('ip', $ipaddr);
if (empty($_SERVER['QUERY_STRING'])) {
sendResp(S_MISSING_PARAMETER, $myLog);
}
$myLog = new Log('ykval-sync');
$myLog->addField('ip', $ipaddr);
$myLog->log(LOG_INFO, 'Request: ' . $_SERVER['QUERY_STRING']);
$myLog->log(LOG_DEBUG, 'Received request from ' . $ipaddr);
// verify request sent by whitelisted address
$myLog->log(LOG_DEBUG, 'Received request from ' . $ipaddr);
if (in_array($ipaddr, $allowed, TRUE) === FALSE) {
$myLog->log(LOG_NOTICE, 'Operation not allowed from IP ' . $ipaddr);
$myLog->log(LOG_DEBUG, 'Remote IP ' . $ipaddr . ' not listed in allowed sync pool : ' . implode(', ', $allowed));