server: return groups in memberof by cn instead of uid

Fixes #468.
This commit is contained in:
Valentin Tolmer 2023-03-20 21:36:27 +01:00 committed by nitnelave
parent 91ada70c7d
commit 46b8f2a8a5
2 changed files with 2 additions and 6 deletions

View File

@ -45,11 +45,7 @@ pub fn get_user_attribute(
.into_iter() .into_iter()
.flatten() .flatten()
.map(|id_and_name| { .map(|id_and_name| {
format!( format!("cn={},ou=groups,{}", &id_and_name.display_name, base_dn_str).into_bytes()
"uid={},ou=groups,{}",
&id_and_name.display_name, base_dn_str
)
.into_bytes()
}) })
.collect(), .collect(),
"cn" | "displayname" => vec![user.display_name.clone()?.into_bytes()], "cn" | "displayname" => vec![user.display_name.clone()?.into_bytes()],

View File

@ -949,7 +949,7 @@ mod tests {
dn: "uid=bob,ou=people,dc=example,dc=com".to_string(), dn: "uid=bob,ou=people,dc=example,dc=com".to_string(),
attributes: vec![LdapPartialAttribute { attributes: vec![LdapPartialAttribute {
atype: "memberOf".to_string(), 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(), make_search_success(),