Преглед изворни кода

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
 		{