浏览代码

Ticket 47569 - ACIs do not allow attribute subtypes in targetattr keyword

When validating the targetattr ACI keyword, we check if the attribute
is defined in the schema.  This schema check fails if the attribute
has a subtype present.

This patch makes the attribute syntax lookup function check if a
subtype was specified before performing the looking.  If a subtype
is specified, it is stripped off and we just use the base attribute
name to lookup the syntax from the hashtable.
Nathan Kinder 12 年之前
父节点
当前提交
cb73cf2b09
共有 1 个文件被更改,包括 19 次插入1 次删除
  1. 19 1
      ldap/servers/slapd/attrsyntax.c

+ 19 - 1
ldap/servers/slapd/attrsyntax.c

@@ -537,10 +537,28 @@ int
 attr_syntax_exists(const char *attr_name)
 attr_syntax_exists(const char *attr_name)
 {
 {
 	struct asyntaxinfo	*asi;
 	struct asyntaxinfo	*asi;
+	char *check_attr_name = NULL;
+	char *p = NULL;
+	int free_attr = 0;
+
+	/* Ignore any attribute subtypes. */
+	if (p = strchr(attr_name, ';')) {
+		int check_attr_len = p - attr_name + 1;
+
+		check_attr_name = (char *)slapi_ch_malloc(check_attr_len);
+		PR_snprintf(check_attr_name, check_attr_len, "%s", attr_name);
+		free_attr = 1;
+ 	} else {
+		check_attr_name = attr_name;
+	}
 
 
-	asi = attr_syntax_get_by_name(attr_name);
+	asi = attr_syntax_get_by_name(check_attr_name);
 	attr_syntax_return( asi );
 	attr_syntax_return( asi );
 
 
+	if (free_attr) {
+		slapi_ch_free_string(&check_attr_name);
+	}
+
 	if ( asi != NULL )
 	if ( asi != NULL )
 	{
 	{
 		return 1;
 		return 1;