From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id C15AB1FF17A for ; Tue, 9 Dec 2025 15:02:41 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 5FD642BF8; Tue, 9 Dec 2025 15:03:21 +0100 (CET) From: Shannon Sterz To: yew-devel@lists.proxmox.com Date: Tue, 9 Dec 2025 15:03:17 +0100 Message-ID: <20251209140317.233159-1-s.sterz@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1765288993127 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.091 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox.com] Subject: [yew-devel] [PATCH yew-comp] auth edit ldap: fix updating a realm to use anonymous search X-BeenThere: yew-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Yew framework devel list at Proxmox List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Yew framework devel list at Proxmox Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: yew-devel-bounces@lists.proxmox.com Sender: "yew-devel" previously this didn't work as the fields were still presnent in the submitted data. Signed-off-by: Shannon Sterz --- this came up when looking into anonymous search with ad realms [1]. note that it's not clear what the issue in question there ist. for now it still looks like a configuration issue that might involve that "automagic" nature of how our Rust-based AD support determines the base-dn. [1]: https://forum.proxmox.com/threads/pdm-1-0-1-unable-to-add-ad-realm-with-anonymous-search.177766/ src/auth_edit_ldap.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/auth_edit_ldap.rs b/src/auth_edit_ldap.rs index 5a2a906..eb8b98b 100644 --- a/src/auth_edit_ldap.rs +++ b/src/auth_edit_ldap.rs @@ -160,7 +160,7 @@ async fn update_item(form_ctx: FormContext, base_url: String) -> Result<(), Erro let data = format_sync_and_default_options(&mut data); - let data = delete_empty_values( + let mut data = delete_empty_values( &data, &[ "server2", @@ -176,6 +176,26 @@ async fn update_item(form_ctx: FormContext, base_url: String) -> Result<(), Erro true, ); + let anonymous_search = form_ctx + .read() + .get_field_value("anonymous_search") + .and_then(|v| v.as_bool()) + .unwrap_or(false); + + if anonymous_search { + if let Some(data) = data.as_object_mut() { + data.remove("bind-dn"); + data.remove("password"); + } + + if let Some(vec) = data["delete"].as_array_mut() { + vec.push("bind-dn".into()); + vec.push("password".into()); + } else { + data["delete"] = ["bind-dn", "password"].into(); + } + } + let name = form_ctx.read().get_field_text("realm"); let url = format!("{base_url}/{}", percent_encode_component(&name)); -- 2.47.3 _______________________________________________ yew-devel mailing list yew-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/yew-devel