From 46b8f2a8a5a2d87d693fb8b9a6d2c561069dd93b Mon Sep 17 00:00:00 2001 From: Valentin Tolmer Date: Mon, 20 Mar 2023 21:36:27 +0100 Subject: [PATCH] server: return groups in memberof by cn instead of uid Fixes #468. --- server/src/domain/ldap/user.rs | 6 +----- server/src/infra/ldap_handler.rs | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/server/src/domain/ldap/user.rs b/server/src/domain/ldap/user.rs index bad6764..fec9b95 100644 --- a/server/src/domain/ldap/user.rs +++ b/server/src/domain/ldap/user.rs @@ -45,11 +45,7 @@ pub fn get_user_attribute( .into_iter() .flatten() .map(|id_and_name| { - format!( - "uid={},ou=groups,{}", - &id_and_name.display_name, base_dn_str - ) - .into_bytes() + format!("cn={},ou=groups,{}", &id_and_name.display_name, base_dn_str).into_bytes() }) .collect(), "cn" | "displayname" => vec![user.display_name.clone()?.into_bytes()], diff --git a/server/src/infra/ldap_handler.rs b/server/src/infra/ldap_handler.rs index 1478ec8..81d320c 100644 --- a/server/src/infra/ldap_handler.rs +++ b/server/src/infra/ldap_handler.rs @@ -949,7 +949,7 @@ mod tests { dn: "uid=bob,ou=people,dc=example,dc=com".to_string(), attributes: vec![LdapPartialAttribute { atype: "memberOf".to_string(), - vals: vec![b"uid=rockstars,ou=groups,dc=example,dc=com".to_vec()] + vals: vec![b"cn=rockstars,ou=groups,dc=example,dc=com".to_vec()] }], }), make_search_success(),