davidmoten / subethasmtp

SubEtha SMTP is a Java library for receiving SMTP mail
Other
149 stars 40 forks source link

NoSuchElementException on authentication #91

Closed martijnhoekstra closed 1 year ago

martijnhoekstra commented 1 year ago

I have a stack trace, but sadly no reproduction case

java.util.NoSuchElementException: null at java.base/java.util.StringTokenizer.nextToken(StringTokenizer.java:349) at org.subethamail.smtp.auth.LoginAuthenticationHandlerFactory$Handler.auth(LoginAuthenticationHandlerFactory.java:71) at org.subethamail.smtp.auth.MultipleAuthenticationHandlerFactory$Handler.auth(MultipleAuthenticationHandlerFactory.java:99) at org.subethamail.smtp.internal.command.AuthCommand.execute(AuthCommand.java:97) at org.subethamail.smtp.internal.server.RequireTLSCommandWrapper.execute(RequireTLSCommandWrapper.java:32) at org.subethamail.smtp.internal.server.CommandHandler.handleCommand(CommandHandler.java:86) at org.subethamail.smtp.server.Session.runCommandLoop(Session.java:252) at org.subethamail.smtp.server.Session.run(Session.java:166) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829)

clientInput must be null or empty here, but I didn't look in to what that means.

davidmoten commented 1 year ago

Can you be more specific about what input brings this about and what you want to happen?

martijnhoekstra commented 1 year ago

I found the issue, and created a PR for it: https://github.com/davidmoten/subethasmtp/pull/105

The issue occurs for AUTH LOGIN when the username or password is empty. The first call to nextToken then fails with NoSuchElementException.

davidmoten commented 1 year ago

Thanks very much @martijnhoekstra for PR! It has been merged and is in release 6.0.6 which is on Maven Central now.