ddavness / power-mailinabox

A Mail-in-a-Box with extra capabilities and more customizability. Not just for power users!
Creative Commons Zero v1.0 Universal
168 stars 31 forks source link

ActiveSync broken in Power Mailinabox v60.5 / Ubuntu 22.04 #108

Open lic0san opened 1 year ago

lic0san commented 1 year ago

I encounteried issues with ActiveSync in Power Mailinabox v60.5, under Ubuntu 22.04, trying to sync from an Android mail client called Nine (by 9folders).

First, there was apparently a compatibility problem with z-push and PHP 8.1 :


> php /usr/local/lib/z-push/z-push-top.php

PHP Fatal error:  Uncaught Error: Object of class SysvSemaphore could not be converted to string in /usr/local/lib/z-push/backend/ipcsharedmemory/ipcsharedmemoryprovider.php:45
Stack trace:
#0 /usr/local/lib/z-push/backend/ipcsharedmemory/ipcsharedmemoryprovider.php(45): sprintf()
#1 /usr/local/lib/z-push/lib/core/interprocessdata.php(93): IpcSharedMemoryProvider->__construct()
#2 /usr/local/lib/z-push/lib/core/topcollector.php(49): InterProcessData->__construct()
#3 /usr/local/lib/z-push/z-push-top.php(131): TopCollector->__construct()
#4 /usr/local/lib/z-push/z-push-top.php(49): ZPushTop->__construct()
#5 {main}
  thrown in /usr/local/lib/z-push/backend/ipcsharedmemory/ipcsharedmemoryprovider.php on line 45

I found a fix here :

Change (/usr/share/z-push)backend/ipcsharedmemoryprovider.php:45 as follows:

$this->initSharedMem())
          ZLog::Write(LOGLEVEL_DEBUG, sprintf("%s(): Initialized %s and %s.", $class, $this->mutexid::class, $this->memid::class));

z-push-top worked as expected after that !

Still, the account provisioning on Nine/Android failed to complete.

In /var/log/z-push/z-push-error.log, I spotted :


15/12/2022 11:43:39 [67398] [WARN] [user@domain.org] SyncObject->Check(): Unmet condition in object from type SyncProvisioning: parameter 'maxattsize' is LOWER than '-1'. Check failed!
15/12/2022 11:43:39 [67398] [FATAL] [user@domain.org] FatalException: Invalid policies! - code: 0 - file: /usr/local/lib/z-push/lib/request/provisioning.php:220
15/12/2022 11:43:39 [67398] [FATAL] [user@domain.org] WBXML 10K debug data: AwFqAAAORUZHSANNUy1FQVMtUHJvdmlzaW9uaW5nLVdCWE1MAAEBAQE=
15/12/2022 11:43:39 [67398] [FATAL] [user@domain.org] Exception: (FatalException) - Invalid policies!

I found the fix lower in the same kopano feed :

in my policies file i had to set maxattsize = -1 in my old version it was set to “” which caused z-push to not work.

Indeed, I did change the maxattsize value in /usr/local/lib/z-push/policies.ini (line 70) and the account is now provisioned and syncing from Nine/Android.

Thank you for the great piece of software !

ddavness commented 1 year ago

Hi, thanks for the heads-up. This is known, though I didn't want to apply patches to software we install. But Seems that we're going to truly need to start applying patches to the software we install (in this case, Z-Push).

But from the way things are going, Kopano is basically seemingly shutting down most of their open-source project. I'm not sure that we should expect any more updates from Z-Push?

lic0san commented 1 year ago

Indeed, it appears any updates are now « in the hands of the open source community » :

Statement regarding the community project Z-Push

The bottom line is that this means nothing else than that we advise the community members to carry out a fork of the code and convert it into a new project structure in order to reorganize themselves there. There are currently no plans to take any resources (e.g. in the form of wiki and code) offline at short notice, so that such a transit should be possible in a reasonable time frame.

If someone is seriously interested in undertaking such an effort, we can provide a little assitance, f.e. in terms of repository cloning. What we certainly cannot do is extract information of our internal bug / support issue tracking system, as there might be sensitive information of customers involved, which of course cannot be shared. Please contact us via info@kopano.com if you are seriously interested.

I don't know if the upstream MIAB is planning to patch it , but there is that comment on the issues tracker with rather comprehensive instructions : https://github.com/mail-in-a-box/mailinabox/issues/2177#issuecomment-1294430425

matidau commented 1 year ago

Hi,

I have a repo that is working with vanilla MIAB.

I will put in a pull request to the main MIAB repo once some other people have tested and let me know how they went. https://github.com/mail-in-a-box/mailinabox/issues/2181#issuecomment-1416576761

Links: The updated repo is GitHub - matidau/Z-Push: PHP8 support and other bug fixes for Z-Push in mailinabox Text of the script for Vanilla MIAB is available on github Z-Push/zpushpatch.sh at php8.x · matidau/Z-Push · GitHub Script can also be downloaded in the web browser https://mat.id.au/zpushpatch.sh

matidau commented 1 year ago

Just to let you know that I have put in the PR for the upstream https://github.com/mail-in-a-box/mailinabox/pull/2236

matidau commented 1 year ago

I don't know if the upstream MIAB is planning to patch it , but there is that comment on the issues tracker with rather comprehensive instructions : mail-in-a-box/mailinabox#2177 (comment)

This is fixed in the upstream with v62 https://github.com/mail-in-a-box/mailinabox/releases/tag/v62