From 06b6653dffabafcc9dfb158cebdc12e862ba650a Mon Sep 17 00:00:00 2001 From: Valentin Tolmer Date: Mon, 8 Nov 2021 10:14:07 +0100 Subject: [PATCH] ldap: Test more invalid DNs --- server/src/infra/ldap_handler.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/server/src/infra/ldap_handler.rs b/server/src/infra/ldap_handler.rs index 345719a..cfa736f 100644 --- a/server/src/infra/ldap_handler.rs +++ b/server/src/infra/ldap_handler.rs @@ -865,6 +865,22 @@ mod tests { ldap_handler.do_bind(&request).await.0, LdapResultCode::NamingViolation, ); + let request = LdapBindRequest { + dn: "cn=bob,ou=people,dc=example,dc=fr".to_string(), + cred: LdapBindCred::Simple("pass".to_string()), + }; + assert_eq!( + ldap_handler.do_bind(&request).await.0, + LdapResultCode::NamingViolation, + ); + let request = LdapBindRequest { + dn: "cn=bob=test,ou=people,dc=example,dc=com".to_string(), + cred: LdapBindCred::Simple("pass".to_string()), + }; + assert_eq!( + ldap_handler.do_bind(&request).await.0, + LdapResultCode::NamingViolation, + ); } #[test]