]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/overlays/constraint.c
Fix corrupted CSN issue
[openldap] / servers / slapd / overlays / constraint.c
index 6a7506677c8dadf635200528ebd3503ed862ce4b..ec640d9dad044dfdcf8e02caf43adbf3eceb879e 100644 (file)
@@ -642,6 +642,7 @@ constraint_violation( constraint *c, struct berval *bv, Operation *op, SlapReply
                        Debug( LDAP_DEBUG_ANY,
                                "%s constraint_violation uri filter=\"%s\" invalid\n",
                                op->o_log_prefix, filterstr.bv_val, 0 );
+                       rc = LDAP_OTHER;
 
                } else {
                        Debug(LDAP_DEBUG_TRACE, 
@@ -656,7 +657,7 @@ constraint_violation( constraint *c, struct berval *bv, Operation *op, SlapReply
                }
                op->o_tmpfree(filterstr.bv_val, op->o_tmpmemctx);
 
-               if((rc != LDAP_SUCCESS) && (rc != LDAP_NO_SUCH_OBJECT)) {
+               if ((rc != LDAP_SUCCESS) && (rc != LDAP_NO_SUCH_OBJECT)) {
                        return rc; /* unexpected error */
                }
 
@@ -757,6 +758,10 @@ constraint_add( Operation *op, SlapReply *rs )
        int rc;
        char *msg = NULL;
 
+       if (get_relax(op)) {
+               return SLAP_CB_CONTINUE;
+       }
+
        if ((a = op->ora_e->e_attrs) == NULL) {
                op->o_bd->bd_info = (BackendInfo *)(on->on_info);
                send_ldap_error(op, rs, LDAP_INVALID_SYNTAX,
@@ -782,8 +787,8 @@ constraint_add( Operation *op, SlapReply *rs )
 
                        Debug(LDAP_DEBUG_TRACE, 
                                "==> constraint_add, "
-                               "a->a_numvals = %d, cp->count = %d\n",
-                               a->a_numvals, cp->count, 0);
+                               "a->a_numvals = %u, cp->count = %lu\n",
+                               a->a_numvals, (unsigned long) cp->count, 0);
 
                        if ((cp->count != 0) && (a->a_numvals > cp->count)) {
                                rc = LDAP_CONSTRAINT_VIOLATION;
@@ -833,6 +838,10 @@ constraint_update( Operation *op, SlapReply *rs )
        int rc;
        char *msg = NULL;
 
+       if (get_relax(op)) {
+               return SLAP_CB_CONTINUE;
+       }
+
        switch ( op->o_tag ) {
        case LDAP_REQ_MODIFY:
                modlist = op->orm_modlist;
@@ -846,7 +855,6 @@ constraint_update( Operation *op, SlapReply *rs )
                /* impossible! assert? */
                return LDAP_OTHER;
        }
-
        
        Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE, "constraint_update()\n", 0,0,0);
        if ((m = modlist) == NULL) {
@@ -878,7 +886,7 @@ constraint_update( Operation *op, SlapReply *rs )
 
        rc = LDAP_CONSTRAINT_VIOLATION;
        for(;m; m = m->sml_next) {
-               int ce = 0;
+               unsigned ce = 0;
 
                if (is_at_operational( m->sml_desc->ad_type )) continue;
 
@@ -909,7 +917,7 @@ constraint_update( Operation *op, SlapReply *rs )
                        }
 
                        if (cp->count != 0) {
-                               int ca;
+                               unsigned ca;
 
                                if (m->sml_op == LDAP_MOD_DELETE)
                                        ce = 0;
@@ -917,9 +925,9 @@ constraint_update( Operation *op, SlapReply *rs )
                                for (ca = 0; b[ca].bv_val; ++ca);
 
                                Debug(LDAP_DEBUG_TRACE, 
-                                       "==> constraint_update ce = %d, "
-                                       "ca = %d, cp->count = %d\n",
-                                       ce, ca, cp->count);
+                                       "==> constraint_update ce = %u, "
+                                       "ca = %u, cp->count = %lu\n",
+                                       ce, ca, (unsigned long) cp->count);
 
                                if (m->sml_op == LDAP_MOD_ADD) {
                                        if (ca + ce > cp->count) {