Skip to content

Commit

Permalink
fix: match IPv4 mapped IPv6 addresses when searching for SMTP-IP cred…
Browse files Browse the repository at this point in the history
…entials
  • Loading branch information
catphish committed May 15, 2023
1 parent f0a8aca commit 8b525d0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/postal/smtp_server/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ def rcpt_to(data)
else
# User is trying to relay but is not authenticated. Try to authenticate by IP address
@credential = Credential.where(type: "SMTP-IP").all.sort_by { |c| c.ipaddr&.prefix || 0 }.reverse.find do |credential|
credential.ipaddr.include?(@ip_address)
credential.ipaddr.include?(@ip_address) || (credential.ipaddr.ipv4? && credential.ipaddr.ipv4_mapped.include?(@ip_address))
end

if @credential
Expand Down

0 comments on commit 8b525d0

Please sign in to comment.