瀏覽代碼

Bug 691574 - (cov#10577) Check return types when adding RDN CSNs

We are not checking the return types when searching for RDN attrs
and values to create the RDN CSNs.  This could result in us using
a deleted attribute or value when we should only be looking at
present attributes and values.  Checking the return type allows
us to verify that we found a present attribute or value.
Nathan Kinder 14 年之前
父節點
當前提交
d55024da11
共有 1 個文件被更改,包括 5 次插入4 次删除
  1. 5 4
      ldap/servers/slapd/entrywsi.c

+ 5 - 4
ldap/servers/slapd/entrywsi.c

@@ -262,17 +262,18 @@ entry_add_rdn_csn(Slapi_Entry *e, const CSN *csn)
 	{
 		Slapi_Attr *a= NULL;
 		Slapi_Value *v= NULL;
-		entry_attr_find_wsi(e, type, &a);
-		if(a!=NULL)
+		if ((entry_attr_find_wsi(e, type, &a) == ATTRIBUTE_PRESENT) && (a!=NULL))
 		{
 			struct berval bv;
 			bv.bv_len= strlen(value);
 			bv.bv_val= (void*)value;
-			attr_value_find_wsi(a, &bv, &v);
+			if (attr_value_find_wsi(a, &bv, &v) == VALUE_DELETED) {
+				v = NULL;
+			}
 		}
 		if(v!=NULL)
 		{
-            value_update_csn(v,CSN_TYPE_VALUE_DISTINGUISHED,csn);
+			value_update_csn(v,CSN_TYPE_VALUE_DISTINGUISHED,csn);
 		}
 		else
 		{