]> git.sur5r.net Git - openldap/commitdiff
Pass op to slap_mods_check()
authorHoward Chu <hyc@openldap.org>
Sun, 24 Dec 2006 06:55:02 +0000 (06:55 +0000)
committerHoward Chu <hyc@openldap.org>
Sun, 24 Dec 2006 06:55:02 +0000 (06:55 +0000)
servers/slapd/add.c
servers/slapd/modify.c
servers/slapd/proto-slap.h
servers/slapd/slapi/proto-slapi.h
servers/slapd/slapi/slapi_ops.c
servers/slapd/slapi/slapi_pblock.c
servers/slapd/slapi/slapi_utils.c
servers/slapd/syncrepl.c

index bacbe232a3a174d07288a0f6cbbd3e40830a3aa2..3fb10969e14f83b2f394619486c3870a44c4dd8d 100644 (file)
@@ -157,7 +157,7 @@ do_add( Operation *op, SlapReply *rs )
                goto done;
        }
 
-       rs->sr_err = slap_mods_check( modlist, &rs->sr_text,
+       rs->sr_err = slap_mods_check( op, modlist, &rs->sr_text,
                textbuf, textlen, NULL );
 
        if ( rs->sr_err != LDAP_SUCCESS ) {
@@ -323,15 +323,6 @@ fe_op_add( Operation *op, SlapReply *rs )
                                        goto done;
                                }
 
-#if 0                  /* This is a no-op since *modtail is NULL */
-                               rs->sr_err = slap_mods2entry( *modtail, &op->ora_e,
-                                       0, 0, &rs->sr_text, textbuf, textlen );
-                               if ( rs->sr_err != LDAP_SUCCESS ) {
-                                       send_ldap_result( op, rs );
-                                       goto done;
-                               }
-#endif
-
                                cb.sc_next = op->o_callback;
                                op->o_callback = &cb;
                        }
@@ -472,44 +463,6 @@ slap_mods2entry(
 #endif
                }
 
-#if 0  /* checked for duplicates in slap_mods_check */
-               if( mods->sml_values[1].bv_val != NULL ) {
-                       /* check for duplicates */
-                       int             i, j, rc, match;
-                       MatchingRule *mr = mods->sml_desc->ad_type->sat_equality;
-
-                       for ( i = 1; mods->sml_values[i].bv_val != NULL; i++ ) {
-                               /* test asserted values against themselves */
-                               for( j = 0; j < i; j++ ) {
-                                       rc = ordered_value_match( &match, mods->sml_desc, mr,
-                                               SLAP_MR_EQUALITY
-                                               | SLAP_MR_VALUE_OF_ATTRIBUTE_SYNTAX
-                                               | SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH
-                                               | SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH,
-                                               mods->sml_nvalues
-                                                       ? &mods->sml_nvalues[i]
-                                                       : &mods->sml_values[i],
-                                               mods->sml_nvalues
-                                                       ? &mods->sml_nvalues[j]
-                                                       : &mods->sml_values[j],
-                                               text );
-
-                                       if ( rc == LDAP_SUCCESS && match == 0 ) {
-                                               /* value exists already */
-                                               snprintf( textbuf, textlen,
-                                                       "%s: value #%d provided more than once",
-                                                       mods->sml_desc->ad_cname.bv_val, j );
-                                               *text = textbuf;
-                                               return LDAP_TYPE_OR_VALUE_EXISTS;
-
-                                       } else if ( rc != LDAP_SUCCESS ) {
-                                               return rc;
-                                       }
-                               }
-                       }
-               }
-#endif
-
                attr = attr_alloc( mods->sml_desc );
 
                /* move values to attr structure */
index 6e987da08d8335eac4ca99573f7d2bda54146eb2..f8f709244d83c0a95db38546332b1c1ac18779a7 100644 (file)
@@ -183,7 +183,7 @@ do_modify(
                goto cleanup;
        }
 
-       rs->sr_err = slap_mods_check( modlist,
+       rs->sr_err = slap_mods_check( op, modlist,
                &rs->sr_text, textbuf, textlen, NULL );
 
        if ( rs->sr_err != LDAP_SUCCESS ) {
@@ -539,6 +539,7 @@ slap_mods_no_repl_user_mod_check(
  * Do basic attribute type checking and syntax validation.
  */
 int slap_mods_check(
+       Operation *op,
        Modifications *ml,
        const char **text,
        char *textbuf,
index a0674ca2f36207f673d031e366f6574abd0f43d0..4f25d301b29e7265a4d319ba80610db42ec712a0 100644 (file)
@@ -1098,6 +1098,7 @@ LDAP_SLAPD_F ( int ) slap_mods_no_repl_user_mod_check(
        size_t textlen );
 
 LDAP_SLAPD_F( int ) slap_mods_check(
+       Operation *op,
        Modifications *ml,
        const char **text,
        char *textbuf, size_t textlen, void *ctx );
index 45dfe1dc6de2e6493c8f4f89238a48d2b154164b..3a823880e6554324e5f7b09b47ba88fe87a02b6d 100644 (file)
@@ -27,7 +27,7 @@ LDAP_BEGIN_DECL
 
 /* slapi_utils.c */
 LDAP_SLAPI_F (LDAPMod **) slapi_int_modifications2ldapmods LDAP_P(( Modifications * ));
-LDAP_SLAPI_F (Modifications *) slapi_int_ldapmods2modifications LDAP_P(( LDAPMod ** ));
+LDAP_SLAPI_F (Modifications *) slapi_int_ldapmods2modifications LDAP_P(( Operation *op, LDAPMod ** ));
 LDAP_SLAPI_F (int) slapi_int_count_controls LDAP_P(( LDAPControl **ctrls ));
 LDAP_SLAPI_F (char **) slapi_get_supported_extended_ops LDAP_P((void));
 LDAP_SLAPI_F (int) slapi_int_access_allowed LDAP_P((Operation *op, Entry *entry, AttributeDescription *desc, struct berval *val, slap_access_t access, AccessControlState *state ));
index aba0caeb44460bb6c4f1e9dd3458a1eb4f0ad1a8..7e90ee8c9c988ebde83a37a3639a0f6151721567 100644 (file)
@@ -465,7 +465,7 @@ slapi_add_internal_pb( Slapi_PBlock *pb )
                assert( pb->pb_op->ora_modlist != NULL );
        }
 
-       rs->sr_err = slap_mods_check( pb->pb_op->ora_modlist, &rs->sr_text,
+       rs->sr_err = slap_mods_check( pb->pb_op, pb->pb_op->ora_modlist, &rs->sr_text,
                pb->pb_textbuf, sizeof( pb->pb_textbuf ), NULL );
        if ( rs->sr_err != LDAP_SUCCESS ) {
                 goto cleanup;
@@ -550,7 +550,7 @@ slapi_modify_internal_pb( Slapi_PBlock *pb )
                goto cleanup;
        }
 
-       rs->sr_err = slap_mods_check( pb->pb_op->orm_modlist,
+       rs->sr_err = slap_mods_check( pb->pb_op, pb->pb_op->orm_modlist,
                &rs->sr_text, pb->pb_textbuf, sizeof( pb->pb_textbuf ), NULL );
        if ( rs->sr_err != LDAP_SUCCESS ) {
                 goto cleanup;
index 30fd74292cf17cb28cc1c644c91d2e3376064b00..02164d22367719236e80f1f983da56a4a7a69d31 100644 (file)
@@ -1005,7 +1005,7 @@ pblock_set( Slapi_PBlock *pb, int param, void *value )
                        break;
                }
 
-               newmods = slapi_int_ldapmods2modifications( (LDAPMod **)value );
+               newmods = slapi_int_ldapmods2modifications( pb->pb_op, (LDAPMod **)value );
                if ( newmods != NULL ) {
                        slap_mods_free( *mlp, 1 );
                        *mlp = newmods;
index ac618cf50d8b8fe068cb0757c50da7bd99fa0c84..83733aaacd95b30a2dcae35b101947408e83158b 100644 (file)
@@ -2607,7 +2607,7 @@ int slapi_acl_check_mods(Slapi_PBlock *pb, Slapi_Entry *e, LDAPMod **mods, char
        if ( pb == NULL || pb->pb_op == NULL )
                return LDAP_PARAM_ERROR;
 
-       ml = slapi_int_ldapmods2modifications( mods );
+       ml = slapi_int_ldapmods2modifications( pb->pb_op, mods );
        if ( ml == NULL ) {
                return LDAP_OTHER;
        }
@@ -2677,7 +2677,7 @@ LDAPMod **slapi_int_modifications2ldapmods( Modifications *modlist )
  * before prettying (and we can't easily get out of calling
  * slap_mods_check() because we need normalized values).
  */
-Modifications *slapi_int_ldapmods2modifications ( LDAPMod **mods )
+Modifications *slapi_int_ldapmods2modifications ( Operation *op, LDAPMod **mods )
 {
        Modifications *modlist = NULL, **modtail;
        LDAPMod **modp;
@@ -2746,7 +2746,7 @@ Modifications *slapi_int_ldapmods2modifications ( LDAPMod **mods )
                modtail = &mod->sml_next;
        }
 
-       if ( slap_mods_check( modlist, &text, textbuf, sizeof( textbuf ), NULL ) != LDAP_SUCCESS ) {
+       if ( slap_mods_check( op, modlist, &text, textbuf, sizeof( textbuf ), NULL ) != LDAP_SUCCESS ) {
                slap_mods_free( modlist, 1 );
                modlist = NULL;
        }
index ebc66aa65141216bdd0b60d126a77c5d2cb17e75..53d2cc82b1e5b0444c1e865a3acb25db4e8c4016 100644 (file)
@@ -985,6 +985,8 @@ do_syncrepl(
        op->o_bd = be = si->si_be;
        op->o_dn = op->o_bd->be_rootdn;
        op->o_ndn = op->o_bd->be_rootndn;
+       if ( !si->si_schemachecking )
+               op->o_no_schema_check = 1;
 
        /* Establish session, do search */
        if ( !si->si_ld ) {
@@ -1265,7 +1267,7 @@ syncrepl_message_to_op(
                /* If we didn't get required data, bail */
                if ( !modlist ) goto done;
 
-               rc = slap_mods_check( modlist, &text, txtbuf, textlen, NULL );
+               rc = slap_mods_check( op, modlist, &text, txtbuf, textlen, NULL );
 
                if ( rc != LDAP_SUCCESS ) {
                        Debug( LDAP_DEBUG_ANY, "syncrepl_message_to_op: rid %03d "
@@ -1451,7 +1453,7 @@ syncrepl_message_to_entry(
                goto done;
        }
 
-       rc = slap_mods_check( *modlist, &text, txtbuf, textlen, NULL );
+       rc = slap_mods_check( op, *modlist, &text, txtbuf, textlen, NULL );
 
        if ( rc != LDAP_SUCCESS ) {
                Debug( LDAP_DEBUG_ANY, "syncrepl_message_to_entry: rid %03d mods check (%s)\n",