Commit 1e065092 authored by mku's avatar mku

ZP-562 #comment Improve autodiscover logging

git-svn-id: https://z-push.org/svn/z-push/trunk@1920 b7dd7b3b-3a3c-0410-9da9-bee62a6cc5b5
parent 85ad1da1
...@@ -114,7 +114,12 @@ class ZPushAutodiscover { ...@@ -114,7 +114,12 @@ class ZPushAutodiscover {
} }
catch (AuthenticationRequiredException $ex) { catch (AuthenticationRequiredException $ex) {
ZLog::Write(LOGLEVEL_ERROR, sprintf("Unable to complete autodiscover because login failed for user with email '%s'", $incomingXml->Request->EMailAddress)); if (isset($incomingXml)) {
ZLog::Write(LOGLEVEL_ERROR, sprintf("Unable to complete autodiscover because login failed for user with email '%s'", $incomingXml->Request->EMailAddress));
}
else {
ZLog::Write(LOGLEVEL_ERROR, sprintf("Unable to complete autodiscover incorrect request: '%s'", $ex->getMessage()));
}
header('HTTP/1.1 401 Unauthorized'); header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Basic realm="ZPush"'); header('WWW-Authenticate: Basic realm="ZPush"');
http_response_code(401); http_response_code(401);
...@@ -152,6 +157,10 @@ class ZPushAutodiscover { ...@@ -152,6 +157,10 @@ class ZPushAutodiscover {
$input = @file_get_contents('php://input'); $input = @file_get_contents('php://input');
$xml = simplexml_load_string($input); $xml = simplexml_load_string($input);
if (LOGLEVEL >= LOGLEVEL_WBXML) {
ZLog::Write(LOGLEVEL_WBXML, sprintf("ZPushAutodiscover->getIncomingXml() incoming XML data:%s%s", PHP_EOL, $xml->asXML()));
}
if (!isset($xml->Request->EMailAddress)) { if (!isset($xml->Request->EMailAddress)) {
throw new FatalException('Invalid input XML: no email address.'); throw new FatalException('Invalid input XML: no email address.');
} }
...@@ -168,9 +177,7 @@ class ZPushAutodiscover { ...@@ -168,9 +177,7 @@ class ZPushAutodiscover {
if ($xml->Request->AcceptableResponseSchema != ZPushAutodiscover::ACCEPTABLERESPONSESCHEMA) { if ($xml->Request->AcceptableResponseSchema != ZPushAutodiscover::ACCEPTABLERESPONSESCHEMA) {
throw new FatalException('Invalid input XML: not a mobilesync responseschema.'); throw new FatalException('Invalid input XML: not a mobilesync responseschema.');
} }
if (LOGLEVEL >= LOGLEVEL_WBXML) {
ZLog::Write(LOGLEVEL_WBXML, sprintf("ZPushAutodiscover->getIncomingXml() incoming XML data:%s%s", PHP_EOL, $xml->asXML()));
}
return $xml; return $xml;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment