trancos30 / subethasmtp

Automatically exported from code.google.com/p/subethasmtp
Other
1 stars 0 forks source link

Authentication Callback -Not Happening #68

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. I had setup the SMTP object and started the SMTP port using the following 
code
******************************************************************
UsernamePasswordValidator passwordValidator = new SmtpUserValidator();
        EasyAuthenticationHandlerFactory authenticationHandlerFactory = new EasyAuthenticationHandlerFactory(passwordValidator);
        SmtpMessageHandlerFactory messageHandlerFactory = new SmtpMessageHandlerFactory();
        SMTPServer smtpServer = new SMTPServer(messageHandlerFactory, authenticationHandlerFactory);
        smtpServer.setPort(getPort());
        smtpServer.setMaxConnections(getMaxConnections());
        smtpServer.start();
******************************************************************
2.Attached the SmtpUserValidator class

3.Attached are the classes which I used to send test mails

What is the expected output? What do you see instead?

The login method in SmtpUserValidator is NEVER called. Instead the 
messagehandler functions (reading the stream) are executed

What version of the product are you using? On what operating system?

I am using subethasmtp-3.1.7.jar on a linux system. 

Please provide any additional information below.
From the log, I can see the following
***********************************************
INFO   | jvm 1    | 2013/10/28 16:29:41 | [DEBUG] 16:29:41 CommandHandler - 
Added command: AUTH
INFO   | jvm 1    | 2013/10/28 16:29:41 | [DEBUG] 16:29:41 CommandHandler - 
Added command: DATA
INFO   | jvm 1    | 2013/10/28 16:29:41 | [DEBUG] 16:29:41 CommandHandler - 
Added command: EHLO
INFO   | jvm 1    | 2013/10/28 16:29:41 | [DEBUG] 16:29:41 CommandHandler - 
Added command: HELO
INFO   | jvm 1    | 2013/10/28 16:29:41 | [DEBUG] 16:29:41 CommandHandler - 
Added command: HELP
INFO   | jvm 1    | 2013/10/28 16:29:41 | [DEBUG] 16:29:41 CommandHandler - 
Added command: MAIL
INFO   | jvm 1    | 2013/10/28 16:29:41 | [DEBUG] 16:29:41 CommandHandler - 
Added command: NOOP
INFO   | jvm 1    | 2013/10/28 16:29:41 | [DEBUG] 16:29:41 CommandHandler - 
Added command: QUIT
INFO   | jvm 1    | 2013/10/28 16:29:41 | [DEBUG] 16:29:41 CommandHandler - 
Added command: RCPT
INFO   | jvm 1    | 2013/10/28 16:29:41 | [DEBUG] 16:29:41 CommandHandler - 
Added command: RSET
INFO   | jvm 1    | 2013/10/28 16:29:41 | [DEBUG] 16:29:41 CommandHandler - 
Added command: STARTTLS
INFO   | jvm 1    | 2013/10/28 16:29:41 | [DEBUG] 16:29:41 CommandHandler - 
Added command: VRFY
INFO   | jvm 1    | 2013/10/28 16:29:41 | [ INFO] 16:29:41 SMTPServer - SMTP 
server *:25 starting
INFO   | jvm 1    | 2013/10/28 16:29:41 | [ INFO] 16:29:41 StartSmtp - Started 
SMTP 
INFO   | jvm 1    | 2013/10/28 16:29:41 | [ INFO] 16:29:41 ServerThread - SMTP 
server *:25 started
INFO   | jvm 1    | 2013/10/28 16:30:16 | [DEBUG] 16:30:16 Session - SMTP 
connection from 172.16.8.116/172.16.8.116, new connection count: 1
INFO   | jvm 1    | 2013/10/28 16:30:16 | [DEBUG] 16:30:16 Session - Server: 
220 BLADE3 ESMTP SubEthaSMTP 3.1.7
INFO   | jvm 1    | 2013/10/28 16:30:16 | [DEBUG] 16:30:16 Session - Client: 
EHLO RaaghuLaptop-PC
INFO   | jvm 1    | 2013/10/28 16:30:16 | [DEBUG] 16:30:16 Session - Server: 
250-BLADE3
INFO   | jvm 1    | 2013/10/28 16:30:16 | 250-8BITMIME
INFO   | jvm 1    | 2013/10/28 16:30:16 | 250-AUTH PLAIN LOGIN
INFO   | jvm 1    | 2013/10/28 16:30:16 | 250 Ok
INFO   | jvm 1    | 2013/10/28 16:30:16 | [DEBUG] 16:30:16 Session - Client: 
MAIL FROM:<testjava@uniceltech.com>
INFO   | jvm 1    | 2013/10/28 16:30:16 | [ INFO] 16:30:16 
SmtpMessageHandlerFactory - FROM:testjava@uniceltech.com
INFO   | jvm 1    | 2013/10/28 16:30:16 | [DEBUG] 16:30:16 Session - Server: 
250 Ok
INFO   | jvm 1    | 2013/10/28 16:30:16 | [DEBUG] 16:30:16 Session - Client: 
RCPT TO:<raaghu@uniceltech.com>
INFO   | jvm 1    | 2013/10/28 16:30:16 | [ INFO] 16:30:16 
SmtpMessageHandlerFactory - RECIPIENT:raaghu@uniceltech.com
INFO   | jvm 1    | 2013/10/28 16:30:16 | [DEBUG] 16:30:16 Session - Server: 
250 Ok
INFO   | jvm 1    | 2013/10/28 16:30:16 | [DEBUG] 16:30:16 Session - Client: 
DATA
INFO   | jvm 1    | 2013/10/28 16:30:16 | [DEBUG] 16:30:16 Session - Server: 
354 End data with <CR><LF>.<CR><LF>
INFO   | jvm 1    | 2013/10/28 16:30:17 | [ INFO] 16:30:17 
SmtpMessageHandlerFactory - MAIL DATA
INFO   | jvm 1    | 2013/10/28 16:30:17 | [ INFO] 16:30:17 
SmtpMessageHandlerFactory - = = = = = = = = = = = = = = = = = = = = = = = = = = 
= = = = =
INFO   | jvm 1    | 2013/10/28 16:30:17 | [ INFO] 16:30:17 
SmtpMessageHandlerFactory - Received: from RaaghuLaptop-PC ([172.16.8.116])
INFO   | jvm 1    | 2013/10/28 16:30:17 |         by BLADE3
INFO   | jvm 1    | 2013/10/28 16:30:17 |         with SMTP (SubEthaSMTP 3.1.7) 
id HNBLHTYI
INFO   | jvm 1    | 2013/10/28 16:30:17 |         for raaghu@uniceltech.com;
INFO   | jvm 1    | 2013/10/28 16:30:17 |         Mon, 28 Oct 2013 16:30:16 
+0530 (IST)
INFO   | jvm 1    | 2013/10/28 16:30:17 | From: testjava@uniceltech.com
INFO   | jvm 1    | 2013/10/28 16:30:17 | To: raaghu@uniceltech.com
INFO   | jvm 1    | 2013/10/28 16:30:17 | Message-ID: 
<15207001.01382957910465.JavaMail.testjava@uniceltech.com>
INFO   | jvm 1    | 2013/10/28 16:30:17 | Subject: Some Sub3
INFO   | jvm 1    | 2013/10/28 16:30:17 | MIME-Version: 1.0
INFO   | jvm 1    | 2013/10/28 16:30:17 | Content-Type: text/plain; 
charset=us-ascii
INFO   | jvm 1    | 2013/10/28 16:30:17 | Content-Transfer-Encoding: 7bit
INFO   | jvm 1    | 2013/10/28 16:30:17 | 
INFO   | jvm 1    | 2013/10/28 16:30:17 | 
12345678901234567890123456789012345678901234567890123456789012345678901234567890
12345678901234567890123456789012345678901234567890123456789012345678901234567890
12345678901234567890123456789012345678901234567890123456789012345678901234567890
12345678901234567890123456789012345678901234567890123456789012345678901234567890
12345678901234567890123456789012345678901234567890123456789012345678901234567890
12345678901234567890123456789012345678901234567890123456789012345678901234567890
12345678901234567890123456789012345678901234567890123456789012345678901234567890
12345678901234567890123456789012345678901234567890123456789012345678901234567890
12345678901234567890123456789012345678901234567890123456789012345678901234567890
12345678901234567890123456789012345678901234567890123456789012345678901234567890
INFO   | jvm 1    | 2013/10/28 16:30:17 | 
INFO   | jvm 1    | 2013/10/28 16:30:17 | [ INFO] 16:30:17 
SmtpMessageHandlerFactory - = = = = = = = = = = = = = = = = = = = = = = = = = = 
= = = = =
INFO   | jvm 1    | 2013/10/28 16:30:17 | [DEBUG] 16:30:17 Session - Server: 
250 Ok
INFO   | jvm 1    | 2013/10/28 16:30:17 | [ INFO] 16:30:17 
SmtpMessageHandlerFactory - Finished
INFO   | jvm 1    | 2013/10/28 16:30:17 | [DEBUG] 16:30:17 Session - Client: 
QUIT
INFO   | jvm 1    | 2013/10/28 16:30:17 | [DEBUG] 16:30:17 Session - Server: 
221 Bye

***********************************************

Thanks and Regards
Raaghu.K

Original issue reported on code.google.com by raagh...@gmail.com on 28 Oct 2013 at 11:03

Attachments:

GoogleCodeExporter commented 9 years ago
Your log shows that the client does not attempt to authenticate. Therefore your 
UsernamePasswordValidator is not called, and that is the correct behavior. 

The problem is with your client side code, but at the first sight I do not see 
why does JavaMail not attempt to authenticate.

Original comment by hontvari@flyordie.com on 28 Oct 2013 at 12:24

GoogleCodeExporter commented 9 years ago
Sorry for not looking at the client configuration properly. The following 
property was missing in the client

mail.smtp.auth=true.

After setting the same , the validation started working.

Thanks
Raaghu.K

Original comment by raagh...@gmail.com on 28 Oct 2013 at 12:55

GoogleCodeExporter commented 9 years ago
I have one more question on the same lines. Even if the client does not attempt 
to authenticate the SMTP should reject, correct?

Or else what do I need to set if I want Authentication to happen irrespective 
of client setting.

Thanks and Regards
Raaghu.K

Original comment by raagh...@gmail.com on 29 Oct 2013 at 5:38

GoogleCodeExporter commented 9 years ago
Hi.(PS:My E is poor)
I have the same question.

What can I do if I want to authenticate ignoring the client configuration?

If there is not way to do this,it may be one problem.

Authenticate or not should decide by the server side ,not the client side,right?

Original comment by xinwu0...@gmail.com on 9 Dec 2013 at 5:56

GoogleCodeExporter commented 9 years ago
See Issue 50. Another solution is to use SMTPServer.setRequireAuth(true), but 
it is only in trunk, not in the released version. 

Original comment by hontvari@flyordie.com on 9 Dec 2013 at 7:33