mirror of
https://github.com/stalwartlabs/mail-server.git
synced 2025-01-24 00:29:56 +08:00
Do not include IP addresses in greylist keys
This commit is contained in:
parent
3ae1d6eb9b
commit
fe5d7b33ed
1 changed files with 11 additions and 14 deletions
|
@ -310,21 +310,18 @@ impl<T: SessionStream> Session<T> {
|
||||||
.grey_list
|
.grey_list
|
||||||
.filter(|_| self.data.authenticated_as.is_none())
|
.filter(|_| self.data.authenticated_as.is_none())
|
||||||
{
|
{
|
||||||
let mut key = Vec::with_capacity(64);
|
let from_addr = self
|
||||||
|
.data
|
||||||
|
.mail_from
|
||||||
|
.as_ref()
|
||||||
|
.unwrap()
|
||||||
|
.address_lcase
|
||||||
|
.as_bytes();
|
||||||
|
let to_addr = self.data.rcpt_to.last().unwrap().address_lcase.as_bytes();
|
||||||
|
let mut key = Vec::with_capacity(from_addr.len() + to_addr.len() + 1);
|
||||||
key.push(KV_GREYLIST);
|
key.push(KV_GREYLIST);
|
||||||
match self.data.remote_ip {
|
key.extend_from_slice(from_addr);
|
||||||
std::net::IpAddr::V4(ipv4_addr) => key.extend_from_slice(&ipv4_addr.octets()),
|
key.extend_from_slice(to_addr);
|
||||||
std::net::IpAddr::V6(ipv6_addr) => key.extend_from_slice(&ipv6_addr.octets()),
|
|
||||||
};
|
|
||||||
key.extend_from_slice(
|
|
||||||
self.data
|
|
||||||
.mail_from
|
|
||||||
.as_ref()
|
|
||||||
.unwrap()
|
|
||||||
.address_lcase
|
|
||||||
.as_bytes(),
|
|
||||||
);
|
|
||||||
key.extend_from_slice(self.data.rcpt_to.last().unwrap().address_lcase.as_bytes());
|
|
||||||
|
|
||||||
match self.server.in_memory_store().key_exists(key.clone()).await {
|
match self.server.in_memory_store().key_exists(key.clone()).await {
|
||||||
Ok(true) => (),
|
Ok(true) => (),
|
||||||
|
|
Loading…
Reference in a new issue