Skip to content

Commit

Permalink
fix(smtp-server): add additional information to cram-md5 log entries
Browse files Browse the repository at this point in the history
  • Loading branch information
adamcooke committed Mar 12, 2024
1 parent 5ed94f6 commit 9982bb8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/lib/smtp_server/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def auth_cram_md5(data)
org_permlink, server_permalink = username.split(/[\/_]/, 2)
server = ::Server.includes(:organization).where(organizations: { permalink: org_permlink }, permalink: server_permalink).first
if server.nil?
logger&.warn "Authentication failure for #{@ip_address}"
logger&.warn "Authentication failure for #{@ip_address} (no server found matching #{username})"
increment_error_count("invalid-credentials")
next "535 Denied"
end
Expand All @@ -264,12 +264,13 @@ def auth_cram_md5(data)

@credential = credential
@credential.use
logger&.debug "Authenticated with with credential #{credential.id}"
grant = "235 Granted for #{credential.server.organization.permalink}/#{credential.server.permalink}"
break
end

if grant.nil?
logger&.warn "Authentication failure for #{@ip_address}"
logger&.warn "Authentication failure for #{@ip_address} (invalid credential)"
increment_error_count("invalid-credentials")
next "535 Denied"
end
Expand Down

0 comments on commit 9982bb8

Please sign in to comment.