From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 51C871FF0B7 for ; Fri, 16 Oct 2026 14:31:28 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 21A65214F0; Fri, 16 Oct 2026 14:31:28 +0200 (CEST) From: Dominik Csapak To: pmg-devel@lists.proxmox.com Subject: [PATCH yew-comp 2/2] fix #8175: http client: allow different userids in tickets for PMG Date: Fri, 16 Oct 2026 14:31:08 +0200 Message-ID: <20261016123124.2970062-3-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261016123124.2970062-1-d.csapak@proxmox.com> References: <20261016123124.2970062-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.357 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: NL7NCZRAJYSMUEWCKZKTUAV7GTBYSUJM X-Message-ID-Hash: NL7NCZRAJYSMUEWCKZKTUAV7GTBYSUJM X-MailFrom: d.csapak@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Mail Gateway development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: In PMG's quarantine, the userid supplied is not the one returned by the ticket (e.g. an alias in LDAP or simply the '@quarantine' suffix). Use the new 'ignore_userid' flag in proxmox-login to disable the userid check there, but only for PMG. By providing a default implementation (that keeps the default behavior), it isn't necessary to adapt any other projects. Signed-off-by: Dominik Csapak --- src/http_client_wasm.rs | 10 ++++++++-- src/proxmox_product.rs | 10 ++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/http_client_wasm.rs b/src/http_client_wasm.rs index c8bdecf..53423d4 100644 --- a/src/http_client_wasm.rs +++ b/src/http_client_wasm.rs @@ -134,7 +134,10 @@ impl HttpClientWasm { let username = username.into(); let password = password.into(); - let login = Login::new("", username, password); + let mut login = Login::new("", username, password); + if self.project.ticket_ignore_userid() { + login.ignore_userid(); + } let request = login.request(); let request = Self::post_request_builder(&request.url, request.content_type, &request.body)?; @@ -146,7 +149,10 @@ impl HttpClientWasm { pub async fn refresh(&self, username: impl Into) -> Result { let username = username.into(); - let login = Login::renew_with_cookie("", username); + let mut login = Login::renew_with_cookie("", username); + if self.project.ticket_ignore_userid() { + login.ignore_userid(); + } let request = login.request(); let request = Self::post_request_builder(&request.url, request.content_type, &request.body)?; diff --git a/src/proxmox_product.rs b/src/proxmox_product.rs index 0e81cc8..8267039 100644 --- a/src/proxmox_product.rs +++ b/src/proxmox_product.rs @@ -20,6 +20,12 @@ pub trait ProjectInfo { fn subscription_url(&self) -> &'static str { "" } + + /// Returns if the product needs to ignore mismatching userids in tickets. + /// This is useful when doing LDAP login with email aliases (like in the PMG quarantine) + fn ticket_ignore_userid(&self) -> bool { + false + } } /// Enumerate the different Proxmox products. @@ -76,4 +82,8 @@ impl ProjectInfo for ExistingProduct { fn subscription_url(&self) -> &'static str { "/nodes/localhost/subscription" } + + fn ticket_ignore_userid(&self) -> bool { + matches!(self, ExistingProduct::PMG) + } } -- 2.47.3