Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auth should be mandatory for MAIL, RCPT & DATA commands when server.AuthDisabled is false #216

Closed
mukul-brevo opened this issue Mar 25, 2023 · 2 comments · Fixed by #222
Closed

Comments

@mukul-brevo
Copy link

In current scenario, user is able to send MAIL, RCPT & DATA commands even when server.AuthDisabled=false.

In below image attached, i did not do any auth but still i was able to issue commands.
image

I also found this error declared for exact use case but it is not used any where except of the test cases.
image
Maybe the behaviour got broken with some change?

However this is highly unexpected and should be fixed as soon as possible, as we are currently blocked in our development.

I don't know how others are handling this?

It should be handled exactly here before going into the actual command handling.

@foxcpp
Copy link
Collaborator

foxcpp commented Mar 26, 2023

This is intentional, some SMTP servers may make authentication optional. You are expected to track authentication status in your backend implementation and return ErrAuthRequired from MAIL/RCPT/DATA if it is actually required.

@mukul-brevo
Copy link
Author

@foxcpp I completely understand the use case behind the optional auth but what is the need of having AuthDisabled as an option to server then

emersion added a commit that referenced this issue Apr 5, 2023
By design, go-smtp won't check whether the session is authenticated
during MAIL/RCPT/DATA commands. Make this more explicit by checking
whether the session is authenticated in the example.

Closes: #216
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants