Fix krb5_name escape issue

This commit is contained in:
Quantum 2025-07-20 18:42:47 -04:00
parent b9d6630b1a
commit cfa4ff1c52

View file

@ -142,7 +142,7 @@ def auth_spnego(context: Context, next_url: str) -> Response:
ldap_ctx.bind_s(LDAP_BIND_DN, LDAP_BIND_AUTHTOK, ldap.AUTH_SIMPLE) ldap_ctx.bind_s(LDAP_BIND_DN, LDAP_BIND_AUTHTOK, ldap.AUTH_SIMPLE)
ldap_filter = '(&(memberOf=%s)(krbPrincipalName=%s))' % ( ldap_filter = '(&(memberOf=%s)(krbPrincipalName=%s))' % (
escape_filter_chars(context.ldap_group), escape_filter_chars(context.ldap_group),
escape_filter_chars(krb5_name), escape_filter_chars(str(krb5_name)),
) )
result = ldap_ctx.search_s(LDAP_SEARCH_BASE, ldap.SCOPE_SUBTREE, ldap_filter, ['cn']) result = ldap_ctx.search_s(LDAP_SEARCH_BASE, ldap.SCOPE_SUBTREE, ldap_filter, ['cn'])
if not result: if not result: