public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Markus Frank <m.frank@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH pmg-api] fix #3924: ldap: skip non-smtp proxyAddresses
Date: Fri, 18 Mar 2022 13:37:06 +0100	[thread overview]
Message-ID: <20220318123706.6160-1-m.frank@proxmox.com> (raw)

When an entry in proxyAddresses starts with SIP (or everthing
that is not smtp) no e-mail gets listed on the webpage.
Therefore no quarantine notification messages are sent.

To change this, every entry with another protocol than smtp,
should be skipped.

removed "SMTP" because of lowercase function is called before.

Signed-off-by: Markus Frank <m.frank@proxmox.com>
---
 src/PMG/LDAPCache.pm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/PMG/LDAPCache.pm b/src/PMG/LDAPCache.pm
index df61454..8172329 100755
--- a/src/PMG/LDAPCache.pm
+++ b/src/PMG/LDAPCache.pm
@@ -159,12 +159,17 @@ sub queryusers {
 	    next if !$user->{attributes}->{$attr};
 	    foreach my $mail (@{$user->{attributes}->{$attr}}) {
 		$mail = lc($mail);
+
+		# Check if proxyAddresses entry starts with anything
+		# other than smtp and skip if true
+		next if ($mail =~ m/^(?!.*smtp).*[\:\$]/gs);
+
 		# Test if the Line starts with one of the following lines:
-		# proxyAddresses: [smtp|SMTP]:
+		# proxyAddresses: [smtp]:
 		# and also discard this starting string, so that $mail is only the
 		# address without any other characters...
 
-		$mail =~ s/^(smtp|SMTP)[\:\$]//gs;
+		$mail =~ s/^smtp[\:\$]//gs;
 
 		if ($mail !~ m/[\{\}\\\/]/ && $mail =~ m/^\S+\@\S+$/) {
 		    $umails->{$mail} = 1;
-- 
2.30.2





             reply	other threads:[~2022-03-18 12:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-18 12:37 Markus Frank [this message]
2022-03-23 12:03 ` Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220318123706.6160-1-m.frank@proxmox.com \
    --to=m.frank@proxmox.com \
    --cc=pmg-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal