From f7d2dfd1c07ce7b1e39cb9c58c2518ca7823d553 Mon Sep 17 00:00:00 2001 From: jkaberg Date: Tue, 19 Aug 2014 11:27:50 +0200 Subject: [PATCH 1/5] xml generation fails when short_open_tag is on --- conf/nginx.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/conf/nginx.conf b/conf/nginx.conf index 0099274e..49fe8655 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -62,6 +62,7 @@ server { location /autodiscover/autodiscover.xml { include fastcgi_params; fastcgi_param SCRIPT_FILENAME /usr/local/bin/mailinabox-exchange-autodiscover.php; + fastcgi_param PHP_VALUE "short_open_tag=Off"; fastcgi_pass php-fpm; } From 3f5f95a6333201a84e2f8a4cc1295f2288dbe0c6 Mon Sep 17 00:00:00 2001 From: jkaberg Date: Tue, 19 Aug 2014 11:31:54 +0200 Subject: [PATCH 2/5] fix preg_match and move up xml line --- tools/exchange-autodiscover.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/exchange-autodiscover.php b/tools/exchange-autodiscover.php index 77b0b966..07803762 100755 --- a/tools/exchange-autodiscover.php +++ b/tools/exchange-autodiscover.php @@ -11,15 +11,14 @@ // We might get two kinds of requests. $post_body = file_get_contents('php://input'); - preg_match('/(.*?)<\/AcceptableResponseSchema>/', $post_body, $match); + $match = preg_match('/(.*?)<\/AcceptableResponseSchema>/', $post_body, $match); $AcceptableResponseSchema = $match[1]; if ($AcceptableResponseSchema == "http://schemas.microsoft.com/exchange/autodiscover/mobilesync/responseschema/2006") { // There is no way to convey the user's login name with this? ?> - + @@ -40,7 +39,7 @@ xmlns:autodiscover="http://schemas.microsoft.com/exchange/autodiscover/mobilesyn // Parse the email address out of the POST request, which // we pass back as the login name. - preg_match('/(.*?)<\/EMailAddress>/', $post_body, $match); + $match = preg_match('/(.*?)<\/EMailAddress>/', $post_body, $match); $LOGIN = $match[1]; header("Content-type: text/xml"); From da17466526b606b87cc115a515677f47b75a79dc Mon Sep 17 00:00:00 2001 From: jkaberg Date: Tue, 19 Aug 2014 11:37:20 +0200 Subject: [PATCH 3/5] fix undefined index error in webfinger --- tools/webfinger.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/webfinger.php b/tools/webfinger.php index 9fffbca0..91ea03e7 100755 --- a/tools/webfinger.php +++ b/tools/webfinger.php @@ -1,5 +1,9 @@ Date: Tue, 19 Aug 2014 13:03:44 +0200 Subject: [PATCH 4/5] use z-push autodisover instead --- conf/nginx.conf | 2 +- conf/zpush/autodiscover_config.php | 29 ++++++++++ setup/zpush.sh | 4 ++ tools/exchange-autodiscover.php | 91 ------------------------------ 4 files changed, 34 insertions(+), 92 deletions(-) create mode 100644 conf/zpush/autodiscover_config.php delete mode 100755 tools/exchange-autodiscover.php diff --git a/conf/nginx.conf b/conf/nginx.conf index 49fe8655..af28173b 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -61,7 +61,7 @@ server { # Microsoft Exchange autodiscover.xml for email location /autodiscover/autodiscover.xml { include fastcgi_params; - fastcgi_param SCRIPT_FILENAME /usr/local/bin/mailinabox-exchange-autodiscover.php; + fastcgi_param SCRIPT_FILENAME /usr/local/lib/z-push/autodiscover/autodiscover.php; fastcgi_param PHP_VALUE "short_open_tag=Off"; fastcgi_pass php-fpm; } diff --git a/conf/zpush/autodiscover_config.php b/conf/zpush/autodiscover_config.php new file mode 100644 index 00000000..28a93d45 --- /dev/null +++ b/conf/zpush/autodiscover_config.php @@ -0,0 +1,29 @@ + \ No newline at end of file diff --git a/setup/zpush.sh b/setup/zpush.sh index 74962290..22e57e92 100755 --- a/setup/zpush.sh +++ b/setup/zpush.sh @@ -60,6 +60,10 @@ cp conf/zpush/backend_carddav.php /usr/local/lib/z-push/backend/carddav/config.p rm -f /usr/local/lib/z-push/backend/caldav/config.php cp conf/zpush/backend_caldav.php /usr/local/lib/z-push/backend/caldav/config.php +# Configure Autodiscover +rm -f /usr/local/lib/z-push/autodiscover/config.php +cp conf/zpush/autodiscover_config.php /usr/local/lib/z-push/autodiscover/config.php + # Some directories it will use. mkdir -p /var/log/z-push diff --git a/tools/exchange-autodiscover.php b/tools/exchange-autodiscover.php deleted file mode 100755 index 07803762..00000000 --- a/tools/exchange-autodiscover.php +++ /dev/null @@ -1,91 +0,0 @@ -(.*?)<\/AcceptableResponseSchema>/', $post_body, $match); - $AcceptableResponseSchema = $match[1]; - - if ($AcceptableResponseSchema == "http://schemas.microsoft.com/exchange/autodiscover/mobilesync/responseschema/2006") { - // There is no way to convey the user's login name with this? - ?> - - - - - - - MobileSync - https:// - https:// - - - - - -(.*?)<\/EMailAddress>/', $post_body, $match); - $LOGIN = $match[1]; - - header("Content-type: text/xml"); -?> - - - - https:// - - email - settings - - - IMAP - - 993 - on - - - - - SMTP - - 587 - on - - - - - DAV - https:// - on - on - - - - - WEB - https:///mail - on - - - - - - - From 9a1989357c82b0aba30beb3db1a005dbe6b21630 Mon Sep 17 00:00:00 2001 From: jkaberg Date: Tue, 19 Aug 2014 13:17:13 +0200 Subject: [PATCH 5/5] some makeup --- conf/zpush/autodiscover_config.php | 31 +++++++++++++----------------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/conf/zpush/autodiscover_config.php b/conf/zpush/autodiscover_config.php index 28a93d45..e26feeb1 100644 --- a/conf/zpush/autodiscover_config.php +++ b/conf/zpush/autodiscover_config.php @@ -5,25 +5,20 @@ * Descr : Autodiscover configuration file ************************************************/ -/********************************************************************************** - * Default settings - */ - // Defines the base path on the server - define('BASE_PATH', dirname($_SERVER['SCRIPT_FILENAME']). '/'); +// Defines the base path on the server +define('BASE_PATH', dirname($_SERVER['SCRIPT_FILENAME']). '/'); - // The Z-Push server location for the autodiscover response - define('SERVERURL', 'https://'.$_SERVER['SERVER_NAME'].'/Microsoft-Server-ActiveSync'); +// The Z-Push server location for the autodiscover response +define('SERVERURL', 'https://' . $_SERVER['SERVER_NAME'] . '/Microsoft-Server-ActiveSync'); - define('USE_FULLEMAIL_FOR_LOGIN', true); +define('USE_FULLEMAIL_FOR_LOGIN', true); - define('LOGFILEDIR', '/var/log/z-push/'); - define('LOGFILE', LOGFILEDIR . 'autodiscover.log'); - define('LOGERRORFILE', LOGFILEDIR . 'autodiscover-error.log'); - define('LOGLEVEL', LOGLEVEL_INFO); - define('LOGUSERLEVEL', LOGLEVEL); -/********************************************************************************** - * Backend settings - */ - // the backend data provider - define('BACKEND_PROVIDER', 'BackendCombined'); +define('LOGFILEDIR', '/var/log/z-push/'); +define('LOGFILE', LOGFILEDIR . 'autodiscover.log'); +define('LOGERRORFILE', LOGFILEDIR . 'autodiscover-error.log'); +define('LOGLEVEL', LOGLEVEL_INFO); +define('LOGUSERLEVEL', LOGLEVEL); + +// the backend data provider +define('BACKEND_PROVIDER', 'BackendCombined'); ?> \ No newline at end of file