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

C# SMTPClient uses lowercase login AUTH method #542

Open
TheRolfFR opened this issue Feb 26, 2025 · 2 comments · May be fixed by #547
Open

C# SMTPClient uses lowercase login AUTH method #542

TheRolfFR opened this issue Feb 26, 2025 · 2 comments · May be fixed by #547

Comments

@TheRolfFR
Copy link

Hello,

I am currently implementing a smtp handler from requests coming from a C# System.Net.Mail.SMTPClient instance with credentials (code).

I didn't understand the problem until I discovered with tcpdump that the login method is spelled "login" in lowercase:
Image

and indeed your code is not doing any case matching on the said authentication method:
Image

Would it be possible to transform method to uppercase before handling it?

mechanism = mechanism.upper()

Thanks in advance.

@fietensen
Copy link

fietensen commented Mar 19, 2025

Yes, RFC 4954 Section 8 states the sasl-mech should be case insensitive. It seems aiosmtpd.smtp provides the auth_mechanism decorator that does just what you're trying to achieve:

from aiosmtpd.smtp import auth_mechanism
# ...
    @auth_mechanism("login")
    async def auth_LOGIN(self, smtp: SMTP, args: list[str]) -> AuthResult:
# ...

See: https://aiosmtpd.aio-libs.org/en/latest/auth.html#auth-mechanism-hooks

@fietensen
Copy link

Yes, RFC 4954 Section 8 states the sasl-mech should be case insensitive. It seems aiosmtpd.smtp provides the auth_mechanism decorator that does just what you're trying to achieve:

from aiosmtpd.smtp import auth_mechanism

...

@auth_mechanism("login")
async def auth_LOGIN(self, smtp: SMTP, args: list[str]) -> AuthResult:

...

See: https://aiosmtpd.aio-libs.org/en/latest/auth.html#auth-mechanism-hooks

Nevermind.. this actually just worked because I had fixed it in the smtp.py prior to testing, I'll open a PR later

@fietensen fietensen linked a pull request Mar 19, 2025 that will close this issue
3 tasks
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