mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
remove global_schemacheck
This commit is contained in:
parent
bb49be254a
commit
740835dff9
@ -986,7 +986,7 @@ backsql_add( Operation *op, SlapReply *rs )
|
|||||||
op->ora_e->e_name.bv_val, 0, 0 );
|
op->ora_e->e_name.bv_val, 0, 0 );
|
||||||
|
|
||||||
/* check schema */
|
/* check schema */
|
||||||
if ( global_schemacheck ) {
|
if ( BACKSQL_CHECK_SCHEMA( bi ) ) {
|
||||||
char textbuf[ SLAP_TEXT_BUFLEN ] = { '\0' };
|
char textbuf[ SLAP_TEXT_BUFLEN ] = { '\0' };
|
||||||
|
|
||||||
rs->sr_err = entry_schema_check( op->o_bd, op->ora_e,
|
rs->sr_err = entry_schema_check( op->o_bd, op->ora_e,
|
||||||
|
@ -508,6 +508,7 @@ typedef struct backsql_info {
|
|||||||
#define BSQLF_FETCH_ALL_USERATTRS 0x0200
|
#define BSQLF_FETCH_ALL_USERATTRS 0x0200
|
||||||
#define BSQLF_FETCH_ALL_OPATTRS 0x0400
|
#define BSQLF_FETCH_ALL_OPATTRS 0x0400
|
||||||
#define BSQLF_FETCH_ALL_ATTRS (BSQLF_FETCH_ALL_USERATTRS|BSQLF_FETCH_ALL_OPATTRS)
|
#define BSQLF_FETCH_ALL_ATTRS (BSQLF_FETCH_ALL_USERATTRS|BSQLF_FETCH_ALL_OPATTRS)
|
||||||
|
#define BSQLF_CHECK_SCHEMA 0x0800
|
||||||
|
|
||||||
#define BACKSQL_ISF(si, f) \
|
#define BACKSQL_ISF(si, f) \
|
||||||
(((si)->sql_flags & f) == f)
|
(((si)->sql_flags & f) == f)
|
||||||
@ -538,6 +539,8 @@ typedef struct backsql_info {
|
|||||||
BACKSQL_ISF(si, BSQLF_FETCH_ALL_OPATTRS)
|
BACKSQL_ISF(si, BSQLF_FETCH_ALL_OPATTRS)
|
||||||
#define BACKSQL_FETCH_ALL_ATTRS(si) \
|
#define BACKSQL_FETCH_ALL_ATTRS(si) \
|
||||||
BACKSQL_ISF(si, BSQLF_FETCH_ALL_ATTRS)
|
BACKSQL_ISF(si, BSQLF_FETCH_ALL_ATTRS)
|
||||||
|
#define BACKSQL_CHECK_SCHEMA(si) \
|
||||||
|
BACKSQL_ISF(si, BSQLF_CHECK_SCHEMA)
|
||||||
|
|
||||||
Entry *sql_baseObject;
|
Entry *sql_baseObject;
|
||||||
#ifdef BACKSQL_ARBITRARY_KEY
|
#ifdef BACKSQL_ARBITRARY_KEY
|
||||||
|
@ -561,6 +561,36 @@ backsql_db_config(
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if ( !strcasecmp( argv[ 0 ], "check_schema") ) {
|
||||||
|
if ( argc < 2 ) {
|
||||||
|
Debug( LDAP_DEBUG_TRACE,
|
||||||
|
"<==backsql_db_config (%s line %d): "
|
||||||
|
"missing { yes | no }"
|
||||||
|
"in \"check_schema\" directive\n",
|
||||||
|
fname, lineno, 0 );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( strcasecmp( argv[ 1 ], "yes" ) == 0 ) {
|
||||||
|
bi->sql_flags |= BSQLF_CHECK_SCHEMA;
|
||||||
|
|
||||||
|
} else if ( strcasecmp( argv[ 1 ], "no" ) == 0 ) {
|
||||||
|
bi->sql_flags &= ~BSQLF_CHECK_SCHEMA;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Debug( LDAP_DEBUG_TRACE,
|
||||||
|
"<==backsql_db_config (%s line %d): "
|
||||||
|
"\"check_schema\" directive arg "
|
||||||
|
"must be \"yes\" or \"no\"\n",
|
||||||
|
fname, lineno, 0 );
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
Debug( LDAP_DEBUG_TRACE, "<==backsql_db_config(): "
|
||||||
|
"check_schema=%s\n",
|
||||||
|
BACKSQL_CHECK_SCHEMA( bi ) ? "yes" : "no",
|
||||||
|
0, 0 );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return SLAP_CONF_UNKNOWN;
|
return SLAP_CONF_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
@ -934,17 +934,22 @@ next:;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( global_schemacheck ) {
|
if ( ( bsi->bsi_flags & BSQL_SF_ALL_OPER )
|
||||||
const char *text = NULL;
|
|| an_find( bsi->bsi_attrs, &AllOper )
|
||||||
char textbuf[ 1024 ];
|
|| an_find( bsi->bsi_attrs, &slap_schema.si_ad_structuralObjectClass->ad_cname ) )
|
||||||
size_t textlen = sizeof( textbuf );
|
{
|
||||||
struct berval bv[ 2 ];
|
struct berval bv[ 2 ];
|
||||||
struct berval soc;
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
bv[ 0 ] = bsi->bsi_oc->bom_oc->soc_cname;
|
bv[ 0 ] = bsi->bsi_oc->bom_oc->soc_cname;
|
||||||
BER_BVZERO( &bv[ 1 ] );
|
BER_BVZERO( &bv[ 1 ] );
|
||||||
|
|
||||||
|
if ( BACKSQL_CHECK_SCHEMA( bi ) ) {
|
||||||
|
const char *text = NULL;
|
||||||
|
char textbuf[ 1024 ];
|
||||||
|
size_t textlen = sizeof( textbuf );
|
||||||
|
struct berval soc;
|
||||||
|
int rc;
|
||||||
|
|
||||||
rc = structural_class( bv, &soc, NULL,
|
rc = structural_class( bv, &soc, NULL,
|
||||||
&text, textbuf, textlen );
|
&text, textbuf, textlen );
|
||||||
if ( rc != LDAP_SUCCESS ) {
|
if ( rc != LDAP_SUCCESS ) {
|
||||||
@ -955,20 +960,16 @@ next:;
|
|||||||
entry_clean( bsi->bsi_e );
|
entry_clean( bsi->bsi_e );
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( ( bsi->bsi_flags & BSQL_SF_ALL_OPER )
|
|
||||||
|| an_find( bsi->bsi_attrs, &AllOper )
|
|
||||||
|| an_find( bsi->bsi_attrs, &slap_schema.si_ad_structuralObjectClass->ad_cname ) )
|
|
||||||
{
|
|
||||||
rc = attr_merge_normalize_one( bsi->bsi_e,
|
rc = attr_merge_normalize_one( bsi->bsi_e,
|
||||||
slap_schema.si_ad_structuralObjectClass,
|
slap_schema.si_ad_structuralObjectClass,
|
||||||
&soc, bsi->bsi_op->o_tmpmemctx );
|
&bv[ 0 ], bsi->bsi_op->o_tmpmemctx );
|
||||||
if ( rc != LDAP_SUCCESS ) {
|
if ( rc != LDAP_SUCCESS ) {
|
||||||
entry_clean( bsi->bsi_e );
|
entry_clean( bsi->bsi_e );
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
done:;
|
done:;
|
||||||
Debug( LDAP_DEBUG_TRACE, "<==backsql_id2entry()\n", 0, 0, 0 );
|
Debug( LDAP_DEBUG_TRACE, "<==backsql_id2entry()\n", 0, 0, 0 );
|
||||||
|
@ -474,6 +474,7 @@ backsql_db_open(
|
|||||||
/* enable if only one suffix is defined */
|
/* enable if only one suffix is defined */
|
||||||
bi->sql_flags |= BSQLF_USE_SUBTREE_SHORTCUT;
|
bi->sql_flags |= BSQLF_USE_SUBTREE_SHORTCUT;
|
||||||
}
|
}
|
||||||
|
bi->sql_flags |= BSQLF_CHECK_SCHEMA;
|
||||||
|
|
||||||
Debug( LDAP_DEBUG_TRACE, "<==backsql_db_open(): "
|
Debug( LDAP_DEBUG_TRACE, "<==backsql_db_open(): "
|
||||||
"test succeeded, schema map loaded\n", 0, 0, 0 );
|
"test succeeded, schema map loaded\n", 0, 0, 0 );
|
||||||
|
@ -155,7 +155,7 @@ backsql_modify( Operation *op, SlapReply *rs )
|
|||||||
goto do_transact;
|
goto do_transact;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( global_schemacheck ) {
|
if ( BACKSQL_CHECK_SCHEMA( bi ) ) {
|
||||||
char textbuf[ SLAP_TEXT_BUFLEN ] = { '\0' };
|
char textbuf[ SLAP_TEXT_BUFLEN ] = { '\0' };
|
||||||
|
|
||||||
entry_clean( &m );
|
entry_clean( &m );
|
||||||
|
@ -446,7 +446,7 @@ backsql_modrdn( Operation *op, SlapReply *rs )
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( global_schemacheck ) {
|
if ( BACKSQL_CHECK_SCHEMA( bi ) ) {
|
||||||
char textbuf[ SLAP_TEXT_BUFLEN ] = { '\0' };
|
char textbuf[ SLAP_TEXT_BUFLEN ] = { '\0' };
|
||||||
|
|
||||||
entry_clean( &r );
|
entry_clean( &r );
|
||||||
|
Loading…
Reference in New Issue
Block a user