Tk Library Source Code

View Ticket
Login
Ticket UUID: 1658061
Title: Poor/misleading diagnostics from smtp::sendmessage
Type: Bug Version: None
Submitter: kot Created on: 2007-02-12 14:04:16
Subsystem: smtp Assigned To: patthoyts
Priority: 3 Low Severity:
Status: Closed Last Modified: 2007-10-08 18:24:41
Resolution: Fixed Closed By: patthoyts
    Closed on: 2007-10-08 11:24:41
Description:
After switching to a new server, my TCL mailing list software stopped working -- sending to all addresses would fail with "read from server timed out".

The server (on localhost) would log simply "unexpectedly closed connection".

It was not until I modified the script to print out the entire errorInfo, that I saw the _real_ problem: "can't find package tls".

Similarly, on another installation, the SMTP server was modified (unbeknown to me) to require username and password. Instead of relaying the "553 Authorization required" error message to me, smtp::sendmessage began complaining:

key message-id not in header
    while executing
"error "key $mixed not in header""
    ("default" arm line 5)
    invoked from within
"switch -- $key {
        "" {
            set result ""
            foreach lower $state(lowerL) mixed $state(mixedL) {
                lappend result..."
    (procedure "::mime::getheader" line 7)
    invoked from within
"::mime::getheader $part ${message-idL} "
    invoked from within
[... my code ...]
User Comments: patthoyts added on 2007-10-08 18:24:41:
Logged In: YES 
user_id=202636
Originator: NO

This is hard to avoid and is one reason we have unset -nocomplain in 8.4+. I've masked the errorInfo in the parts covered here.

kot added on 2007-02-13 02:59:42:
Logged In: YES 
user_id=173641
Originator: YES

Thanks for the link, Andreas -- Pat's patch solved the time-out problem and I added it to the FreeBSD port.

The problem of misleading diagnostics in errorInfo still exists, though. It would seem to me, that errorInfo should either be empty or useful upon return from the library.

In the cases of this timeouts I was having, it contained something about TLS at first and then -- when I disabled TLS on the server -- some other info useless to the caller:

can't unset "state(route)": no such element in array
    while executing
"unset state($prop) "
    invoked from within
"smtp::sendmessage ::mime::1 -servers {localhost}  -originator .....

Yours,

      -mi

andreas_kupries added on 2007-02-13 02:34:10:
Logged In: YES 
user_id=75003
Originator: NO

The relevant SF bug is
    http://sourceforge.net/tracker/index.php?func=detail&aid=827436&group_id=12883&atid=112883
There is no patch file attached however. The relevant diff in the CVS is
    http://tcllib.cvs.sourceforge.net/tcllib/tcllib/modules/mime/smtp.tcl?r1=1.44&r2=1.45

kot added on 2007-02-13 02:15:04:
Logged In: YES 
user_id=173641
Originator: YES

TLS and the missing "message-id" messages all come from the errorInfo. If the smtp-package relies on catch(n), it should, probably, reset errorInfo so as not to confuse the library-users with the expected-and-caught errors...

This -- the wrong information in errorInfo upon failure -- is the subject of this bug report.

As for the actual time-out problem, could you give me a link to Pat's fix in CVS? I'll apply it here and see, if it solves the problem. The new machine is using tcllib-1.9 (Trf not installed), whereas the old one had tcllib-1.7 and Trf.

Thanks!

andreas_kupries added on 2007-02-13 01:51:08:
Logged In: YES 
user_id=75003
Originator: NO

Redirecting to Pat for the TLS problem ... I should note that I thought that smtp could work without TLS, i.e. that it would 'catch' a 'package require tls'. Actually I think that it does that, however the code may not clear the ::errorInfo from that caught 'package require'. Of course, if the server requires SSL then smtp has no choice but to fail if TLS is missing. In that case I agree that the error message should be better, however I have myself no idea where to look and what to modify.

Regarding the missing '.' ... Is the version of smtp/mime the same, or was that changed too ? Which version of smtp/mime/tcllib is used btw. ?
Looking at the ChangeLog I see for example that Pat fixed something in the generation of the terminating '.' for the non-Trf path. This was Nov 6, 2006, i.e. about a month after the release of Tcllib 1.9. Given that you might wish to test if you still have the problem when using the Tcllib cvs head.

There was for example a bug (827436

kot added on 2007-02-12 21:51:32:
Logged In: YES 
user_id=173641
Originator: YES

Actually, the first problem (server timeout) is still here even after I configured the server to not require SSL from localhost clients.

According to tcpdump, the message is fed to the server in its entirety, but without the ending `.'... Not sure.

The server's features are:

250-bonkers.example.com Hello localhost [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP

Sender and recipient are Ok-ed, then:

354 Enter mail, end with "." on a line by itself

To this sendmessage replies with the entire message, but without the "."

The server is running sendmail-8.13.8 and no longer offers SSL to localhost clients.