Commit ac81347e authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #128 in ZP/z-push from...

Merge pull request #128 in ZP/z-push from bugfix/ZP-766-outlook-sends-autodiscover-outlook to develop

* commit '289ed5cf':
  ZP-766 Accept outlook response schema on autodiscover, send XML response only for mobile response schema or empty otherwise.

(cherry picked from commit 4dba2866)
parent bc87cd1e
...@@ -58,7 +58,8 @@ include_once('../version.php'); ...@@ -58,7 +58,8 @@ include_once('../version.php');
include_once('config.php'); include_once('config.php');
class ZPushAutodiscover { class ZPushAutodiscover {
const ACCEPTABLERESPONSESCHEMA = 'http://schemas.microsoft.com/exchange/autodiscover/mobilesync/responseschema/2006'; const ACCEPTABLERESPONSESCHEMAMOBILESYNC = 'http://schemas.microsoft.com/exchange/autodiscover/mobilesync/responseschema/2006';
const ACCEPTABLERESPONSESCHEMAOUTLOOK = 'http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a';
const MAXINPUTSIZE = 8192; // Bytes, the autodiscover request shouldn't exceed that value const MAXINPUTSIZE = 8192; // Bytes, the autodiscover request shouldn't exceed that value
private static $instance; private static $instance;
...@@ -111,8 +112,11 @@ class ZPushAutodiscover { ...@@ -111,8 +112,11 @@ class ZPushAutodiscover {
$email = ($this->getAttribFromUserDetails($userDetails, 'emailaddress')) ? $this->getAttribFromUserDetails($userDetails, 'emailaddress') : $incomingXml->Request->EMailAddress; $email = ($this->getAttribFromUserDetails($userDetails, 'emailaddress')) ? $this->getAttribFromUserDetails($userDetails, 'emailaddress') : $incomingXml->Request->EMailAddress;
$userFullname = ($this->getAttribFromUserDetails($userDetails, 'fullname')) ? $this->getAttribFromUserDetails($userDetails, 'fullname') : $email; $userFullname = ($this->getAttribFromUserDetails($userDetails, 'fullname')) ? $this->getAttribFromUserDetails($userDetails, 'fullname') : $email;
ZLog::Write(LOGLEVEL_WBXML, sprintf("Resolved user's '%s' fullname to '%s'", $username, $userFullname)); ZLog::Write(LOGLEVEL_WBXML, sprintf("Resolved user's '%s' fullname to '%s'", $username, $userFullname));
$response = $this->createResponse($email, $userFullname); // At the moment Z-Push only supports mobile response schema for autodiscover. Send empty response if the client request outlook response schema.
setcookie("membername", $username); if ($incomingXml->Request->AcceptableResponseSchema == ZPushAutodiscover::ACCEPTABLERESPONSESCHEMAMOBILESYNC) {
$response = $this->createResponse($email, $userFullname);
setcookie("membername", $username);
}
} }
catch (AuthenticationRequiredException $ex) { catch (AuthenticationRequiredException $ex) {
...@@ -175,7 +179,7 @@ class ZPushAutodiscover { ...@@ -175,7 +179,7 @@ class ZPushAutodiscover {
throw new FatalException('Invalid input XML: no AcceptableResponseSchema.'); throw new FatalException('Invalid input XML: no AcceptableResponseSchema.');
} }
if ($xml->Request->AcceptableResponseSchema != ZPushAutodiscover::ACCEPTABLERESPONSESCHEMA) { if ($xml->Request->AcceptableResponseSchema != ZPushAutodiscover::ACCEPTABLERESPONSESCHEMAMOBILESYNC && $xml->Request->AcceptableResponseSchema != ZPushAutodiscover::ACCEPTABLERESPONSESCHEMAOUTLOOK) {
throw new FatalException('Invalid input XML: not a mobilesync responseschema.'); throw new FatalException('Invalid input XML: not a mobilesync responseschema.');
} }
...@@ -276,4 +280,4 @@ class ZPushAutodiscover { ...@@ -276,4 +280,4 @@ class ZPushAutodiscover {
} }
ZPushAutodiscover::DoZPushAutodiscover(); ZPushAutodiscover::DoZPushAutodiscover();
?> ?>
\ No newline at end of file
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