Git Product home page Git Product 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

Watchers

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

z-push's Issues

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'

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!

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.

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)

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

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

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.

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?

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!

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!

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?

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

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

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);

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".

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.

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.

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

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!

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!

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)

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/

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.