Bug 305 - Cannot send e-mail in b28
Bug#: 305 Product:  i.Scribe/InScribe Version: v2.00 beta28 Platform: PC
OS/Version: Windows XP Status: RESOLVED Severity: blocker Priority: P1
Resolution: FIXED Assigned To: fret@memecode.com Reported By: bugzilla@jbw.pl
Component: Connections
URL: 
Summary: Cannot send e-mail in b28
Opened: 2010-12-10 13:10
Description:   Opened: 2010-12-10 13:10
Upgraded to Beta28, then:
8<--------------------------------------------------
Selecting portable mode based on options file path.
Send(0) got 1 mail to send
Send(0) connecting to SMTP server
H:\Code\Lgi\trunk\src\common\INet\Mail.cpp:1164 - Error: Failed to connect
socket to main.jbw.pl:587
Send(0) H:\Code\Scribe-Branches\v2.00\Code\ScribeSendReceive.cpp:1052
Send(0) H:\Code\Scribe-Branches\v2.00\Code\ScribeSendReceive.cpp:1057, status=0
Send(0) H:\Code\Scribe-Branches\v2.00\Code\ScribeSendReceive.cpp:1060,
Client=01ABE978
Send(0) H:\Code\Scribe-Branches\v2.00\Code\ScribeSendReceive.cpp:1079,
Thread=01ABE818
Send(0) H:\Code\Scribe-Branches\v2.00\Code\ScribeSendReceive.cpp:1080
Send(0) exit
8<--------------------------------------------------

Downgraded back to Beta26 and retry:
8<--------------------------------------------------
Selecting portable mode based on options file path.
Send(0) got 1 mail to send
Send(0) connecting to SMTP server
Send(0) connected
Send(0) Item(0) starting send
Send(0) Item(0) success
Send(0) closing, Error=0
Send(0) H:\Code\Scribe-Branches\v2.00\Code\ScribeSendReceive.cpp:1010
Send(0) H:\Code\Scribe-Branches\v2.00\Code\ScribeSendReceive.cpp:1014
Send(0) H:\Code\Scribe-Branches\v2.00\Code\ScribeSendReceive.cpp:1029, status=1
Send(0) H:\Code\Scribe-Branches\v2.00\Code\ScribeSendReceive.cpp:1051,
Thread=01AA1A50
Send(0) H:\Code\Scribe-Branches\v2.00\Code\ScribeSendReceive.cpp:1052
Send(0) exit
8<--------------------------------------------------

Btw, I cannot mark this issue with actual version number as there's no such
item in the list.

------- Comment #1 From Matthew Allen 2010-12-11 05:20:16 -------
I've reproduced the issue. If you have a username and password that you can use
with that server and you plug those into the SMTP settings it might start
working. However for the case where you don't have a username/password but you
DO want STARTTLS then it's broken.

So I fixed that and tried it again and the SSL library spat the dummy when it
tried to negotiate a secure connection and failed with some unreadable error
message. Maybe the version of OpenSSL I have is too old.

Let me know how you go with the username/password.

------- Comment #2 From Janusz Wisniewski 2010-12-11 17:48:38 -------
(In reply to comment #1)
> If you have a username and password that you can use
> with that server and you plug those into the SMTP settings it might start
> working.

It is not the case. I have authentication turned on as well as encryption.
Additionally on server side there is postfix option "smtpd_tls_auth_only"
turned on, to disallow sniffable authentication. And with these settings b26
works well, whereas b28 doesn't.

I remind you that your mail account on my server is still valid, so you can
inspect connection with the same conditions.

------- Comment #3 From Matthew Allen 2011-01-23 02:57:57 -------
I'm revisiting this at the moment and none of the test accounts I have from you
are working. None of the hosts respond. Can you forward me an account that
Scribe fails on?

The accounts I have all work.

------- Comment #4 From Matthew Allen 2011-02-08 09:11:08 -------
I might be wrong (reopen if I am) but it appears just to be a settings issue.
I've emailed you the settings that work for me... different port and different
security layer.

------- Comment #5 From Matthew Allen 2011-02-08 22:41:25 -------
I'm dumb... bear with me.

------- Comment #6 From Matthew Allen 2011-02-09 00:08:03 -------
Actually fixed something.

Turns out the when you switch on non-blocking sockets in OpenSSL, it's
permanent, and you can't switch back to blocking later (which I was trying to
do). I want non-blocking for the connect (so I can cancel it if needed), but
blocking for the rest of the connection. The change to non-blocking is evident
between beta26 and beta28 when I diff'ed the svn versions of the SSL code.

So I have had to apply non-blocking loops to most (all?) the calls to the
various read/write functions. This also buys me the ability to pick the timeout
on socket connections.

I've tested with your 587 port SMTP server using STARTTLS and it's working.
It's not extensively tested but it is a lot better than the beta28's outright
fail. I will continue to test the SSL code over the next week or so and
re-release if needed to sort out any new bugs.

You sir, deserve a beer (or nice drink of choice)! for putting up with my crap.