Giter Site home page Giter Site logo

z-push's People

Contributors

bob4os avatar c0d3z3r0 avatar cbren avatar champtar avatar cweiske avatar dehoeninger avatar doobled avatar fbartels avatar fmbiete avatar jelly avatar jpfox156 avatar liverpoolfc-fan avatar malbinola avatar marcbp avatar matidau avatar mbiebl avatar ngrewe avatar nvanheuverzwijn avatar philphonic avatar ralfbecker avatar raoulbhatia avatar ray-magini avatar roelvanmeer avatar si458 avatar sonersivri avatar tickerguy avatar umgfoin avatar windkracht8 avatar yano0takashi avatar zarasys avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

z-push's Issues

Gmail search with z-push return only 10 results

Describe the issue
I am using the latest version of Gmail application on my Android device. Recently, message search has not been working correctly. Returns only 10 results. I tried to configure it via activesync with another server that does not use Z-push (activesync 14.1). In this case, the application finds 10 messages and the “Load more” button appears. There is no such button when using z-push. I looked at the debug superficially, z-push receives the command "search" with range "0-9". Backend Zimbra, response: search:total=10. Maybe problem here?

To Reproduce
Steps to reproduce the behavior:

  1. Use gmail android app with z-push server configured
  2. Perform a search that returns many messages

Expected behavior
"Load More" button

Smartphone (please complete the following information):

  • Device: [REdmi 9x]
  • OS: [e.g. Android 10]
  • Gmail app 2024.05.05....
  • Z-Push 2.7.3

I would also be very glad if you suggest a workaround on how to replace the range in search commands for a user or device

Fatal error with unsupported charset

Hello,

I came upon a mail that seems to contain headers in charset windows-874. Since this charset is obviously unsupported by mb_convert_encoding(), I get the following fatal error:

23/08/2023 21:28:24 [1050936] [FATAL] [[email protected]] Fatal error: /usr/share/z-push-2.7.0/lib/utils/utils.php:1281 - Uncaught ValueError: mb_convert_encoding(): Argument #3 ($from_encoding) contains invalid encoding "windows-874" in /usr/share/z-push-2.7.0/lib/utils/utils.php:1281
Stack trace:
#0 /usr/share/z-push-2.7.0/lib/utils/utils.php(1281): mb_convert_encoding()
#1 /usr/share/z-push-2.7.0/lib/utils/utils.php(1407): Utils::convertRawHeader2Utf8()
#2 /usr/share/z-push-2.7.0/backend/imap/imap.php(1154): Utils::CheckAndFixEncodingInHeaders()
#3 /usr/share/z-push-2.7.0/lib/default/diffbackend/exportchangesdiff.php(160): BackendIMAP->GetMessage()
#4 /usr/share/z-push-2.7.0/lib/request/sync.php(1199): ExportChangesDiff->Synchronize()
#5 /usr/share/z-push-2.7.0/lib/request/sync.php(956): Sync->syncFolder()
#6 /usr/share/z-push-2.7.0/lib/request/requestprocessor.php(116): Sync->Handle()
#7 /usr/share/z-push-2.7.0/index.php(107): RequestProcessor::HandleRequest()
#8 {main}
  thrown (1)

While it might be difficult to support all existing charsets worldwide, a more resiliant approach might be good. A comment below the list of supported encodings suggests using mb_list_encodings() to check before calling the conversion function. That still leaves the question what to do if an unknown encoding is found. I don't have a good answer. Maybe there is a function to "safely" discard all non-ascii characters? Just as a last-resort?

Looking at lib/utils/utils.php(1281), i.e. the function that calls mb_convert_encoding(), there is already a special case for a Japanese encoding. Also, I don't get the logic behind the way the function is coded - it is passed a string argument to use for storing the converted string, but also returns a string value - or is that just my lacking PHP skills?

It seems I have successfully worked around my specific problem by aliasing windows-874 to ISO-8859-11 - which seems to work despite it not being listed as officially supported.

Duplicate Pings from one client starting at the same second do not get terminated early

In testing activesync from the GMail client on Android I frequently observed that making a change to the status of an email (reading or marking it as unread) would generate 2 almost simultaneous new Ping requests to the server, making 3 in total for the client.

If the start timestamp (unix seconds since 1-1-1970) was different the z-push function DoForcePingTimeout() in pingtracking.php would cause the older one of the processes to self-terminate. This would cause the original Ping request to self-terminate at the end of it's current ping cycle.

However, what I have observed is that because the two new Ping processes are starting so soon after each other the start timestamp on both of them is almost always the same. The existing logic does not tell one of the processes to stop.

This leads to extra load on the z-push server and the backend server.

I have been able to reproduce the condition easily.

Vincent

Every contact is getting a Birthday and anniversary set to the time of sync to the device

Server (please complete the following information):

OS: Rocky Linux 9
PHP Version: 8.1.14
Z-Push Version: develop-2.6.2-164-g6458636d (cloned from github - 22/05/2023)
Backend: Zimbra

Smartphone (please complete the following information):

Device: Samsung Galaxy S21
OS: Android
Mail App: Samsung Email

Additional context

When contacts sync to the device, z-push is creating a Birthday event for every one in the Android calendar on today's date. I have 628 contacts syncing from the server and I have 628 all-day yearly events that were created

The problem appears to stem from the fix in streamer.php for a change in the behaviour of the function gmstrftime

The latest fix shows

    // Handle empty string passed for PHP 8.x
	if ('' === $ts) {
		$ts = null;
	}

prevents the function from failing when passed an empty string.

However, the passing of null to the gmstrftime results in it using the current date/time as the timestamp to be formatted.

The Contact Syncobject has anniversary and birthday fields which by default are empty strings.

So, when the exporter code requests that those fields be formatted, if they are not set in the server they will be assigned the datetime of the sync request instead of being returned as empty strings as was the pre-PHP8, and in this case the desired, behaviour.

It looks like the second to last commit against streamer.php was actually returning the empty string which I believe is the required outcome. Why was that commit superceeded?

I believe the correct fix is the previous version

    // Handle empty string passed for PHP 8.x
	if ('' === $ts) {
		return $ts;
	}

Vincent

Z-Push do not work with Radicale CardDAV

Describe the issue
I am setting up a system with Z-Push combined backend and Radicale CardDAV / CalDAV.
ActiveSync works okay with CalDAV, but CardDAV do not work.
I found this thread, where a (now deleted user) describes a solution:

Kozea/Radicale#386

In that thread, Ghost modifies the "z-push/include/z_carddav.php" file around line 660.
There he swapped the first two IF blocks:

if (isset($response->propstat->prop->resourcetype->addressbook)) { // It's an addressbook

and

if ((strlen($this->url_vcard_extension) > 0 && preg_match('/'.$this->url_vcard_extension.'/', $response->href) && !(isset($response->propstat->prop->resourcetype) && isset($response->propstat->prop->resourcetype->addressbook))) || preg_match('/vcard/', $response->propstat->prop->getcontenttype) || isset($response->propstat->prop->{'address-data'}) || isset($response->propstat->prop->{'addressbook-data'})) { // It's a vcard

so the "addressbook" condition/block comes first and the "vcard" condition/block comes second.

With this modification, Z-Push ActiveSync works with Radicale CardDAV :-)

To Reproduce
Steps to reproduce the behavior:

  1. Get a working Radicale CardDAV with contacts
  2. Configure Z-Push to use combined backends and get addressbooks/contacts from CardDAV
  3. Synchronize on device (I tried an iPhone 6+ and a LineageOS 20)
  4. No contacts appears

Expected behavior
Contacts appears.

Desktop (please complete the following information):

  • OS: Debian 12
  • Z-Push 2.7.3
  • Radicale 3.2.0

Add configuration for //IGNORE and //TRANSLIT for iconv

We could add //IGNORE to the charset string, but this will cause the characters to drop. Not sure this is desirable behaviour.

https://www.php.net/manual/en/function.iconv.php

If the string //IGNORE is appended, characters that cannot be represented in the target charset are silently discarded. Otherwise, E_NOTICE is generated and the function will return false.

There is also //TRANSLIT but this still has a chance of returning false, depending on the implementation. If this is used we would need to then check the result and call it again with //IGNORE to ensure that it always works.

Ideally we would make a config variable so this can be defined per system, this makes it a less simple bug fix though, possibly more a feature, so would prefer to handle in another PR.

Originally posted by @matidau in #21 (comment)

Error when searching mail on iphone

Hi,

Thanks for restarting z-push!

I have an issue with the iphone when searching e-mail. It uses a Find cmd which is not supported by z-push. Is there anyway it can be fixed so it will fallback to the older AS version?

Here's a snippet from the z-push debug log:

20/07/2023 16:52:17 [ 644] [ INFO] [admin] cmd='Find' memory='1.87 MiB/4.00 MiB' time='0.10s' devType='iPhone' devId='' getUser='admin' from='172.29.0.1' idle='0s' version='2.6.1' method='POST' httpcode='500'
20/07/2023 16:52:17 [ 644] [DEBUG] [admin] -------- End
20/07/2023 16:52:17 [ 537] [DEBUG] [admin] -------- Start
20/07/2023 16:52:17 [ 537] [DEBUG] [admin] cmd='Find' devType='iPhone' devId='
' getUser='admin' from='172.29.0.1' version='2.6.1' method='POST'
20/07/2023 16:52:17 [ 537] [DEBUG] [admin] Used timezone 'Europe/Amsterdam'
20/07/2023 16:52:17 [ 537] [DEBUG] [admin] Request::ProcessHeaders() ASVersion: 14.0
20/07/2023 16:52:17 [ 537] [FATAL] [admin] FatalException: Requested the Z-Push URL without the required GET parameters - code: 0 - file: /usr/local/share/src/www/modules/z-push/vendor/z-push/index.php:71
20/07/2023 16:52:17 [ 537] [ INFO] [admin] User-agent: 'Apple-iPhone14C2/2006.75'
20/07/2023 16:52:17 [ 537] [FATAL] [admin] Exception: (FatalException) - Requested the Z-Push URL without the required GET parameters
20/07/2023 16:52:17 [ 537] [DEBUG] [admin] ZPush::PrintZPushLegal()
20/07/2023 16:52:17 [ 537] [DEBUG] [admin] InterProcessData:__construct type: '27fvov7b2l61b94tkth98kpeis'
20/07/2023 16:52:17 [ 537] [DEBUG] [admin] TopCollector(): Initialized.
20/07/2023 16:52:17 [ 537] [DEBUG] [admin] TopCollector initialised with IPC provider 'IpcSharedMemoryProvider' with type '20'

Thanks!

Best regards,
Merijn

Memory leaks on syncs?

Z-Push is using a lot of memory, and despite PHP's generous default of memory_limit=128M, we often get OOM errors on syncs:

Nginx logs:

/var/log/nginx/error.log:2023/07/19 16:02:28 [error] 686#686: *40262 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes) in /opt/z-push/backend/imap/imap.php on line 1047" while reading response header from upstream, client: 212.129.83.XXX, server: obfuscated$, request: "POST /[email protected]&DeviceId=XXXX&DeviceType=iPhone&Cmd=Sync HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm-zpush.sock:", host: "obfuscated"
/var/log/nginx/error.log:2023/07/19 16:18:01 [error] 685#685: *82295 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 9337000 bytes) in /opt/z-push/include/mimeDecode.php on line 773" while reading response header from upstream, client: 212.129.87.XXX, server: obfuscated, request: "POST /[email protected]&DeviceId=XXXX&DeviceType=iPhone&Cmd=Sync HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm-zpush.sock:", host: "obfuscated"

Z-Push logs:

19/07/2023 16:02:16 [ 9371] [FATAL] [[email protected]] Fatal error: /opt/z-push/backend/imap/imap.php:1047 - Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes) (1)
19/07/2023 17:06:18 [67007] [FATAL] [[email protected]] Fatal error: /opt/z-push/include/mimeDecode.php:488 - Allowed memory size of 134217728 bytes exhausted (tried to allocate 6857552 bytes) (1)

This issue has been reported already in mulitple places:

The workaround usually given is to increase memory_limit (to 256M for instance), but that's not always an option and is not a good solution anyway. Above 128M seems abnormally large.

Any ideas on that?

Filter by user agent or DeviceType possible?

Is it possible already to filter/reject connections from user-agent or device type information?
I'm asking this because we have some email clients that configure their Outlook with z-push's server information and we have a very basic server which can only handle some mobiles.
So we need to block those requests for them not to take the server resources.

Any ideas?
Thanks!

add remote device IP as Received header in outbound email

Is your feature request related to a problem? Please describe.
if for example a device gets hacked and the attacker uses activesync to send out emails,
the only headers you see in an email say
Received: from localhost ([10.0.0.123]) by myserver.com with MailEnable ESMTPA; Wed, 8 May 2024 14:49:40 +0100
the IP address listed is the IP address of your z-push server and not who actually sent the email in the first place!
so if you had say 10 devices connected to 1 email account and 5 devices on another email account, who sent the email?

Describe the solution you'd like
it would be nice to add an extra header Received: with the remote devices IP address when zpush received the SendMail command, that way when you check the email headers, you can see which device sent the email to your zpush before it sends the email to your smtp server

Describe alternatives you've considered
the isnt anything currently, apart from having to manually check the timestamps of the Received and then hopefully match them with z-push logs to see what IP/user send the email in the first place

Additional context
Add any other context or screenshots about the feature request here.

Can not sync calendar on Android 10

Server ver: nginx+php8.2+z-push2.7.1
My caldav backend is Synology DSM7.1.1 calendar, my phone is Android 10. After adding an exchange account to my phone's calendar, no any error log. However, there is no account just added in the calendar, and the calendar cannot be synchronized to my phone.
config.php
define('BACKEND_PROVIDER', 'BackendCalDAV');
backend/caldav/config.php

// Server protocol: http or https
define('CALDAV_PROTOCOL', 'https');

// Server name
define('CALDAV_SERVER', 'mynas.com');

// Server port
define('CALDAV_PORT', '5001');

// Base URL to principals calendar collection: use '%l' for local part or '%u' for full username
define('CALDAV_PATH', '/caldav/%u/');

// Default CalDAV folder (calendar folder/principal). This will be marked as the default calendar in the mobile
define('CALDAV_PERSONAL', 'PRINCIPAL');

// If the CalDAV server supports the sync-collection operation
// DAViCal, SOGo and SabreDav support it
// SabreDav version must be at least 1.9.0, otherwise set this to false
// Setting this to false will work with most servers, but it will be slower
define('CALDAV_SUPPORTS_SYNC', false);


// Maximum period to sync.
// Some servers don't support more than 10 years so you will need to change this
define('CALDAV_MAX_SYNC_PERIOD', 2147483647);

Microsoft timezones don't get parsed properly

I am using a setup where Z-Push 2.7.1 is the backend to Nextcloud 28 and an IMAP server. Everything is working smoothly, with on exception: some clients seem to create CalDAV entries with Microsoft-specific timezone names (in my case, "W. Europe Standard Time"). These timezones in turn break the timezone parser in lib/utils/timezoneutil.php, line 1316, with the error "Unknown or bad timezone". Would it be possible to implement a fix mapping these Microsoft-names to the proper IANA names, as suggested in this StackOverflow post?

https://stackoverflow.com/questions/27051076/php-convert-timezone-name

Thank you for your great work!

KopanoBackend->GetKoeGabBackendFolderId() Found 0 entries in the store 'SYSTEM' matching the name 'Z-Push-KOE-GAB'

Describe the bug
Numerous of our Kopano Community member's Kopano Systems are breaking down with the following message:

# tail -f /var/log/z-push/z-push-error.log
14/02/2024 10:28:03 [ 3169] [WARN] [user@example] KopanoBackend->GetKoeGabBackendFolderId() Found 0 entries in the store 'SYSTEM' matching the name 'Z-Push-KOE-GAB'.

We are 100% aware Kopano Community Edition has been discontinued and there is no more support. The problem is we have many installations and we can't just tell the people that their software is not working anymore. We have to try and solve the problem.

I have Googled this extensively and on the now defunct Kopano Community Forum there is this post:
https://forum.kopano.io/topic/594/z-push-error

Here @fbartels refers to a Wiki entry that doesn't exist anymore, https://wiki.z-hub.io/display/ZP/Configuring+GAB-Sync+for+Kopano+OL+Extension

Please, we are desperate. It seems we need to put in a blank USERNAME somewhere but I can't find the exact location.

Is this it? /etc/z-push/config.php

To Reproduce
Steps to reproduce the behavior:

  1. Users informs that email is not synching into Outlook anymore. Often refresh in Outlook has to be pressed.
  2. Install Kopano OLE extension from here: https://download.kopano.io/community/olextension%3A/
  3. Choose Full Recync, Outlook Closes
  4. From here Outlook never works again. Message is "Waiting for server" and z-push log file repeats this message every split second.

Sending email with iphone and imap backend seems impossible

Describe the issue
When sending a email with the iphone I get a error. The logs show that the recipients can't be found. My guess is that the information for the email that needs to be send is completely missing. Sending emails is possible when I hack the code and add recipients by hand.

To Reproduce
Steps to reproduce the behavior:

  1. Use imap backend
  2. Try to send email

// Z-PUSH LOGFILE
12/05/2024 07:44:13 [16095] [WARN] [joris] /volume1/web/Z-Push-2.7.3/src/include/mimeDecode.php:524 Uninitialized string offset: 0 (8)
12/05/2024 07:44:13 [16095] [WARN] [joris] /volume1/web/Z-Push-2.7.3/src/include/mimeDecode.php:891 mb_check_encoding(): Invalid encoding "" (2)
12/05/2024 07:44:13 [16095] [WARN] [joris] mimeDecode::_decodeBody(): invalid encoding in body: using 'UTF-8' instead of ''
12/05/2024 07:44:13 [16095] [WARN] [joris] /volume1/web/Z-Push-2.7.3/src/backend/imap/imap.php:2669 Undefined variable: recipients (8)
12/05/2024 07:44:13 [16095] [ERROR] [joris] Mail error: sendmail returned error code 127
12/05/2024 07:44:13 [16095] [ INFO] [joris] StatusException: BackendIMAP->sendMessage(): The email could not be sent - code: 120 - file: /volume1/web/Z-Push-2.7.3/src/backend/imap/imap.php:2673
12/05/2024 07:44:13 [16095] [WARN] [joris] HTTPReturnCodeException: BackendIMAP->sendMessage(): The email could not be sent - code: 500 - file: /volume1/web/Z-Push-2.7.3/src/lib/request/sendmail.php:152
12/05/2024 07:44:13 [16095] [FATAL] [joris] WBXML 10K debug data:
12/05/2024 07:44:13 [16095] [ INFO] [joris] User-agent: 'Apple-iPhone12C1/2105.236'
12/05/2024 07:44:13 [16095] [FATAL] [joris] Exception: (HTTPReturnCodeException) - BackendIMAP->sendMessage(): The email could not be sent
12/05/2024 07:44:13 [16095] [ INFO] [joris] cmd='SendMail' memory='1.82 MiB/4.00 MiB' time='0.35s' devType='iPhone' devId='s05locj5n56sdaqq525o8hp3uc' getUser='joris' from='192.168.1.79' idle='0s' version='2.7.3
' method='POST' httpcode='500'

mailbox.log and tracelog being filled up with errors

Hello,
Thank you for continuing with z-push.
I installed my z-push on a separate Debian server. Have php8.2. Everything is working perfect, with one big exception - the mailbox.log on the Zimbra (tried 9 and now 10) are being filled with entries like:

2024-01-02 13:44:21,085 WARN [qtp758013696-5095:https://xxxx.xxxx.xx/service/soap/] [name=xxxxxxx;mid=3;ip=xxxxxxxxxxxxxxxx;port=32940;ua=Outlook/16.0 (16.0.5401.1>
com.zimbra.cs.account.AccountServiceException: no such account: 0
at com.zimbra.cs.account.AccountServiceException.NO_SUCH_ACCOUNT(AccountServiceException.java:221) ~[zimbrastore.jar:10.0.5_GA_0423]
at com.zimbra.soap.DocumentHandler.getServer(DocumentHandler.java:439) ~[zimbrastore.jar:10.0.5_GA_0423]
at com.zimbra.cs.service.mail.MailDocumentHandler.proxyRequest(MailDocumentHandler.java:136) ~[zimbrastore.jar:10.0.5_GA_0423]
at com.zimbra.cs.service.mail.MailDocumentHandler.proxyRequest(MailDocumentHandler.java:117) ~[zimbrastore.jar:10.0.5_GA_0423]
at com.zimbra.cs.service.mail.MailDocumentHandler.proxyIfNecessary(MailDocumentHandler.java:63) ~[zimbrastore.jar:10.0.5_GA_0423]
at com.zimbra.soap.SoapEngine.dispatchRequest(SoapEngine.java:637) ~[zimbrastore.jar:10.0.5_GA_0423]
at com.zimbra.soap.SoapEngine.dispatch(SoapEngine.java:471) ~[zimbrastore.jar:10.0.5_GA_0423]
at com.zimbra.soap.SoapEngine.dispatch(SoapEngine.java:278) ~[zimbrastore.jar:10.0.5_GA_0423]
at com.zimbra.soap.SoapServlet.doWork(SoapServlet.java:308) ~[zimbrastore.jar:10.0.5_GA_0423]
at com.zimbra.soap.SoapServlet.doPost(SoapServlet.java:217) ~[zimbrastore.jar:10.0.5_GA_0423]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) ~[servlet-api-3.1.jar:3.1.0]
at com.zimbra.cs.servlet.ZimbraServlet.service(ZimbraServlet.java:214) ~[zimbrastore.jar:10.0.5_GA_0423]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) ~[servlet-api-3.1.jar:3.1.0]
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799) ~[jetty-servlet-9.4.46.v20220331.jar:9.4.46.v20220331]
at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1631) ~[jetty-servlet-9.4.46.v20220331.jar:9.4.46.v20220331]
at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:292) ~[websocket-server-9.4.46.v20220331.jar:9.4.46.v20220331]
at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193) ~[jetty-servlet-9.4.46.v20220331.jar:9.4.46.v20220331]
at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601) ~[jetty-servlet-9.4.46.v20220331.jar:9.4.46.v20220331]
at com.zimbra.cs.servlet.CsrfFilter.doFilter(CsrfFilter.java:175) ~[zimbrastore.jar:10.0.5_GA_0423]
at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193) ~[jetty-servlet-9.4.46.v20220331.jar:9.4.46.v20220331]
at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601) ~[jetty-servlet-9.4.46.v20220331.jar:9.4.46.v20220331]
at com.zimbra.cs.servlet.RequestStringFilter.doFilter(RequestStringFilter.java:54) ~[zimbrastore.jar:10.0.5_GA_0423]
at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193) ~[jetty-servlet-9.4.46.v20220331.jar:9.4.46.v20220331]
at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601) ~[jetty-servlet-9.4.46.v20220331.jar:9.4.46.v20220331]
at com.zimbra.cs.servlet.SetHeaderFilter.doFilter(SetHeaderFilter.java:59) ~[zimbrastore.jar:10.0.5_GA_0423]
at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193) ~[jetty-servlet-9.4.46.v20220331.jar:9.4.46.v20220331]
at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601) ~[jetty-servlet-9.4.46.v20220331.jar:9.4.46.v20220331]
at com.zimbra.cs.servlet.ETagHeaderFilter.doFilter(ETagHeaderFilter.java:47) ~[zimbrastore.jar:10.0.5_GA_0423]
at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193) ~[jetty-servlet-9.4.46.v20220331.jar:9.4.46.v20220331]
at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601) ~[jetty-servlet-9.4.46.v20220331.jar:9.4.46.v20220331]
at com.zimbra.cs.servlet.ContextPathBasedThreadPoolBalancerFilter.doFilter(ContextPathBasedThreadPoolBalancerFilter.java:107) ~[zimbrastore.jar:10.0.5_GA_0423]
at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193) ~[jetty-servlet-9.4.46.v20220331.jar:9.4.46.v20220331]
at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601) ~[jetty-servlet-9.4.46.v20220331.jar:9.4.46.v20220331]
at com.zimbra.cs.servlet.ZimbraQoSFilter.doFilter(ZimbraQoSFilter.java:125) ~[zimbrastore.jar:10.0.5_GA_0423]
at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193) ~[jetty-servlet-9.4.46.v20220331.jar:9.4.46.v20220331]
at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601) ~[jetty-servlet-9.4.46.v20220331.jar:9.4.46.v20220331]
at com.zimbra.cs.servlet.ZimbraInvalidLoginFilter.doFilter(ZimbraInvalidLoginFilter.java:118) ~[zimbrastore.jar:10.0.5_GA_0423]
at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193) ~[jetty-servlet-9.4.46.v20220331.jar:9.4.46.v20220331]
at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601) ~[jetty-servlet-9.4.46.v20220331.jar:9.4.46.v20220331]
at org.eclipse.jetty.servlets.DoSFilter.doFilterChain(DoSFilter.java:487) ~[jetty-servlets-9.4.46.v20220331.jar:9.4.46.v20220331]
at org.eclipse.jetty.servlets.DoSFilter.doFilter(DoSFilter.java:336) ~[jetty-servlets-9.4.46.v20220331.jar:9.4.46.v20220331]
at org.eclipse.jetty.servlets.DoSFilter.doFilter(DoSFilter.java:301) ~[jetty-servlets-9.4.46.v20220331.jar:9.4.46.v20220331]
at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193) ~[jetty-servlet-9.4.46.v20220331.jar:9.4.46.v20220331]
at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601) ~[jetty-servlet-9.4.46.v20220331.jar:9.4.46.v20220331]
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:548) ~[jetty-servlet-9.4.46.v20220331.jar:9.4.46.v20220331]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) ~[jetty-server-9.4.46.v20220331.jar:9.4.46.v20220331]
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:571) ~[jetty-security-9.4.46.v20220331.jar:9.4.46.v20220331]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[jetty-server-9.4.46.v20220331.jar:9.4.46.v20220331]
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) ~[jetty-server-9.4.46.v20220331.jar:9.4.46.v20220331]
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624) ~[jetty-server-9.4.46.v20220331.jar:9.4.46.v20220331]
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) ~[jetty-server-9.4.46.v20220331.jar:9.4.46.v20220331]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440) ~[jetty-server-9.4.46.v20220331.jar:9.4.46.v20220331]

The files grow to over 500 GB within a relatively short period of time.
Thank you very much in advance for support!

Is z-push still under active development? Whats it's status?

Is Z-Push still under active development or has it been discontinued? It seems like development ended in 2021, but I see commits from 2022 in the github repo. What is the status of z-push, and if it is discontinued, are their any viable alternatives?

Version number not displaying in Autodiscover logs

Describe the bug
Version number not displaying in Autodiscover logs

From here https://discourse.mailinabox.email/t/solved-autoconfiguration-not-working-for-ios/11895/21

To Reproduce
To be documented
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
Version to be displayed.

Logs
https://discourse.mailinabox.email/t/solved-autoconfiguration-not-working-for-ios/11895/21

Server (please complete the following information):
Apart from mailinabox, unknown

  • OS: [e.g. iOS]
  • PHP Version: [e.g. 8.2]
  • Backend for: [e.g. Kopano, Zimbra, Mail-in-a-Box]
  • and Version: [e.g. git, 9.0, v61.1]

Smartphone (please complete the following information):
Iphone

Additional context
Need to investigate further

Cannot recieve mails via z-push

Hi,

i'm using this kopano docker installation:
https://github.com/zokradonh/kopano-docker

I get without any change since some weeks the following errors:

21/12/2023 18:49:17 [   66] [ERROR] [dmack] LoopDetection->ProcessLoopDetectionPreviousConnectionFailed(): Command 'Sync' at 21/12/2023 18:48:31 with pid '57' terminated unexpectedly or is still running.
21/12/2023 18:49:17 [   66] [ERROR] [dmack] Please check your logs for this PID and errors like PHP-Fatals or Apache segmentation faults and report your results to the Z-Push dev team.
21/12/2023 18:49:17 [   66] [ERROR] [dmack] LoopDetection->ProcessLoopDetectionPreviousConnectionFailed(): Command 'Sync' at 21/12/2023 18:48:31 with pid '57' terminated unexpectedly or is still running.
21/12/2023 18:49:17 [   66] [ERROR] [dmack] Please check your logs for this PID and errors like PHP-Fatals or Apache segmentation faults and report your results to the Z-Push dev team.
21/12/2023 18:49:17 [   66] [ INFO] [dmack] Options request
21/12/2023 18:49:17 [   66] [ INFO] [dmack] cmd='Options' memory='1.73 MiB/2.00 MiB' time='0.03s' devType='Outlook' devId='9c78d4bb88184fdf97441579f4147594' getUser='dmack' from='40.101.19.85' idle='0s' version='2.6.4+0-0' method='OPTIONS' httpcode='200'
192.168.160.2 - - [21/Dec/2023:18:49:17 +0100] "OPTIONS /Microsoft-Server-ActiveSync?Cmd=Options&User=dmack&DeviceId=9c78d4bb88184fdf97441579f4147594&DeviceType=Outlook HTTP/1.1" 200 0
21/12/2023 18:49:18 [   57] [ INFO] [dmack] cmd='FolderSync' memory='2.39 MiB/4.00 MiB' time='0.24s' devType='Outlook' devId='9c78d4bb88184fdf97441579f4147594' getUser='dmack' from='40.101.19.85' idle='0s' version='2.6.4+0-0' method='POST' httpcode='200'
192.168.160.2 - - [21/Dec/2023:18:49:18 +0100] "POST /Microsoft-Server-ActiveSync?Cmd=FolderSync&User=dmack&DeviceId=9c78d4bb88184fdf97441579f4147594&DeviceType=Outlook HTTP/1.1" 200 2455
21/12/2023 18:49:18 [   71] [WARN] [dmack] StatusException: ExportChangesICS->InitializeExporter(): Error, mapi_exportchanges_config() failed: 0xFFFFFFFF8004010F - code: 12 - file: /usr/share/z-push/backend/kopano/exporter.php:230
21/12/2023 18:49:18 [   71] [WARN] [dmack] StatusException: ExportChangesICS->InitializeExporter(): Error, mapi_exportchanges_config() failed: 0xFFFFFFFF8004010F - code: 12 - file: /usr/share/z-push/backend/kopano/exporter.php:230
21/12/2023 18:49:18 [   71] [ INFO] [dmack] cmd='Sync' memory='2.05 MiB/4.00 MiB' time='0.10s' devType='Outlook' devId='9c78d4bb88184fdf97441579f4147594' getUser='dmack' from='40.101.19.85' idle='0s' version='2.6.4+0-0' method='POST' httpcode='200'
192.168.160.2 - - [21/Dec/2023:18:49:18 +0100] "POST /Microsoft-Server-ActiveSync?Cmd=Sync&User=dmack&DeviceId=9c78d4bb88184fdf97441579f4147594&DeviceType=Outlook HTTP/1.1" 200 12

My Outlook Application on my iPhone or on my Windows PC does not recieve any mail or something.

Here are the versions which i use:

ii  z-push-autodiscover               2.6.4+0-0                     all          Z-Push autodiscover
ii  z-push-backend-kopano             2.6.4+0-0                     all          Z-Push Kopano backend
ii  z-push-common                     2.6.4+0-0                     all          open source implementation of the ActiveSync protocol
ii  z-push-config-apache              2.6.4+0-0                     all          Z-Push apache configuration
ii  z-push-config-apache-autodiscover 2.6.4+0-0                     all          Z-Push autodiscover apache configuration
ii  z-push-ipc-sharedmemory           2.6.4+0-0                     all          Z-Push ipc shared memory provider
ii  z-push-kopano                     2.6.4+0-0                     all          Z-Push for Kopano
ii  z-push-kopano-gabsync             2.6.4+0-0                     all          GAB sync for Kopano

Does someone has a idea how i can fix this?

Greetings
Dany

Error on OpenBSD 7.3 - php 8.2

Describe the bug
When using the Zimbra Backend and syncing contacts with the iPhones, the contact sync stops and restarts at around 60. The error log prints an error.

Expected behavior
Correct syncing

Logs
"PHP message: PHP Fatal error: Uncaught Error: Attempt to assign property "flags" on bool in /z-push/lib/default/diffbackend/exportchangesdiff.p
hp:163"

Server (please complete the following information):

  • OS: OpenBSD 7.3
  • PHP Version: 8.2

Smartphone (please complete the following information):

  • Device: iPhone 13 Pro Max
  • OS: iOS 16.4.1
  • Mail App Apple Mail

Additional context

As a workaround, I've modified that part this way:

if (is_object($message)) {
$message->flags = (isset($change["flags"])) ? $change["flags"] : 0;
}

But I'm not sure it's ok. It seems to be working and contact sync finishes.

Unable to download or open attachments on android

Server (please complete the following information):

  • OS: OpenBSD 7.3
  • PHP Version: 8.2

Smartphone (please complete the following information):

  • Device:
  • OS: Android
  • Mail App: Nine mail

Additional context

Originally posted by @draga79 in #5 (comment)

I have noticed another problem, but I believe it is more related to the Zimbra Backend. On my iPhone, everything appears to be functioning correctly. However, on Android (using the Nine mail client), I am unable to download or open attachments. Instead, I receive the following error message:

"Fatal error: /z-push/backend/zimbra/zimbraHttpStreamWrapper.php:111 - Uncaught TypeError: fread(): Argument #1 ($stream) must be of type resource, bool given in /z-push/backend/zimbra/zimbraHttpStreamWrapper.php:111"

Should I report this issue to the Zimbra Backend developers?

Thank you, Stefano

liverpoolfc-fan

Are you using the latest codebase for z-push from here, or using the fix posted on the Z-Push Zimbra Backend sourceforge ticket?

If code from here then I believe you shouldn't experience that problem.

If you used my old fix from the Sourceforge site - please see a correction I just made to it. https://sourceforge.net/p/zimbrabackend/support-requests/185/#934b

Only the STREAMER_TYPE_STREAM_ASPLAIN type should use the resource converter. Using it on STREAMER_TYPE_STREAM_BASE64 broke downloads of attachments. Uncomment the original line for that and delete the three lines that were added. -OR- As Z-Push now has a new maintainer, you could choose to throw away these two unofficial mods and download the latest Z-Push code from https://github.com/Z-Hub/Z-Push

draga79

Yes, it is happening with the codebase pulled from here today via "git clone".

PHP 8.3 Uncaught TypeError: backend/imap/imap.php

Server: nginx + php8.3-fpm

Behaviour:
When running z-push on php 8.3 I am getting fatal error from the imap backend causing it to kill the execution.

Log Data
2024/01/11 06:35:17 [error] 3293085#3293085: *5391 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, false given in /srv/z-push/backend/imap/imap.php:1132
Stack trace:
#0 /srv/z-push/backend/imap/imap.php(1132): implode()
#1 /srv/z-push/lib/default/diffbackend/exportchangesdiff.php(160): BackendIMAP->GetMessage()
#2 /srv/z-push/lib/request/sync.php(1199): ExportChangesDiff->Synchronize()
#3 /srv/z-push/lib/request/sync.php(956): Sync->syncFolder()
#4 /srv/z-push/lib/request/requestprocessor.php(116): Sync->Handle()
#5 /srv/z-push/index.php(107): RequestProcessor::HandleRequest()
#6 {main}
thrown in /srv/z-push/backend/imap/imap.php on line 1132" while reading response header from upstream, client: REDACTED, server: REDACTED, request: "POST /Microsoft-Server-ActiveSync/?Cmd=Sync&User=REDACTED&DeviceId=REDACTED&DeviceType=REDACTED HTTP/1.1", upstream: "fastcgi://unix:/run/php/php8.3-fpm.sock:", host: "REDACTED"

Code in question
ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->GetMessage('%s', '%s', '%s')", $folderid, $id, implode(",", $bodypreference)));

Workaround
Reverting to php 7.4 at present to get around this.

Cause

Implode with historical parameter order
(https://www.php.net/manual/en/migration74.deprecated.php#migration74.deprecated.core.implode-reverse-parameters)
Passing parameters to implode() in reverse order is deprecated, use implode($glue, $parts) instead of implode($parts, $glue)

Outlook 365 Version 2401 Build 17231.20194 breaks z-push / zimbra - [SOLVED]

Describe the issue
adding a new account in outlook results in looping entries and no mail is synced

04/02/2024 20:06:49 [12052] [ INFO] [[email protected]] ExportChangesDiff->InitializeExporter(): Found '13' changes for 'hierarchy'
04/02/2024 20:06:49 [12052] [ INFO] [[email protected]] cmd='FolderSync' memory='1.69 MiB/2.00 MiB' time='0.08s' devType='WindowsOutlook' devId='3112b02513224ccf9920e4e7075bbe27' 
getUser='[email protected]' from='0.0.0.0' idle='0s' version='2.7.1
' method='POST' httpcode='200'
04/02/2024 20:06:49 [12052] [ INFO] [[email protected]] ExportChangesDiff->InitializeExporter(): Found '13' changes for 'hierarchy'
04/02/2024 20:06:49 [12052] [ INFO] [[email protected]] cmd='FolderSync' memory='1.69 MiB/2.00 MiB' time='0.08s' devType='WindowsOutlook' devId='3112b02513224ccf9920e4e7075bbe27' 
getUser='[email protected]' from='0.0.0.0' idle='0s' version='2.7.1
' method='POST' httpcode='200'
04/02/2024 20:06:49 [12052] [ INFO] [[email protected]] ExportChangesDiff->InitializeExporter(): Found '13' changes for 'hierarchy'
04/02/2024 20:06:49 [12052] [ INFO] [[email protected]] cmd='FolderSync' memory='1.69 MiB/2.00 MiB' time='0.09s' devType='WindowsOutlook' devId='3112b02513224ccf9920e4e7075bbe27' 
getUser='[email protected]' from='0.0.0.0' idle='0s' version='2.7.1
' method='POST' httpcode='200'
04/02/2024 20:06:49 [12052] [ INFO] [[email protected]] ExportChangesDiff->InitializeExporter(): Found '13' changes for 'hierarchy'
04/02/2024 20:06:49 [12052] [ INFO] [[email protected]] cmd='FolderSync' memory='1.69 MiB/2.00 MiB' time='0.09s' devType='WindowsOutlook' devId='3112b02513224ccf9920e4e7075bbe27' 
getUser='[email protected]' from='0.0.0.0' idle='0s' version='2.7.1
' method='POST' httpcode='200'
04/02/2024 20:06:49 [12052] [ INFO] [[email protected]] ExportChangesDiff->InitializeExporter(): Found '13' changes for 'hierarchy'
04/02/2024 20:06:49 [12052] [ INFO] [[email protected]] cmd='FolderSync' memory='1.69 MiB/2.00 MiB' time='0.09s' devType='WindowsOutlook' devId='3112b02513224ccf9920e4e7075bbe27' 
getUser='[email protected]' from='0.0.0.0' idle='0s' version='2.7.1
' method='POST' httpcode='200'
04/02/2024 20:06:50 [12052] [ INFO] [[email protected]] ExportChangesDiff->InitializeExporter(): Found '13' changes for 'hierarchy'
04/02/2024 20:06:50 [12052] [ INFO] [[email protected]] cmd='FolderSync' memory='1.69 MiB/2.00 MiB' time='0.09s' devType='WindowsOutlook' devId='3112b02513224ccf9920e4e7075bbe27' 
getUser='[email protected]' from='0.0.0.0' idle='0s' version='2.7.1
' method='POST' httpcode='200'
04/02/2024 20:06:50 [12052] [ INFO] [[email protected]] ExportChangesDiff->InitializeExporter(): Found '13' changes for 'hierarchy'
04/02/2024 20:06:50 [12052] [ INFO] [[email protected]] cmd='FolderSync' memory='1.69 MiB/2.00 MiB' time='0.08s' devType='WindowsOutlook' devId='3112b02513224ccf9920e4e7075bbe27' 
getUser='[email protected]' from='0.0.0.0' idle='0s' version='2.7.1
' method='POST' httpcode='200'
04/02/2024 20:06:50 [12052] [ INFO] [[email protected]] ExportChangesDiff->InitializeExporter(): Found '13' changes for 'hierarchy'
04/02/2024 20:06:50 [12052] [ INFO] [[email protected]] cmd='FolderSync' memory='1.69 MiB/2.00 MiB' time='0.08s' devType='WindowsOutlook' devId='3112b02513224ccf9920e4e7075bbe27' 
getUser='[email protected]' from='0.0.0.0' idle='0s' version='2.7.1
' method='POST' httpcode='200'
04/02/2024 20:06:50 [12052] [ INFO] [[email protected]] ExportChangesDiff->InitializeExporter(): Found '13' changes for 'hierarchy'
04/02/2024 20:06:50 [12052] [ INFO] [[email protected]] cmd='FolderSync' memory='1.69 MiB/2.00 MiB' time='0.09s' devType='WindowsOutlook' devId='3112b02513224ccf9920e4e7075bbe27' 
getUser='[email protected]' from='0.0.0.0' idle='0s' version='2.7.1

To Reproduce
Steps to reproduce the behavior:

first observed with z-push v2.5.1, zimbra connector V68, zimbra version 8.8.10

installed a new z-push instance with z-push v2.7.1, zimbra connector V72, zimbra version 8.8.10 - same behaviour

after downgrading to outlook to version 2312 build 17126.20132 everything works out as it should

Additional context
There seems to be a major change in outlook 365 Version 2401 Build 17231.20194

Implement AS 16.0 support

Recreation of bug https://jira.kopano.io/browse/ZP-713:

On the 14th of September 2015 MS published new AS documentation which has a new AS protocol version.
The changes include:

ActiveSync 16 has been supported in iOS since iOS 9.x (September 2015).

For cool things that are now possible with recent ActiveSync versions you can check:
https://grommunio.com/de/neuigkeiten/integration-von-exchange-activesync-16/

error sending mail: corrupt headers

Hello,
I have identified what I believe is a compatibility problem with php8, in the usage of PHP's mail() function.
I was using the IMAP backend, configured to use mail() to send messages received from clients. This used to work without problems.
Some months ago the mails created this way started to be corrupt, more precisely MIME headers were corrupted in a way that the MIME structure would be displayed as text by mail readers. Analyzing the raw mail source, it turns out some header lines had an additional space character added in front, i.e. they would not be recognised anymore by the mail reader.
Debugging Z-Push, it turns out the mails are perfectly fine until handed over to the sending function, in my case mail(). Switching to smtp method is my current workaround.
According to this discussion, the adding of spaces in front of headers seems related to changes in PHP8's mail(), potentially related to CR/LF translation.
I have not taken the time to debug this further within mail(), but as-is, Z-Push is not able to send correct mails using the mail() sending method. Hence this should be addressed one way or another.
This issue serves also to document the problem and my workaround.
Environment:

  • Z-Push 2.7.0 (but same with older 2.6.4)
  • PHP 8.1 current

Thanks!

PHP-MAPI extension is not available

Hi,

I am using Z-Push on a Debian bullseye server following the wiki installation guide. Z-Push is on top of a Dovecot server (localhost) and I am configuring it, in particular defining the backend as

$ cat /var/lib/z-push/config.php  | grep BACKEND_PROVIDER
    define('BACKEND_PROVIDER', 'BackendIMAP');

Whenever I configure a new device (iOS, also tested with https://testconnectivity.microsoft.com/tests/Eas/input), autodiscover does not work. I get the following output in the logs:

==> /var/log/z-push/autodiscover.log <==
20/11/2023 16:57:31 [2230113] [FATAL] [#unknown] Exception: (FatalMisconfigurationException) - PHP-MAPI extension is not available
20/11/2023 16:57:31 [2230113] [ERROR] [#unknown] Unable to complete autodiscover because of ZPushException. Error: PHP-MAPI extension is not available

PHP-MAPI extension does not seem to be available anywhere easily and AFAIK it should only be used by Kopano Backend. Not sure why it is blocking autodiscover with the following setup?

Thanks!

Folders created on Outlook 2021 get duplicated

Describe the issue
After configuring an account to sync data with z-push on Outlook 2021, when I create a folder, it gets duplicated on folder list and a number is appended after it's name. I've checked the mail server (dovecot) and only the folder with the correct name is created.

To Reproduce
Steps to reproduce the behavior:

  1. Go to Control Panel > Mail (Microsoft Outlook)
  2. Configure an account pointing to the host where z-push is configured
  3. Open Outlook and wait for the sync
  4. Create a new folder

Expected behavior
A single folder is created and no number gets appended after it's name.

Screenshots
image

Desktop:

  • OS: Windows 11
  • Client: Outlook 2021

Server:

  • dovecot: 2.3.20
  • Z-Push: 2.7.1

Additional context
config.php

<?php
/***********************************************
* File      :   config.php
* Project   :   Z-Push
* Descr     :   Main configuration file
*
* Created   :   01.10.2007
*
* Copyright 2007 - 2016 Zarafa Deutschland GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*
* Consult LICENSE file for details
************************************************/

/**********************************************************************************
 *  Default settings
 */
    // Defines the default time zone, change e.g. to "Europe/London" if necessary
    define('TIMEZONE', 'America/Sao_Paulo');

    // Defines the base path on the server
    define('BASE_PATH', dirname($_SERVER['SCRIPT_FILENAME']). '/');

    // Try to set unlimited timeout
    define('SCRIPT_TIMEOUT', 0);

    // This should be solved on THE webserver level if there are proxies
    // between mobile client and Z-Push.
    // IMPORTANT: This setting will be deprecated in Z-Push 2.7.0.
    // Use a custom header to determinate the remote IP of a client.
    // By default, the server provided REMOTE_ADDR is used. If the header here set
    // is available, the provided value will be used, else REMOTE_ADDR is maintained.
    // set to false to disable this behaviour.
    // common values: 'HTTP_X_FORWARDED_FOR', 'HTTP_X_REAL_IP' (casing is ignored)
    define('USE_CUSTOM_REMOTE_IP_HEADER', false);

    // When using client certificates, we can check if the login sent matches the owner of the certificate.
    // This setting specifies the owner parameter in the certificate to look at.
    define("CERTIFICATE_OWNER_PARAMETER", "SSL_CLIENT_S_DN_CN");

    /*
     * Whether to use the complete email address as a login name
     * (e.g. [email protected]) or the username only (user).
     * This is required for Z-Push to work properly after autodiscover.
     * Possible values:
     *   false - use the username only.
     *   true  - string the mobile sends as username, e.g. full email address (default).
     */
    define('USE_FULLEMAIL_FOR_LOGIN', true);

/**********************************************************************************
 * StateMachine setting
 *
 * These StateMachines can be used:
 *   FILE  - FileStateMachine (default). Needs STATE_DIR set as well.
 *   SQL   - SqlStateMachine has own configuration file. STATE_DIR is ignored.
 *           State migration script is available, more informations: https://wiki.z-hub.io/x/xIAa
 */
    define('STATE_MACHINE', 'FILE');
    define('STATE_DIR', '/usr/local/z-push/activesync_state/');

/**********************************************************************************
 *  IPC - InterProcessCommunication
 *
 *  Is either provided by using shared memory on a single host or
 *  using the memcache provider for multi-host environments.
 *  When another implementation should be used, the class can be set here explicitly.
 *  If empty Z-Push will try to use available providers.

 *  Possible values:
 *  IpcSharedMemoryProvider - default. Requires z-push-ipc-sharedmemory package.
 *  IpcMemcachedProvider    - requires z-push-ipc-memcached package. It is necessary to set up
 *                            memcached server before (it won't be installed by z-push-ipc-memcached).
 *  IpcWincacheProvider     - for windows systems.
 */
    define('IPC_PROVIDER', 'IpcMemcachedProvider');

/**********************************************************************************
 *  Logging settings
 *
 *  The LOGBACKEND specifies where the logs are sent to.
 *  Either to file ("filelog") or to a "syslog" server or a custom log class in core/log/logclass.
 *  filelog and syslog have several options that can be set below.
 *  For more information about the syslog configuration, see https://wiki.z-hub.io/x/HIAT

 *  Possible LOGLEVEL and LOGUSERLEVEL values are:
 *  LOGLEVEL_OFF            - no logging
 *  LOGLEVEL_FATAL          - log only critical errors
 *  LOGLEVEL_ERROR          - logs events which might require corrective actions
 *  LOGLEVEL_WARN           - might lead to an error or require corrective actions in the future
 *  LOGLEVEL_INFO           - usually completed actions
 *  LOGLEVEL_DEBUG          - debugging information, typically only meaningful to developers
 *  LOGLEVEL_WBXML          - also prints the WBXML sent to/from the device
 *  LOGLEVEL_DEVICEID       - also prints the device id for every log entry
 *  LOGLEVEL_WBXMLSTACK     - also prints the contents of WBXML stack
 *
 *  The verbosity increases from top to bottom. More verbose levels include less verbose
 *  ones, e.g. setting to LOGLEVEL_DEBUG will also output LOGLEVEL_FATAL, LOGLEVEL_ERROR,
 *  LOGLEVEL_WARN and LOGLEVEL_INFO level entries.
 *
 *  LOGAUTHFAIL is logged to the LOGBACKEND.
 */
    define('LOGBACKEND', 'filelog');
    // COM LOGLEVEL_OFF, z-push.log ficará vazio, e z-push-error.log apenas com WARN para cima
    define('LOGLEVEL', LOGLEVEL_OFF);
    // define('LOGLEVEL', LOGLEVEL_INFO);
    define('LOGAUTHFAIL', false);

    // To save e.g. WBXML data only for selected users, add the usernames to the array
    // The data will be saved into a dedicated file per user in the LOGFILEDIR
    // Users have to be encapusulated in quotes, several users are comma separated, like:
    //   $specialLogUsers = array('[email protected]', 'myusername');
    define('LOGUSERLEVEL', LOGLEVEL_DEVICEID);
    $specialLogUsers = array();

    // Filelog settings
    define('LOGFILEDIR', '/var/log/z-push/');
    define('LOGFILE', LOGFILEDIR . 'z-push.log');
    define('LOGERRORFILE', LOGFILEDIR . 'z-push-error.log');

    // Syslog settings
    // false will log to local syslog, otherwise put the remote syslog IP here
    define('LOG_SYSLOG_HOST', false);
    // Syslog port
    define('LOG_SYSLOG_PORT', 514);
    // Program showed in the syslog. Useful if you have more than one instance login to the same syslog
    define('LOG_SYSLOG_PROGRAM', 'z-push');
    // Syslog facility - use LOG_USER when running on Windows
    define('LOG_SYSLOG_FACILITY', LOG_LOCAL0);

    // Location of the trusted CA, e.g. '/etc/ssl/certs/EmailCA.pem'
    // Uncomment and modify the following line if the validation of the certificates fails.
    // define('CAINFO', '/etc/ssl/certs/EmailCA.pem');

/**********************************************************************************
 *  Mobile settings
 */
    // Device Provisioning
    define('PROVISIONING', true);

    // This option allows the 'loose enforcement' of the provisioning policies for older
    // devices which don't support provisioning (like WM 5 and HTC Android Mail) - dw2412 contribution
    // false (default) - Enforce provisioning for all devices
    // true - allow older devices, but enforce policies on devices which support it
    define('LOOSE_PROVISIONING', false);

    // The file containing the policies' settings.
    // Set a full path or relative to the z-push main directory
    define('PROVISIONING_POLICYFILE', 'policies.ini');

    // Default conflict preference
    // Some devices allow to set if the server or PIM (mobile)
    // should win in case of a synchronization conflict
    //   SYNC_CONFLICT_OVERWRITE_SERVER - Server is overwritten, PIM wins
    //   SYNC_CONFLICT_OVERWRITE_PIM    - PIM is overwritten, Server wins (default)
    define('SYNC_CONFLICT_DEFAULT', SYNC_CONFLICT_OVERWRITE_PIM);

    // Global limitation of items to be synchronized
    // The mobile can define a sync back period for calendar and email items
    // For large stores with many items the time period could be limited to a max value
    // If the mobile transmits a wider time period, the defined max value is used
    // Applicable values:
    //   SYNC_FILTERTYPE_ALL (default, no limitation)
    //   SYNC_FILTERTYPE_1DAY, SYNC_FILTERTYPE_3DAYS, SYNC_FILTERTYPE_1WEEK, SYNC_FILTERTYPE_2WEEKS,
    //   SYNC_FILTERTYPE_1MONTH, SYNC_FILTERTYPE_3MONTHS, SYNC_FILTERTYPE_6MONTHS
    define('SYNC_FILTERTIME_MAX', SYNC_FILTERTYPE_ALL);

    // Interval in seconds before checking if there are changes on the server when in Ping.
    // It means the highest time span before a change is pushed to a mobile. Set it to
    // a higher value if you have a high load on the server.
    define('PING_INTERVAL', 30);

    // Set the fileas (save as) order for contacts in the webaccess/webapp/outlook.
    // It will only affect new/modified contacts on the mobile which then are synced to the server.
    // Possible values are:
    // SYNC_FILEAS_FIRSTLAST    - fileas will be "Firstname Middlename Lastname"
    // SYNC_FILEAS_LASTFIRST    - fileas will be "Lastname, Firstname Middlename"
    // SYNC_FILEAS_COMPANYONLY  - fileas will be "Company"
    // SYNC_FILEAS_COMPANYLAST  - fileas will be "Company (Lastname, Firstname Middlename)"
    // SYNC_FILEAS_COMPANYFIRST - fileas will be "Company (Firstname Middlename Lastname)"
    // SYNC_FILEAS_LASTCOMPANY  - fileas will be "Lastname, Firstname Middlename (Company)"
    // SYNC_FILEAS_FIRSTCOMPANY - fileas will be "Firstname Middlename Lastname (Company)"
    // The company-fileas will only be set if a contact has a company set. If one of
    // company-fileas is selected and a contact doesn't have a company set, it will default
    // to SYNC_FILEAS_FIRSTLAST or SYNC_FILEAS_LASTFIRST (depending on if last or first
    // option is selected for company).
    // If SYNC_FILEAS_COMPANYONLY is selected and company of the contact is not set
    // SYNC_FILEAS_LASTFIRST will be used
    define('FILEAS_ORDER', SYNC_FILEAS_LASTFIRST);

    // Maximum amount of items to be synchronized per request.
    // Normally this value is requested by the mobile. Common values are 5, 25, 50 or 100.
    // Exporting too much items can cause mobile timeout on busy systems.
    // Z-Push will use the lowest provided value, either set here or by the mobile.
    // MS Outlook 2013+ request up to 512 items to accelerate the sync process.
    // If you detect high load (also on subsystems) you could try a lower setting.
    // max: 512 - value used if mobile does not limit amount of items
    define('SYNC_MAX_ITEMS', 512);

    // The devices usually send a list of supported properties for calendar and contact
    // items. If a device does not includes such a supported property in Sync request,
    // it means the property's value will be deleted on the server.
    // However some devices do not send a list of supported properties. It is then impossible
    // to tell if a property was deleted or it was not set at all if it does not appear in Sync.
    // This parameter defines Z-Push behaviour during Sync if a device does not issue a list with
    // supported properties.
    // See also https://jira.z-hub.io/browse/ZP-302.
    // Possible values:
    // false - do not unset properties which are not sent during Sync (default)
    // true  - unset properties which are not sent during Sync
    define('UNSET_UNDEFINED_PROPERTIES', false);

    // ActiveSync specifies that a contact photo may not exceed 48 KB. This value is checked
    // in the semantic sanity checks and contacts with larger photos are not synchronized.
    // This limitation is not being followed by the ActiveSync clients which set much bigger
    // contact photos. You can override the default value of the max photo size.
    // default: 5242880 - 5 MB default max photo size in bytes
    define('SYNC_CONTACTS_MAXPICTURESIZE', 5242880);

    // Over the WebserviceUsers command it is possible to retrieve a list of all
    // known devices and users on this Z-Push system. The authenticated user needs to have
    // admin rights and a public folder must exist.
    // In multicompany environments this enable an admin user of any company to retrieve
    // this full list, so this feature is disabled by default. Enable with care.
    define('ALLOW_WEBSERVICE_USERS_ACCESS', false);

    // Users with many folders can use the 'partial foldersync' feature, where the server
    // actively stops processing the folder list if it takes too long. Other requests are
    // then redirected to the FolderSync to synchronize the remaining items.
    // Device compatibility for this procedure is not fully understood.
    // NOTE: THIS IS AN EXPERIMENTAL FEATURE WHICH COULD PREVENT YOUR MOBILES FROM SYNCHRONIZING.
    define('USE_PARTIAL_FOLDERSYNC', false);

    // The minimum accepted time in second that a ping command should last.
    // It is strongly advised to keep this config to false. Some device
    // might not be able to send a higher value than the one specificied here and thus
    // unable to start a push connection.
    // If set to false, there will be no lower bound to the ping lifetime.
    // The minimum accepted value is 1 second. The maximum accepted value is 3540 seconds (59 minutes).
    define('PING_LOWER_BOUND_LIFETIME', false);

    // The maximum accepted time in second that a ping command should last.
    // If set to false, there will be no higher bound to the ping lifetime.
    // The minimum accepted value is 1 second. The maximum accepted value is 3540 seconds (59 minutes).
    define('PING_HIGHER_BOUND_LIFETIME', false);

    // Maximum response time
    // Mobiles implement different timeouts to their TCP/IP connections. Android devices for example
    // have a hard timeout of 30 seconds. If the server is not able to answer a request within this timeframe,
    // the answer will not be recieved and the device will send a new one overloading the server.
    // There are three categories
    //   - Short timeout  - server has up within 30 seconds - is automatically applied for not categorized types
    //   - Medium timeout - server has up to 90 seconds to respond
    //   - Long timeout   - server has up to 4 minutes to respond
    // If a timeout is almost reached the server will break and sent the results it has until this
    // point. You can add DeviceType strings to the categories.
    // In general longer timeouts are better, because more data can be streamed at once.
    define('SYNC_TIMEOUT_MEDIUM_DEVICETYPES', "SAMSUNGGTI");
    define('SYNC_TIMEOUT_LONG_DEVICETYPES',   "iPod, iPad, iPhone, WP, WindowsOutlook, WindowsMail");

    // Time in seconds the device should wait whenever the service is unavailable,
    // e.g. when a backend service is unavailable.
    // Z-Push sends a "Retry-After" header in the response with the here defined value.
    // It is up to the device to respect or not this directive so even if this option is set,
    // the device might not wait requested time frame.
    // Number of seconds before retry, to disable set to: false
    define('RETRY_AFTER_DELAY', 300);

/**********************************************************************************
 *  Backend settings
 */
    // The backend data provider.
    // Leave this value empty and Z-Push will autoload a backend. The sequence of autoload is:
    // BackendKopano, BackendCombined, BackendIMAP, BackendVCardDir, BackendMaildir.
    // If BackendKopano is not installed, Z-Push will load BackendCombined. If BackendCombined
    // also is not installed, Z-Push will load BackendIMAP and so on.
    // If you prefer explicitly configure a backend provider, currently possible values are:
    // BackendKopano     -  to use with the Kopano groupware. Syncs emails, calendar items,
    //                      contacts, tasks and notes or any combination of the listed items.
    // BackendCombined   -  combine multiple backends for different items, e.g.
    //                      BackendIMAP for emails, BackendCalDAV for calendar items,
    //                      BackendCardDAV for contacts etc. You can configure what backend
    //                      syncs which items in /etc/combined.conf.php.
    // BackendIMAP       -  to sync emails with an IMAP server.
    // BackendCalDAV     -  to sync calendar items and / or tasks with a CalDAV server.
    // BackendCardDAV    -  to sync contacts with a CardDAV server.
    // BackendMaildir    -  to sync emails from a Maildir.
    // BackendStickyNote -  to sync notes with a Postgres server.
    // BackendVCardDir   -  to sync contacts with vcard folder.
    define('BACKEND_PROVIDER', 'BackendCombined');

/**********************************************************************************
 *  Search provider settings
 *
 *  Alternative backend to perform SEARCH requests (GAL search)
 *  By default the main Backend defines the preferred search functionality.
 *  If set, the Search Provider will always be preferred.
 *  Use 'BackendSearchLDAP' to search in a LDAP directory (see backend/searchldap/config.php)
 */
    define('SEARCH_PROVIDER', '');
    // Time in seconds for the server search. Setting it too high might result in timeout.
    // Setting it too low might not return all results. Default is 10.
    define('SEARCH_WAIT', 10);
    // The maximum number of results to send to the client. Setting it too high
    // might result in timeout. Default is 10.
    define('SEARCH_MAXRESULTS', 10);

/**********************************************************************************
 *  Kopano Outlook Extension - Settings
 *
 *  The Kopano Outlook Extension (KOE) provides MS Outlook 2013 and newer with
 *  functionality not provided by ActiveSync or not implemented by Outlook.
 *  For more information, see: https://wiki.z-hub.io/x/z4Aa
 */
    // Global Address Book functionality
    define('KOE_CAPABILITY_GAB', true);
    // Synchronize mail flags from the server to Outlook/KOE
    define('KOE_CAPABILITY_RECEIVEFLAGS', true);
    // Encode flags when sending from Outlook/KOE
    define('KOE_CAPABILITY_SENDFLAGS', true);
    // Out-of-office support
    define('KOE_CAPABILITY_OOF', true);
    // Out-of-office support with start & end times (superseeds KOE_CAPABILITY_OOF)
    define('KOE_CAPABILITY_OOFTIMES', true);
    // Notes support
    define('KOE_CAPABILITY_NOTES', true);
    // Shared folder support
    define('KOE_CAPABILITY_SHAREDFOLDER', true);
    // Send-As support for Outlook/KOE and mobiles
    define('KOE_CAPABILITY_SENDAS', true);
    // Secondary Contact folders (own and shared)
    define('KOE_CAPABILITY_SECONDARYCONTACTS', true);
    // Copy WebApp signature into KOE
    define('KOE_CAPABILITY_SIGNATURES', true);
    // Delivery receipt requests
    define('KOE_CAPABILITY_RECEIPTS', true);
    // Impersonate other users
    define('KOE_CAPABILITY_IMPERSONATE', true);

    // To synchronize the GAB KOE, the GAB store and folderid need to be specified.
    // Use the gab-sync script to generate this data. The name needs to
    // match the config of the gab-sync script.
    // More information here: https://wiki.z-hub.io/x/z4Aa (GAB Sync Script)
    define('KOE_GAB_STORE', 'SYSTEM');
    define('KOE_GAB_FOLDERID', '');
    define('KOE_GAB_NAME', 'Z-Push-KOE-GAB');

/**********************************************************************************
 *  Synchronize additional folders to all mobiles
 *
 *  With this feature, special folders can be synchronized to all mobiles.
 *  This is useful for e.g. global company contacts.
 *
 *  This feature is supported only by certain devices, like iPhones.
 *  Check the compatibility list for supported devices:
 *      http://z-push.org/compatibility
 *
 *  To synchronize a folder, add a section setting all parameters as below:
 *      store:      the ressource where the folder is located.
 *                  Kopano users use 'SYSTEM' for the 'Public Folder'
 *      folderid:   folder id of the folder to be synchronized
 *      name:       name to be displayed on the mobile device
 *      type:       supported types are:
 *                      SYNC_FOLDER_TYPE_USER_CONTACT
 *                      SYNC_FOLDER_TYPE_USER_APPOINTMENT
 *                      SYNC_FOLDER_TYPE_USER_TASK
 *                      SYNC_FOLDER_TYPE_USER_MAIL
 *                      SYNC_FOLDER_TYPE_USER_NOTE
 *      flags:      sets additional options on the shared folder. Supported are:
 *                      DeviceManager::FLD_FLAGS_NONE
 *                          No flags configured, default flag to be set
 *                      DeviceManager::FLD_FLAGS_SENDASOWNER
 *                          When replying in this folder, automatically do Send-As
 *                      DeviceManager::FLD_FLAGS_CALENDARREMINDERS
 *                          If set, Outlook shows reminders for these shares with KOE
 *                      DeviceManager::FLD_FLAGS_NOREADONLYNOTIFY
 *                          If set, Z-Push won't send notification emails for changes
 *                          if the folder is read-only
 *
 *  Additional notes:
 *  - on Kopano systems use backend/kopano/listfolders.php script to get a list
 *    of available folders
 *
 *  - all Z-Push users must have at least reading permissions so the configured
 *    folders can be synchronized to the mobile. Else they are ignored.
 *
 *  - this feature is only partly suitable for multi-tenancy environments,
 *    as ALL users from ALL tenents need access to the configured store & folder.
 *    When configuring a public folder, this will cause problems, as each user has
 *    a different public folder in his tenant, so the folder are not available.

 *  - changing this configuration could cause HIGH LOAD on the system, as all
 *    connected devices will be updated and load the data contained in the
 *    added/modified folders.
 */

    $additionalFolders = array(
        // demo entry for the synchronization of contacts from the public folder.
        // uncomment (remove '/*' '*/') and fill in the folderid
/*
        array(
            'store'     => "SYSTEM",
            'folderid'  => "",
            'name'      => "Public Contacts",
            'type'      => SYNC_FOLDER_TYPE_USER_CONTACT,
            'flags'     => DeviceManager::FLD_FLAGS_NONE,
        ),
*/
    );

z-push.log with LOGLEVEL set to LOGLEVEL_DEBUG
z-push.log

Hot parts?

23/05/2024 17:46:47 [17904] [DEBUG] [[email protected]] Combined->GetImporter() -> Hierarchy: ImportChangesCombined()
23/05/2024 17:46:47 [17904] [DEBUG] [[email protected]] ImportChangesCombined->Config(...)
23/05/2024 17:46:47 [17904] [ERROR] [[email protected]] ImportChangesCombined->Config() icc not configured
23/05/2024 17:46:47 [17904] [DEBUG] [[email protected]] ChangesMemoryWrapper->ImportFolderChange(): Set foldertype for folder 'teste2  1 ' from cache as it was not sent: '12'
23/05/2024 17:46:47 [17904] [DEBUG] [[email protected]] ImportChangesCombined->ImportFolderChange() id: 'i/7dabef50', parent: 'i/7e56269a'
23/05/2024 17:46:47 [17904] [FATAL] [[email protected]] Fatal error: /usr/local/z-push/lib/default/diffbackend/diffstate.php:230 - Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /usr/local/z-push/lib/default/diffbackend/diffstate.php:230
Stack trace:
#0 /usr/local/z-push/lib/default/diffbackend/importchangesdiff.php(213): DiffState->updateState('change', Array)
#1 /usr/local/z-push/backend/combined/importer.php(183): ImportChangesDiff->ImportFolderChange(Object(SyncFolder))
#2 /usr/local/z-push/lib/core/changesmemorywrapper.php(277): ImportChangesCombined->ImportFolderChange(Object(SyncFolder))
#3 /usr/local/z-push/lib/request/folderchange.php(172): ChangesMemoryWrapper->ImportFolderChange(Object(SyncFolder))
#4 /usr/local/z-push/lib/request/requestprocessor.php(116): FolderChange->Handle(12)
#5 /usr/local/z-push/index.php(107): RequestProcessor::HandleRequest()
#6 {main}
  thrown (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.