fmbiete / Z-Push-contrib

Z-Push fork with changes that I will try to contrib
GNU Affero General Public License v3.0
134 stars 62 forks source link

Search not working with imap_list() #262

Open mnutt opened 8 years ago

mnutt commented 8 years ago

Whenever I try to run a search from my iOS device, I see the following in the logs:

28/02/2016 14:43:44 [15076] [DEBUG] [michael@example] ZPush::HierarchyCommand(16): false
28/02/2016 14:43:44 [15076] [DEBUG] [michael@example] DeviceManager->ProvisioningRequired('920736714') saved device key '920736714': false
28/02/2016 14:43:44 [15076] [DEBUG] [michael@example] ZPush::CommandNeedsAuthentication(16): true
28/02/2016 14:43:44 [15076] [DEBUG] [michael@example] BackendIMAP->Logon(): User 'michael@example' is authenticated on '{localhost:993/imap/ssl/norsh/novalidate-cert}'
28/02/2016 14:43:44 [15076] [DEBUG] [michael@example] ZPush::CommandNeedsPlainInput(16): false
28/02/2016 14:43:44 [15076] [DEBUG] [michael@example] StringStreamWrapper::Open(): len = 0
28/02/2016 14:43:44 [15076] [DEBUG] [michael@example] StringStreamWrapper::Open(): Using tmpfile()
28/02/2016 14:43:44 [15076] [DEBUG] [michael@example] StringStreamWrapper::Open(): len = 0
28/02/2016 14:43:44 [15076] [DEBUG] [michael@example] StringStreamWrapper::Open(): Using tmpfile()
28/02/2016 14:43:44 [15076] [DEBUG] [michael@example] BackendIMAP->GetMailboxSearchResults()
28/02/2016 14:43:44 [15076] [DEBUG] [michael@example] FileStateMachine->GetState() on file: '/decrypted/zpush-state/o/9/oah2dgs5uh0g9e9gkei7cru59o-bs-1456377670'
28/02/2016 14:43:44 [15076] [DEBUG] [michael@example] BackendIMAP->getImapIdFromFolderId('08099051') = INBOX
28/02/2016 14:43:44 [15076] [DEBUG] [michael@example] BackendIMAP->GetMailboxSearchResults: Filter < SINCE "1969-12-31" BEFORE "2016-02-27" TEXT "test">
28/02/2016 14:43:44 [15076] [DEBUG] [michael@example] BackendIMAP->GetMailboxSearchResults: Recursive search INBOX
28/02/2016 14:43:44 [15076] [ WARN] [michael@example] /usr/share/z-push/backend/imap/imap.php:1877 imap_list() expects parameter 1 to be resource, null given (2)
28/02/2016 14:43:44 [15076] [ WARN] [michael@example] /usr/share/z-push/backend/imap/imap.php:1882 Invalid argument supplied for foreach() (2)
28/02/2016 14:43:44 [15076] [DEBUG] [michael@example] BackendIMAP->GetMailboxSearchResults: No messages found!
28/02/2016 14:43:44 [15076] [DEBUG] [michael@example] WBXMLEncoder->startWBXML() type: vnd.ms-sync.wbxml
28/02/2016 14:43:44 [15076] [DEBUG] [michael@example] WBXMLEncoder->endTag() WBXML output completed
28/02/2016 14:43:44 [15076] [DEBUG] [michael@example] Flushing 30, headers already sent? no
28/02/2016 14:43:44 [15076] [DEBUG] [michael@example] BackendIMAP->close_connection(): disconnected from IMAP server
28/02/2016 14:43:44 [15076] [DEBUG] [michael@example] LoopDetection->ProcessLoopDetectionTerminate()
28/02/2016 14:43:44 [15076] [DEBUG] [michael@example] Memory usage information: 2248856/2621440 - Execution time: 0.0747 - HTTP responde code: 200
28/02/2016 14:43:44 [15076] [DEBUG] [michael@example] -------- End

I'm running dovecot on ssl/993 and can successfully connect to it and run searches using the openssl client. And it appears that z-push is able to connect to dovecot, but somehow when it tries to list directories it finds that it has lost $this->mbox, which is null. Everything else in z-push works fine.

mnutt commented 8 years ago

backend/imap/config.php:

define('IMAP_SERVER', 'localhost');
define('IMAP_PORT', 993);
define('IMAP_OPTIONS', '/ssl/norsh/novalidate-cert');
define('IMAP_AUTOSEEN_ON_DELETE', false);
define('IMAP_FOLDER_CONFIGURED', true);
define('IMAP_FOLDER_PREFIX', '');
define('IMAP_FOLDER_PREFIX_IN_INBOX', false);
define('IMAP_FOLDER_INBOX', 'INBOX');
define('IMAP_FOLDER_SENT', 'SENT');
define('IMAP_FOLDER_DRAFT', 'DRAFTS');
define('IMAP_FOLDER_TRASH', 'TRASH');
define('IMAP_FOLDER_SPAM', 'JUNK');
define('IMAP_FOLDER_ARCHIVE', 'ARCHIVE');
define('IMAP_INLINE_FORWARD', true);
define('IMAP_EXCLUDED_FOLDERS', '');
define('IMAP_FROM_SQL_DSN', '');
define('IMAP_FROM_SQL_USER', '');
define('IMAP_FROM_SQL_PASSWORD', '');
define('IMAP_FROM_SQL_OPTIONS', serialize(array(PDO::ATTR_PERSISTENT => true)));
define('IMAP_FROM_SQL_QUERY', "select first_name, last_name, mail_address from users where mail_address = '#username@#domain'");
define('IMAP_FROM_SQL_FIELDS', serialize(array('first_name', 'last_name', 'mail_address')));
define('IMAP_FROM_SQL_FROM', '#first_name #last_name <#mail_address>');
define('IMAP_FROM_SQL_FULLNAME', '#first_name #last_name');
define('IMAP_FROM_LDAP_SERVER', 'localhost');
define('IMAP_FROM_LDAP_SERVER_PORT', '389');
define('IMAP_FROM_LDAP_USER', 'cn=zpush,ou=servers,dc=zpush,dc=org');
define('IMAP_FROM_LDAP_PASSWORD', 'password');
define('IMAP_FROM_LDAP_BASE', 'dc=zpush,dc=org');
define('IMAP_FROM_LDAP_QUERY', '(mail=#username@#domain)');
define('IMAP_FROM_LDAP_FIELDS', serialize(array('givenname', 'sn', 'mail')));
define('IMAP_FROM_LDAP_FROM', '#givenname #sn <#mail>');
define('IMAP_FROM_LDAP_FULLNAME', '#givenname #sn');
define('IMAP_SMTP_METHOD', 'mail');
global $imap_smtp_params;
$imap_smtp_params = array();
define('MAIL_MIMEPART_CRLF', "\r\n");
define('SYSTEM_MIME_TYPES_MAPPING', '/etc/mime.types');
define('IMAP_MEETING_USE_CALDAV', false);