* [pmg-devel] [PATCH pmg-api 1/2] fix #4811: who regex: test validity on save
@ 2023-06-29 14:14 Dominik Csapak
2023-06-29 14:14 ` [pmg-devel] [PATCH pmg-api 2/2] statistics: fix update virusinfo Dominik Csapak
2023-06-30 6:33 ` [pmg-devel] [PATCH pmg-api 1/2] fix #4811: who regex: test validity on save Dominik Csapak
0 siblings, 2 replies; 4+ messages in thread
From: Dominik Csapak @ 2023-06-29 14:14 UTC (permalink / raw)
To: pmg-devel
and warn only when it's an invalid regex on execution, because users may
have previously had such rules. Otherwise, pmg-smtp-filter will restart
every time it encounters such a rule.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/PMG/RuleDB/WhoRegex.pm | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/PMG/RuleDB/WhoRegex.pm b/src/PMG/RuleDB/WhoRegex.pm
index 5c13604..1db6418 100644
--- a/src/PMG/RuleDB/WhoRegex.pm
+++ b/src/PMG/RuleDB/WhoRegex.pm
@@ -60,6 +60,11 @@ sub save {
defined($self->{address}) || die "undefined address: ERROR";
my $adr = $self->{address};
+
+ # test regex for validity
+ eval { "" =~ /^$adr$/i; };
+ die "invalid regex: $@\n" if $@;
+
$adr =~ s/\\/\\\\/g;
$adr = encode('UTF-8', $adr);
@@ -100,7 +105,12 @@ sub who_match {
my $t = $self->address;
- return $addr =~ m/^$t$/i;
+ my $res = '';
+ eval {
+ $res = $addr =~ m/^$t$/i;
+ };
+ warn "invalid regex: $@\n" if $@;
+ return $res;
}
sub address {
--
2.30.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* [pmg-devel] [PATCH pmg-api 2/2] statistics: fix update virusinfo
2023-06-29 14:14 [pmg-devel] [PATCH pmg-api 1/2] fix #4811: who regex: test validity on save Dominik Csapak
@ 2023-06-29 14:14 ` Dominik Csapak
2023-06-30 6:33 ` [pmg-devel] [PATCH pmg-api 1/2] fix #4811: who regex: test validity on save Dominik Csapak
1 sibling, 0 replies; 4+ messages in thread
From: Dominik Csapak @ 2023-06-29 14:14 UTC (permalink / raw)
To: pmg-devel
by adding the missing closing parenthesis
Fixes: 9972a7c ("postgresql compat: cast result from EXTRACT to INTEGER")
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/PMG/Statistic.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/PMG/Statistic.pm b/src/PMG/Statistic.pm
index 950dbc2..e0dea5e 100644
--- a/src/PMG/Statistic.pm
+++ b/src/PMG/Statistic.pm
@@ -342,7 +342,7 @@ sub update_stats_virusinfo {
my $sql = '';
push @values, "Count = Count + $ref->{count}" if $ref->{count};
- push @values, "MTime = EXTRACT(EPOCH FROM now()::INTEGER)";
+ push @values, "MTime = EXTRACT(EPOCH FROM now())::INTEGER)";
if (scalar (@values)) {
$sql .= "UPDATE VirusInfo SET ";
--
2.30.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [pmg-devel] [PATCH pmg-api 1/2] fix #4811: who regex: test validity on save
2023-06-29 14:14 [pmg-devel] [PATCH pmg-api 1/2] fix #4811: who regex: test validity on save Dominik Csapak
2023-06-29 14:14 ` [pmg-devel] [PATCH pmg-api 2/2] statistics: fix update virusinfo Dominik Csapak
@ 2023-06-30 6:33 ` Dominik Csapak
1 sibling, 0 replies; 4+ messages in thread
From: Dominik Csapak @ 2023-06-30 6:33 UTC (permalink / raw)
To: pmg-devel
please disregard these two patches, the first one is missing
the remaining instances where we match with a regex, and
the second one is wrong, as the closing bracket at the
end is also wrong
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [pmg-devel] [PATCH pmg-api 2/2] statistics: fix update virusinfo
[not found] <CAMMJOTSabA-kmpt-UXJFekYxYuK6wu6KAqqRVG2YGF9=obDvyw@mail.gmail.com>
@ 2024-06-11 11:02 ` Stoiko Ivanov
0 siblings, 0 replies; 4+ messages in thread
From: Stoiko Ivanov @ 2024-06-11 11:02 UTC (permalink / raw)
To: Tony Collins; +Cc: pmg-devel
Hi,
Thanks for putting an effort to contribute to Proxmox Mail Gateway!
Very much appreciated!
The patch you sent did not arrive at our mailing-list - maybe a glitch
with git send-email?
See our developer documentation for how to send patches:
https://pmg.proxmox.com/wiki/index.php/Developer_Documentation
Additionally we would need a signed copy of the Harmony CLA, sent to
office@proxmox.com:
https://pmg.proxmox.com/wiki/index.php/Developer_Documentation#Software_License_and_Copyright
It would help the workflow quite a lot if you'd subscribe to the pmg-devel
mailing list, as else all your mails need to get approved by an
list-administrator, and you might miss replies someone sends to the list:
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel
Thanks,
stoiko
On Fri, 7 Jun 2024 01:17:59 -0500
Tony Collins <tonylee6102@gmail.com> wrote:
>
_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-06-11 11:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-29 14:14 [pmg-devel] [PATCH pmg-api 1/2] fix #4811: who regex: test validity on save Dominik Csapak
2023-06-29 14:14 ` [pmg-devel] [PATCH pmg-api 2/2] statistics: fix update virusinfo Dominik Csapak
2023-06-30 6:33 ` [pmg-devel] [PATCH pmg-api 1/2] fix #4811: who regex: test validity on save Dominik Csapak
[not found] <CAMMJOTSabA-kmpt-UXJFekYxYuK6wu6KAqqRVG2YGF9=obDvyw@mail.gmail.com>
2024-06-11 11:02 ` [pmg-devel] [PATCH pmg-api 2/2] statistics: fix update virusinfo Stoiko Ivanov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal