From f1b86a16eef69756904844383718e9cec4319d64 Mon Sep 17 00:00:00 2001 From: Valentin Tolmer Date: Mon, 2 May 2022 15:29:52 +0200 Subject: [PATCH] ldap: return uids instead of cns for users --- server/src/infra/ldap_handler.rs | 64 +++++++++++++++++--------------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/server/src/infra/ldap_handler.rs b/server/src/infra/ldap_handler.rs index c5038b2..68651a9 100644 --- a/server/src/infra/ldap_handler.rs +++ b/server/src/infra/ldap_handler.rs @@ -125,11 +125,7 @@ fn make_ldap_search_user_result_entry( base_dn_str: &str, attributes: &[String], ) -> Result { - let dn = format!( - "cn={},ou=people,{}", - user.display_name.as_str(), - base_dn_str - ); + let dn = format!("uid={},ou=people,{}", user.user_id.as_str(), base_dn_str); Ok(LdapSearchResultEntry { dn: dn.clone(), attributes: attributes @@ -165,7 +161,7 @@ fn get_group_attribute( .users .iter() .filter(|u| user_filter.map(|f| *u == f).unwrap_or(true)) - .map(|u| format!("cn={},ou=people,{}", u, base_dn_str)) + .map(|u| format!("uid={},ou=people,{}", u, base_dn_str)) .collect(), "1.1" => return Ok(None), _ => bail!("Unsupported group attribute: {}", attribute), @@ -311,7 +307,7 @@ impl LdapHandler