voodoodyne / subethasmtp

SubEtha SMTP is a Java library for receiving SMTP mail
Other
343 stars 138 forks source link

java.util.NoSuchElementException in AuthenticationHandlerFactory #60

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
This is the auth plain transaction

auth plain
334 Ok
<empty string>
421 4.3.0 Mail system failure, closing transmission channel
Connection closed by foreign host.

and this is the corresponding log

18:01:46.113 ERROR org.subethamail.smtp.server.Session - Unexpected error in 
the SMTP handler thread
java.util.NoSuchElementException: null
    at java.util.StringTokenizer.nextToken(StringTokenizer.java:349) ~[na:1.7.0_06]
    at org.subethamail.smtp.auth.PlainAuthenticationHandlerFactory$Handler.auth(PlainAuthenticationHandlerFactory.java:59) ~[subethasmtp-3.1.7.jar:June 16 2012]

the problem is the empty string in auth transaction.
I've attacched a small patch that fix this with the following new output:

auth plain
334 Ok
<empty string>
501 Invalid command argument, does not contain NUL

the issue is still present in login authentication handler(but in this case the 
fix could be better, for example if username is empty, don't request password 
and exit with error).

regards

Original issue reported on code.google.com by zuccal...@gmail.com on 24 Mar 2013 at 7:11

Attachments: