Ver Fonte

Bug #361: Bad DNs in ACIs can segfault ns-slapd

A bad userdn will make the DN normalization fail.  This sets dn to NULL,
and the server will attempt to access the NULL dn.
The fix is to just return with an error if the normalization fails since
the DN is invalid.
Reviewed by: rmeggins
Charles Lopes há 13 anos atrás
pai
commit
8ba2982457
1 ficheiros alterados com 5 adições e 0 exclusões
  1. 5 0
      ldap/servers/plugins/acl/aclparse.c

+ 5 - 0
ldap/servers/plugins/acl/aclparse.c

@@ -566,6 +566,11 @@ __aclp__copy_normalized_str (char *src, char *endsrc, char *start,
 		/* Normalize the value of userdn and append it to ret_str */
 		slapi_sdn_init_dn_byref(&sdn, p);
 		dn = slapi_sdn_get_dn(&sdn);
+		/* Normalization failed so return an error (-1) */
+		if (!dn) {
+			slapi_sdn_done(&sdn);
+			return -1;
+		}
 		/* append up to ldap(s):/// */
 		aclutil_str_append_ext(dest, destlen, start, p - start);
 		/* append the DN part */