浏览代码

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 13 年之前
父节点
当前提交
8ba2982457
共有 1 个文件被更改,包括 5 次插入0 次删除
  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 */
 		/* Normalize the value of userdn and append it to ret_str */
 		slapi_sdn_init_dn_byref(&sdn, p);
 		slapi_sdn_init_dn_byref(&sdn, p);
 		dn = slapi_sdn_get_dn(&sdn);
 		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):/// */
 		/* append up to ldap(s):/// */
 		aclutil_str_append_ext(dest, destlen, start, p - start);
 		aclutil_str_append_ext(dest, destlen, start, p - start);
 		/* append the DN part */
 		/* append the DN part */