X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Foverlays%2Fconstraint.c;h=f2c645c609c04f4fc6c6040ca47b65ae2517da4d;hb=e6910e0a0c689b289837e75352541ee3fc966064;hp=2d943a223f73b0e272a3b96666f42d5e11065f28;hpb=a7c595088c1561c4f08932a97f9a716ae9dabd9c;p=openldap diff --git a/servers/slapd/overlays/constraint.c b/servers/slapd/overlays/constraint.c index 2d943a223f..f2c645c609 100644 --- a/servers/slapd/overlays/constraint.c +++ b/servers/slapd/overlays/constraint.c @@ -771,7 +771,7 @@ constraint_add( Operation *op, SlapReply *rs ) int rc; char *msg = NULL; - if (get_relax(op)) { + if (get_relax(op) || SLAPD_SYNC_IS_SYNCCONN( op->o_connid )) { return SLAP_CB_CONTINUE; } @@ -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,9 +902,8 @@ constraint_update( Operation *op, SlapReply *rs ) int rc; char *msg = NULL; int is_v; - int first = 1; - if (get_relax(op)) { + if (get_relax(op) || SLAPD_SYNC_IS_SYNCCONN( op->o_connid )) { return SLAP_CB_CONTINUE; } @@ -933,15 +929,13 @@ 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->count != 0) { if (rc != 0 || target_entry == NULL) { Debug(LDAP_DEBUG_TRACE, "==> constraint_update rc = %d DN=\"%s\"%s\n", @@ -952,6 +946,10 @@ constraint_update( Operation *op, SlapReply *rs ) goto mod_violation; } + if (cp->restrict_lud && constraint_check_restrict(op, cp, target_entry) == 0) { + continue; + } + is_v = constraint_check_count_violation(m, target_entry, cp); Debug(LDAP_DEBUG_TRACE,