Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: support optional SMTP auth#14533

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
dannykopping merged 2 commits intomainfromdk/optional-auth
Sep 3, 2024
Merged

Conversation

@dannykopping
Copy link
Contributor

Currently if an SMTP smarthost supports auth mechanisms but does notenforce one to be used, messages will fail to be delivered if blank authentication details are configured.

Currently messages will fail with this misleading error message:

cannot use PLAIN auth, password not defined (see CODER_NOTIFICATIONS_EMAIL_AUTH_PASSWORD)

This is a red herring. It stems from always creating an authentication client even if authentication details are not configured - but the smarthost advertises one or more auth mechanisms.

This change bails out of creating the client if authentication details are blank.

Signed-off-by: Danny Kopping <danny@coder.com>
s.log.Warn(ctx,"skipping auth; no username configured",slog.F("support_mechanisms",mechs))
})
// nolint:nilnil // This is a valid response.
returnnil,nil
Copy link
Member

@mafredrimafredriSep 3, 2024
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Is the new return signature handled by the caller(s)? I see that nilnil is new (unless sasl lib also returns it).

Edit: Might be good to mention this return signature in the function comment as well.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Yup.

// Check for authentication capabilities.ifok,avail:=c.Extension("AUTH");ok {<---entersifauthissupported// Ensure the auth mechanisms available are ones we can use.auth,err:=s.auth(ctx,avail)iferr!=nil {returntrue,xerrors.Errorf("determine auth mechanism: %w",err)}// If so, use the auth mechanism to authenticate.ifauth!=nil {<---bailsoutbecauseauthisniliferr:=c.Auth(auth);err!=nil {returntrue,xerrors.Errorf("%T auth: %w",auth,err)}}}elseif!s.cfg.Auth.Empty() {returnfalse,xerrors.New("no authentication mechanisms supported by server")}<---...continuestoprocessmessagewithoutauth...

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Admittedly the comments could be better about this case, lemme add that.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Seef7fcaf9@mafredri, thanks for the prompt.

Signed-off-by: Danny Kopping <danny@coder.com>
@dannykoppingdannykopping merged commitf23a050 intomainSep 3, 2024
@dannykoppingdannykopping deleted the dk/optional-auth branchSeptember 3, 2024 09:51
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsSep 3, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@mafredrimafredrimafredri approved these changes

@johnstcnjohnstcnjohnstcn approved these changes

Assignees

@dannykoppingdannykopping

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@dannykopping@mafredri@johnstcn

[8]ページ先頭

©2009-2025 Movatter.jp