From 12d006d17d30ac7fdbd5aa806a939bfd7cc8cb88 Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Mon, 1 Aug 2005 15:26:13 +0000 Subject: [PATCH] Add o_no_schema_check to operation structure entry_schema_check() nows takes Operation instead of Backend as first argument, allows it to check o_no_schema_check --- servers/slapd/back-bdb/add.c | 2 +- servers/slapd/back-bdb/modify.c | 2 +- servers/slapd/back-ldbm/add.c | 2 +- servers/slapd/back-ldbm/modify.c | 2 +- servers/slapd/back-monitor/log.c | 2 +- servers/slapd/back-sql/add.c | 2 +- servers/slapd/back-sql/modify.c | 2 +- servers/slapd/back-sql/modrdn.c | 2 +- servers/slapd/bconfig.c | 2 +- servers/slapd/proto-slap.h | 2 +- servers/slapd/schema_check.c | 12 ++++++++---- servers/slapd/slap.h | 2 ++ servers/slapd/slapadd.c | 10 +++++++++- servers/slapd/slapi/proto-slapi.h | 6 +++--- 14 files changed, 32 insertions(+), 18 deletions(-) diff --git a/servers/slapd/back-bdb/add.c b/servers/slapd/back-bdb/add.c index 4ef340e92b..227652077e 100644 --- a/servers/slapd/back-bdb/add.c +++ b/servers/slapd/back-bdb/add.c @@ -52,7 +52,7 @@ bdb_add(Operation *op, SlapReply *rs ) ctrls[num_ctrls] = 0; /* check entry's schema */ - rs->sr_err = entry_schema_check( op->o_bd, op->oq_add.rs_e, NULL, + rs->sr_err = entry_schema_check( op, op->oq_add.rs_e, NULL, get_manageDIT(op), &rs->sr_text, textbuf, textlen ); if ( rs->sr_err != LDAP_SUCCESS ) { Debug( LDAP_DEBUG_TRACE, diff --git a/servers/slapd/back-bdb/modify.c b/servers/slapd/back-bdb/modify.c index 7e85e8b322..d342febff2 100644 --- a/servers/slapd/back-bdb/modify.c +++ b/servers/slapd/back-bdb/modify.c @@ -196,7 +196,7 @@ int bdb_modify_internal( } /* check that the entry still obeys the schema */ - rc = entry_schema_check( op->o_bd, e, save_attrs, get_manageDIT(op), + rc = entry_schema_check( op, e, save_attrs, get_manageDIT(op), text, textbuf, textlen ); if ( rc != LDAP_SUCCESS || op->o_noop ) { attrs_free( e->e_attrs ); diff --git a/servers/slapd/back-ldbm/add.c b/servers/slapd/back-ldbm/add.c index 39b03af185..413d292508 100644 --- a/servers/slapd/back-ldbm/add.c +++ b/servers/slapd/back-ldbm/add.c @@ -45,7 +45,7 @@ ldbm_back_add( Debug(LDAP_DEBUG_ARGS, "==> ldbm_back_add: %s\n", op->o_req_dn.bv_val, 0, 0); - rs->sr_err = entry_schema_check( op->o_bd, op->oq_add.rs_e, NULL, + rs->sr_err = entry_schema_check( op, op->oq_add.rs_e, NULL, get_manageDIT(op), &rs->sr_text, textbuf, textlen ); if ( rs->sr_err != LDAP_SUCCESS ) { diff --git a/servers/slapd/back-ldbm/modify.c b/servers/slapd/back-ldbm/modify.c index 51d10c2691..2dd696919f 100644 --- a/servers/slapd/back-ldbm/modify.c +++ b/servers/slapd/back-ldbm/modify.c @@ -164,7 +164,7 @@ int ldbm_modify_internal( } /* check that the entry still obeys the schema */ - rc = entry_schema_check( op->o_bd, e, save_attrs, get_manageDIT(op), + rc = entry_schema_check( op, e, save_attrs, get_manageDIT(op), text, textbuf, textlen ); if ( rc != LDAP_SUCCESS ) { Debug( LDAP_DEBUG_ANY, "entry failed schema check: %s\n", diff --git a/servers/slapd/back-monitor/log.c b/servers/slapd/back-monitor/log.c index d54b572ee7..5be1d20741 100644 --- a/servers/slapd/back-monitor/log.c +++ b/servers/slapd/back-monitor/log.c @@ -197,7 +197,7 @@ monitor_subsys_log_modify( } /* check that the entry still obeys the schema */ - rc = entry_schema_check( be_monitor, e, save_attrs, 0, + rc = entry_schema_check( op, e, save_attrs, 0, &text, textbuf, sizeof( textbuf ) ); if ( rc != LDAP_SUCCESS ) { rs->sr_err = rc; diff --git a/servers/slapd/back-sql/add.c b/servers/slapd/back-sql/add.c index d48076c784..9a6e6a56f9 100644 --- a/servers/slapd/back-sql/add.c +++ b/servers/slapd/back-sql/add.c @@ -956,7 +956,7 @@ backsql_add( Operation *op, SlapReply *rs ) if ( BACKSQL_CHECK_SCHEMA( bi ) ) { char textbuf[ SLAP_TEXT_BUFLEN ] = { '\0' }; - rs->sr_err = entry_schema_check( op->o_bd, op->ora_e, NULL, 0, + rs->sr_err = entry_schema_check( op, op->ora_e, NULL, 0, &rs->sr_text, textbuf, sizeof( textbuf ) ); if ( rs->sr_err != LDAP_SUCCESS ) { Debug( LDAP_DEBUG_TRACE, " backsql_add(\"%s\"): " diff --git a/servers/slapd/back-sql/modify.c b/servers/slapd/back-sql/modify.c index fa2d1e9d4b..79644cb969 100644 --- a/servers/slapd/back-sql/modify.c +++ b/servers/slapd/back-sql/modify.c @@ -151,7 +151,7 @@ backsql_modify( Operation *op, SlapReply *rs ) goto do_transact; } - rs->sr_err = entry_schema_check( op->o_bd, &m, NULL, 0, + rs->sr_err = entry_schema_check( op, &m, NULL, 0, &rs->sr_text, textbuf, sizeof( textbuf ) ); if ( rs->sr_err != LDAP_SUCCESS ) { Debug( LDAP_DEBUG_TRACE, " backsql_add(\"%s\"): " diff --git a/servers/slapd/back-sql/modrdn.c b/servers/slapd/back-sql/modrdn.c index 4ad518e3bd..242a1110c2 100644 --- a/servers/slapd/back-sql/modrdn.c +++ b/servers/slapd/back-sql/modrdn.c @@ -495,7 +495,7 @@ backsql_modrdn( Operation *op, SlapReply *rs ) e_id = bsi.bsi_base_id; - rs->sr_err = entry_schema_check( op->o_bd, &r, NULL, 0, + rs->sr_err = entry_schema_check( op, &r, NULL, 0, &rs->sr_text, textbuf, sizeof( textbuf ) ); if ( rs->sr_err != LDAP_SUCCESS ) { Debug( LDAP_DEBUG_TRACE, " backsql_add(\"%s\"): " diff --git a/servers/slapd/bconfig.c b/servers/slapd/bconfig.c index ad55a887da..0e150188f3 100644 --- a/servers/slapd/bconfig.c +++ b/servers/slapd/bconfig.c @@ -3500,7 +3500,7 @@ config_modify_internal( CfEntryInfo *ce, Operation *op, SlapReply *rs, if(rc == LDAP_SUCCESS) { /* check that the entry still obeys the schema */ - rc = entry_schema_check(op->o_bd, e, NULL, 0, + rc = entry_schema_check(op, e, NULL, 0, &rs->sr_text, ca->msg, sizeof(ca->msg) ); } if ( rc == LDAP_SUCCESS ) { diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 660dbdcd51..ce907de38b 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -1357,7 +1357,7 @@ LDAP_SLAPD_F( int ) structural_class( char *textbuf, size_t textlen ); LDAP_SLAPD_F( int ) entry_schema_check( - Backend *be, + Operation *op, Entry *e, Attribute *attrs, int manage, diff --git a/servers/slapd/schema_check.c b/servers/slapd/schema_check.c index 02a3f012cd..7a8ace4e48 100644 --- a/servers/slapd/schema_check.c +++ b/servers/slapd/schema_check.c @@ -43,7 +43,7 @@ static int entry_naming_check( int entry_schema_check( - Backend *be, + Operation *op, Entry *e, Attribute *oldattrs, int manage, @@ -64,7 +64,11 @@ entry_schema_check( int subentry = is_entry_subentry( e ); int collectiveSubentry = 0; - if ( SLAP_NO_SCHEMA_CHECK( be )) { + if ( SLAP_NO_SCHEMA_CHECK( op->o_bd )) { + return LDAP_SUCCESS; + } + + if ( get_no_schema_check( op ) ) { return LDAP_SUCCESS; } @@ -84,7 +88,7 @@ entry_schema_check( if( a->a_desc->ad_type->sat_check ) { int rc = (a->a_desc->ad_type->sat_check)( - be, e, a, text, textbuf, textlen ); + op->o_bd, e, a, text, textbuf, textlen ); if( rc != LDAP_SUCCESS ) { return rc; } @@ -308,7 +312,7 @@ entry_schema_check( } if ( oc->soc_check ) { - int rc = (oc->soc_check)( be, e, oc, + int rc = (oc->soc_check)( op->o_bd, e, oc, text, textbuf, textlen ); if( rc != LDAP_SUCCESS ) { return rc; diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 49ff60dbe2..7d97375c36 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -2395,6 +2395,8 @@ typedef struct slap_op { char o_nocaching; char o_delete_glue_parent; + char o_no_schema_check; +#define get_no_schema_check(op) ((op)->o_no_schema_check) #define SLAP_CONTROL_NONE 0 #define SLAP_CONTROL_IGNORED 1 diff --git a/servers/slapd/slapadd.c b/servers/slapd/slapadd.c index 6785c3e8ff..e4190eac3b 100644 --- a/servers/slapd/slapadd.c +++ b/servers/slapd/slapadd.c @@ -64,8 +64,14 @@ slapadd( int argc, char **argv ) int ret; struct berval bvtext; int checkvals; + char opbuf[OPERATION_BUFFER_SIZE]; + Operation *op; + slap_tool_init( progname, SLAPADD, argc, argv ); + memset( opbuf, 0, sizeof(opbuf) ); + op = (Operation *)opbuf; + if( !be->be_entry_open || !be->be_entry_close || !be->be_entry_put ) @@ -181,7 +187,9 @@ slapadd( int argc, char **argv ) } /* check schema */ - rc = entry_schema_check( be, e, NULL, manage, + op->o_bd = be; + + rc = entry_schema_check( op, e, NULL, manage, &text, textbuf, textlen ); if( rc != LDAP_SUCCESS ) { diff --git a/servers/slapd/slapi/proto-slapi.h b/servers/slapd/slapi/proto-slapi.h index b39873745d..9a32b0abd8 100644 --- a/servers/slapd/slapi/proto-slapi.h +++ b/servers/slapd/slapi/proto-slapi.h @@ -27,7 +27,7 @@ LDAP_BEGIN_DECL /* slapi_utils.c */ LDAP_SLAPI_F (LDAPMod **) slapi_int_modifications2ldapmods LDAP_P(( Modifications **, void *ctx )); -LDAP_SLAPI_F (Modifications *) slapi_int_ldapmods2modifications LDAP_P(( LDAPMod **, int dup, void *ctx )); +LDAP_SLAPI_F (Modifications *) slapi_int_ldapmods2modifications LDAP_P(( LDAPMod **, void *ctx )); LDAP_SLAPI_F (void) slapi_int_free_ldapmods LDAP_P(( 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)); @@ -41,7 +41,6 @@ LDAP_SLAPI_F (void) slapi_int_connection_done_pb LDAP_P(( Slapi_PBlock *pb )); /* slapi_pblock.c */ LDAP_SLAPI_F (int) slapi_pblock_delete_param LDAP_P(( Slapi_PBlock *p, int param )); LDAP_SLAPI_F (void) slapi_pblock_clear LDAP_P(( Slapi_PBlock *pb )); -LDAP_SLAPI_F (void) slapi_int_mods_free( Modifications *ml ); LDAP_SLAPI_F (int) slapi_int_pblock_get_first LDAP_P(( Backend *be, Slapi_PBlock **pb )); LDAP_SLAPI_F (int) slapi_int_pblock_get_next LDAP_P(( Slapi_PBlock **pb )); @@ -84,7 +83,8 @@ LDAP_SLAPI_F (int) slapi_int_create_object_extensions LDAP_P((int objecttype, vo LDAP_SLAPI_F (int) slapi_int_clear_object_extensions LDAP_P((int objecttype, void *object)); /* slapi_overlay.c */ -LDAP_SLAPI_F (int) slapi_int_overlay_init LDAP_P((void)); +LDAP_SLAPI_F (int) slapi_over_is_inst LDAP_P((BackendDB *)); +LDAP_SLAPI_F (int) slapi_over_config LDAP_P((BackendDB *)); LDAP_END_DECL -- 2.39.5