diff --git a/docs/README b/docs/README --- a/docs/README +++ b/docs/README @@ -23,12 +23,12 @@ 1. Apache # for https://domain.tld (and https://autodiscover.domain.tld) -Alias /autodiscover/autodiscover.xml /usr/share/kolab-autodiscover/public_html -Alias /Autodiscover/Autodiscover.xml /usr/share/kolab-autodiscover/public_html -Alias /AutoDiscover/AutoDiscover.xml /usr/share/kolab-autodiscover/public_html +Alias /autodiscover/autodiscover.xml /usr/share/kolab-autodiscover/public_html/index.php +Alias /Autodiscover/Autodiscover.xml /usr/share/kolab-autodiscover/public_html/index.php +Alias /AutoDiscover/AutoDiscover.xml /usr/share/kolab-autodiscover/public_html/index.php # for http://autoconfig.domain.tld -Alias /mail/config-v1.1.xml /usr/share/kolab-autodiscover/public_html +Alias /mail/config-v1.1.xml /usr/share/kolab-autodiscover/public_html/index.php # for http://domain.tld -Alias /.well-known/autoconfig/mail/config-v1.1.xml /usr/share/kolab-autodiscover/public_html +Alias /.well-known/autoconfig/mail/config-v1.1.xml /usr/share/kolab-autodiscover/public_html/index.php 2. Add [autodiscover] section in /etc/kolab/kolab.conf (see sample kolab.conf.sample) diff --git a/docs/kolab-autoconf.conf b/docs/kolab-autoconf.conf --- a/docs/kolab-autoconf.conf +++ b/docs/kolab-autoconf.conf @@ -1,11 +1,19 @@ +# Force all requests to lowercase. Different MUAs, mobile devices etc +# request the Autodiscover URL in different cases. +RewriteEngine On +RewriteMap lc int:tolower +RewriteCond %{REQUEST_URI} !^/Microsoft +RewriteCond %{REQUEST_URI} [A-Z] +RewriteRule (.*) ${lc:$1} [R=301,L] + # for https://domain.tld (and https://autodiscover.domain.tld) -Alias /autodiscover/autodiscover.xml /usr/share/kolab-autoconf/public_html -Alias /Autodiscover/Autodiscover.xml /usr/share/kolab-autoconf/public_html -Alias /AutoDiscover/AutoDiscover.xml /usr/share/kolab-autoconf/public_html +Alias /autodiscover/autodiscover.xml /usr/share/kolab-autoconf/public_html/index.php + # for http://autoconfig.domain.tld -Alias /mail/config-v1.1.xml /usr/share/kolab-autoconf/public_html +Alias /mail/config-v1.1.xml /usr/share/kolab-autoconf/public_html/index.php + # for http://domain.tld -Alias /.well-known/autoconfig/mail/config-v1.1.xml /usr/share/kolab-autoconf/public_html +Alias /.well-known/autoconfig/mail/config-v1.1.xml /usr/share/kolab-autoconf/public_html/index.php AllowOverride None diff --git a/lib/AutodiscoverMicrosoft.php b/lib/AutodiscoverMicrosoft.php --- a/lib/AutodiscoverMicrosoft.php +++ b/lib/AutodiscoverMicrosoft.php @@ -52,12 +52,22 @@ // parse XML try { $xml = new SimpleXMLElement($post); + Log::debug(print_r($xml, true)); - if ($email = $xml->xpath('/Autodiscover/Request/EMailAddress')) { + foreach($xml->getDocNamespaces() as $strPrefix => $strNamespace) { + if(strlen($strPrefix)==0) { + $strPrefix="a"; //Assign an arbitrary namespace prefix. + } + $xml->registerXPathNamespace($strPrefix,$strNamespace); + } + + + + if ($email = $xml->xpath('//a:EMailAddress')) { $this->email = (string) array_shift($email); } - if ($schema = $xml->xpath('/Autodiscover/Request/AcceptableResponseSchema')) { + if ($schema = $xml->xpath('//a:AcceptableResponseSchema')) { $schema = (string) array_shift($schema); if (strpos($schema, 'mobilesync')) {