[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: AW: (ITS#7418) slapo-constraint are broken



This is a multi-part message in MIME format.
--------------030809010302060201080601
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

On 10/22/2012 09:14 PM, Sascha.Kuehndel@deka.de wrote:
> Hello,
> 
> i have reduced the configuration and the DIT to a minium.
> So i can now send the slapd.conf, the initial dit and the test-change.
> 
> I hope you can reproduce the error, with it.
> 
> The uses software:
> OpenLDAP: 2.4.33
> BDB: 5.3.21
> OpenSSL: 1.0.1c
> 
> Thanks,
> Sascha Kuehndel
> 

Could you please try the attached patch?

Thank you,

-- 
Jan Synacek
Software Engineer, BaseOS team Brno, Red Hat

--------------030809010302060201080601
Content-Type: text/x-patch;
 name="constraint2.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="constraint2.patch"

diff --git a/servers/slapd/overlays/constraint.c b/servers/slapd/overlays/constraint.c
index 2d943a2..e7b5689 100644
--- a/servers/slapd/overlays/constraint.c
+++ b/servers/slapd/overlays/constraint.c
@@ -845,9 +845,6 @@ constraint_check_count_violation( Modifications *m, Entry *target_entry, constra
 	unsigned ca;
 	int j;
 
-	if ( cp->set )
-		return 0;
-
 	for ( j = 0; cp->ap[j]; j++ ) {
 		/* Get this attribute count */
 		if ( target_entry )
@@ -905,7 +902,6 @@ constraint_update( Operation *op, SlapReply *rs )
 	int rc;
 	char *msg = NULL;
 	int is_v;
-	int first = 1;
 
 	if (get_relax(op)) {
 		return SLAP_CB_CONTINUE;
@@ -933,15 +929,17 @@ constraint_update( Operation *op, SlapReply *rs )
 		return(rs->sr_err);
 	}
 
+	op->o_bd = on->on_info->oi_origdb;
+	rc = be_entry_get_rw( op, &op->o_req_ndn, NULL, NULL, 0, &target_entry );
+	op->o_bd = be;
+
 	/* Do we need to count attributes? */
 	for(cp = c; cp; cp = cp->ap_next) {
-		if (cp->count != 0 || cp->set || cp->restrict_lud != 0) {
-			if (first) {
-				op->o_bd = on->on_info->oi_origdb;
-				rc = be_entry_get_rw( op, &op->o_req_ndn, NULL, NULL, 0, &target_entry );
-				op->o_bd = be;
-				first = 0;
-			}
+		if (cp->restrict_lud && constraint_check_restrict(op, cp, target_entry) == 0) {
+			continue;
+		}
+
+		if (cp->count != 0) {
 			if (rc != 0 || target_entry == NULL) {
 				Debug(LDAP_DEBUG_TRACE, 
 					"==> constraint_update rc = %d DN=\"%s\"%s\n",
@@ -964,6 +962,7 @@ constraint_update( Operation *op, SlapReply *rs )
 		}
 	}
 
+
 	rc = LDAP_CONSTRAINT_VIOLATION;
 	for(;m; m = m->sml_next) {
 		unsigned ce = 0;

--------------030809010302060201080601--