[Windows Mobile Development and Hacking General] enodr:
Hi,

This post might be usefull for people trying to pop mail from a Mac OS X server 10.5 (which is Cyrus POP3 v2.3.8-OS X Server 10.5).

I setup a pop3 account (over SSL but that doesn't matter) to connect to my OS X server but Pocket Outlook on a Windows Mobile 6.1 refused to download any mail, always displaying the standard error message.

I decided first to troubleshoot this by setting up a socat tunnel in order to display what was happening under the hood between my Windows Mobile device and the server.

The setup is as is:

Mobile device <-----> test server running socat <-----> Mac OS X server

The socat command used on the test server is:

socat -s -d -d -d -v TCP4-LISTEN:65432,reuseaddr,fork TCP4:osxserver.com:110

On windows mobile device I then used testserver.com:65432 as pop3 server.

I logged the traffic between the device and my pop3 server and here is what I found:

+OK macosxserver.com Cyrus POP3 v2.3.8-OS X Server 10.5: 9C31 server ready <blah545645646@macosxserver.com>

CAPA <----- sent by mobile device

+OK List of capabilities follows
EXPIRE NEVER
LOGIN-DELAY 0
TOP
UIDL
PIPELINING
RESP-CODES
AUTH-RESP-CODE
USER
IMPLEMENTATION Cyrus POP3 server v2.3.8-OS X Server 10.5: 9C31
.

AUTH <----- sent by mobile device

+OK List of supported mechanisms follows
SMB-NTLMv2
SMB-NT
SMB-LAN-MANAGER
MS-CHAPv2
PPS
PLAIN
OTP
LOGIN
GSSAPI
DIGEST-MD5
CRAM-MD5
WEBDAV-DIGEST
DHX
APOP
.

Then.... quits !!!

Replaying manually this dialog I finally ended up understanding that when the Mac OS X server was replying with "GSSAPI" to the AUTH command, Pocket Outlook decided to quit without notice. (GSSAPI is Kerberos.)

Making changes to my Mac OS X server config was not an option (I could have removed GSSAPI from the sasl_mech_list in imapd.conf, but Kerberos is used for the IMAP protocol).

Microsoft and Apple are both to blame here, because the protocols listed in the AUTH command by the OS X server are bogus (they list every protocol even is they are not supported). And Pocket Outlook should not die here. Maybe there is some Kerberos support problem in WM6.1?

Anyway, as the AUTH command sent by the device is not mandatory for the POP3 protocol to work, I just decided to hack Pocket Outlook to not send this command.

After decompiling tmail.exe (pocket outlook mail program) I tracked down to the mailtrns.dll file which in charge of the POP3 / SMTP protocol.

Then all I had to do is change the AUTH command to XXXX in order to solve the problem (with and hex editor). There are several AUTH string in the file, the good one is the one just after the CAPA string.

The mailtrns.dll file is stored in ROM so I could not replace it. The solution was to edit the registry and change the following key:

HKLM\Software\Microsoft\Inbox\Svc\POP3 and change the DLL entry to "mailtrns2.dll". Then copy the patched DLL to \windows\mailtrns2.dll

Then reboot, delete mail accound and add new one (just modifyng won't work has account property is tied to older registry entries).

Hope that this will help users wanting to POP mail from a Mac OS X server!!!!

Please also find attached patched file, to save you time from dumping ROM!

Enodr.

-----

Keywords: Windows Mobile 6.1, WM6.1, POP3, SSL, Mac OS X Server 10.5, Cyrus POP3 server v2.3.8-OS X Server 10.5, Pocket Outlook, tmail.exe, mailtrns.dll, problem, cannot connect