public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pmg-devel] [PATCH pmg-api] quarantine: ticket: use raw pmail for ticket assembly
@ 2023-09-13 16:20 Stoiko Ivanov
  2023-09-22  9:37 ` Stoiko Ivanov
  2023-09-26  7:06 ` [pmg-devel] applied: " Thomas Lamprecht
  0 siblings, 2 replies; 3+ messages in thread
From: Stoiko Ivanov @ 2023-09-13 16:20 UTC (permalink / raw)
  To: pmg-devel

currently the quarantine report does not work if the recipient has
some encodable characters in their local part - e.g.
'some&other@domain.example'

when clicking on the links on the report the user gets logged in
however their quarantine list is empty (the call to
/api2/json/quarantine/spamusers returns 403)

With this patch the ticket (thus also the username remains
'some&other@domain.example' instead of 'some&other@domain.example'
and the listing works as expected

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
Tested this quickly here in my test-setup - but would really need some
feedback on potential pitfalls, as this is authentication-related code...

 src/PMG/CLI/pmgqm.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PMG/CLI/pmgqm.pm b/src/PMG/CLI/pmgqm.pm
index 7293579..987ddc9 100755
--- a/src/PMG/CLI/pmgqm.pm
+++ b/src/PMG/CLI/pmgqm.pm
@@ -316,7 +316,7 @@ __PACKAGE__->register_method ({
 		$data->{pmail_raw} = $ref->{pmail};
 		$data->{managehref} = "$protocol_fqdn_port/quarantine";
 		if ($data->{authmode} ne 'ldap') {
-		    $data->{ticket} = PMG::Ticket::assemble_quarantine_ticket($data->{pmail});
+		    $data->{ticket} = PMG::Ticket::assemble_quarantine_ticket($data->{pmail_raw});
 		    my $esc_ticket = uri_escape($data->{ticket});
 		    $data->{managehref} .= "?ticket=${esc_ticket}";
 		}
-- 
2.39.2





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [pmg-devel] [PATCH pmg-api] quarantine: ticket: use raw pmail for ticket assembly
  2023-09-13 16:20 [pmg-devel] [PATCH pmg-api] quarantine: ticket: use raw pmail for ticket assembly Stoiko Ivanov
@ 2023-09-22  9:37 ` Stoiko Ivanov
  2023-09-26  7:06 ` [pmg-devel] applied: " Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Stoiko Ivanov @ 2023-09-22  9:37 UTC (permalink / raw)
  To: pmg-devel

The original reporter tested this patch on their machine - it seems to
resolve their issue

On Wed, 13 Sep 2023 18:20:46 +0200
Stoiko Ivanov <s.ivanov@proxmox.com> wrote:

> currently the quarantine report does not work if the recipient has
> some encodable characters in their local part - e.g.
> 'some&other@domain.example'
> 
> when clicking on the links on the report the user gets logged in
> however their quarantine list is empty (the call to
> /api2/json/quarantine/spamusers returns 403)
> 
> With this patch the ticket (thus also the username remains
> 'some&other@domain.example' instead of 'some&amp;other@domain.example'
> and the listing works as expected
> 
> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
> ---
> Tested this quickly here in my test-setup - but would really need some
> feedback on potential pitfalls, as this is authentication-related code...
> 
>  src/PMG/CLI/pmgqm.pm | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/PMG/CLI/pmgqm.pm b/src/PMG/CLI/pmgqm.pm
> index 7293579..987ddc9 100755
> --- a/src/PMG/CLI/pmgqm.pm
> +++ b/src/PMG/CLI/pmgqm.pm
> @@ -316,7 +316,7 @@ __PACKAGE__->register_method ({
>  		$data->{pmail_raw} = $ref->{pmail};
>  		$data->{managehref} = "$protocol_fqdn_port/quarantine";
>  		if ($data->{authmode} ne 'ldap') {
> -		    $data->{ticket} = PMG::Ticket::assemble_quarantine_ticket($data->{pmail});
> +		    $data->{ticket} = PMG::Ticket::assemble_quarantine_ticket($data->{pmail_raw});
>  		    my $esc_ticket = uri_escape($data->{ticket});
>  		    $data->{managehref} .= "?ticket=${esc_ticket}";
>  		}





^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pmg-devel] applied: [PATCH pmg-api] quarantine: ticket: use raw pmail for ticket assembly
  2023-09-13 16:20 [pmg-devel] [PATCH pmg-api] quarantine: ticket: use raw pmail for ticket assembly Stoiko Ivanov
  2023-09-22  9:37 ` Stoiko Ivanov
@ 2023-09-26  7:06 ` Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2023-09-26  7:06 UTC (permalink / raw)
  To: Stoiko Ivanov, pmg-devel

Am 13/09/2023 um 18:20 schrieb Stoiko Ivanov:
> currently the quarantine report does not work if the recipient has
> some encodable characters in their local part - e.g.
> 'some&other@domain.example'
> 
> when clicking on the links on the report the user gets logged in
> however their quarantine list is empty (the call to
> /api2/json/quarantine/spamusers returns 403)
> 
> With this patch the ticket (thus also the username remains
> 'some&other@domain.example' instead of 'some&amp;other@domain.example'
> and the listing works as expected
> 
> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
> ---
> Tested this quickly here in my test-setup - but would really need some
> feedback on potential pitfalls, as this is authentication-related code...
> 
>  src/PMG/CLI/pmgqm.pm | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
>

applied, took the liberty to reword/add a bit to the commit message, thanks!




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-09-26  7:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-13 16:20 [pmg-devel] [PATCH pmg-api] quarantine: ticket: use raw pmail for ticket assembly Stoiko Ivanov
2023-09-22  9:37 ` Stoiko Ivanov
2023-09-26  7:06 ` [pmg-devel] applied: " Thomas Lamprecht

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