Explorar o código

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 %!s(int64=14) %!d(string=hai) anos
pai
achega
d55024da11
Modificáronse 1 ficheiros con 5 adicións e 4 borrados
  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
 		{