Skip to content
Snippets Groups Projects
Commit 3bad06d5 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

entry_schema_check() rename

parent 2dc6185a
No related branches found
No related tags found
No related merge requests found
......@@ -29,7 +29,7 @@ ldbm_back_add(
Entry *p = NULL;
int rootlock = 0;
int rc;
char *text;
#ifdef SLAPD_SCHEMA_NOT_COMPAT
static AttributeDescription *children = NULL;
#else
......@@ -50,15 +50,17 @@ ldbm_back_add(
return( -1 );
}
if ( schema_check_entry( e ) != 0 ) {
rc = entry_schema_check( e, NULL, &text );
if ( rc != LDAP_SUCCESS ) {
ldap_pvt_thread_mutex_unlock(&li->li_add_mutex);
Debug( LDAP_DEBUG_TRACE, "entry failed schema check\n",
0, 0, 0 );
Debug( LDAP_DEBUG_TRACE, "entry failed schema check: %s\n",
text, 0, 0 );
entry_free( e );
send_ldap_result( conn, op, LDAP_OBJECT_CLASS_VIOLATION,
NULL, NULL, NULL, NULL );
send_ldap_result( conn, op, rc,
NULL, text, NULL, NULL );
return( -1 );
}
......@@ -121,10 +123,10 @@ ldbm_back_add(
/* free parent and writer lock */
cache_return_entry_w( &li->li_cache, p );
Debug( LDAP_DEBUG_TRACE, "no access to parent\n", 0,
Debug( LDAP_DEBUG_TRACE, "no write access to parent\n", 0,
0, 0 );
send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
NULL, NULL, NULL, NULL );
NULL, "no write access to parent", NULL, NULL );
entry_free( e );
......@@ -141,7 +143,7 @@ ldbm_back_add(
0, 0 );
send_ldap_result( conn, op, LDAP_ALIAS_PROBLEM,
NULL, NULL, NULL, NULL );
NULL, "parent is an alias", NULL, NULL );
entry_free( e );
return -1;
......@@ -223,8 +225,8 @@ ldbm_back_add(
entry_free( e );
send_ldap_result( conn, op,
rc > 0 ? LDAP_ALREADY_EXISTS : LDAP_OPERATIONS_ERROR,
NULL, NULL, NULL, NULL );
rc > 0 ? LDAP_ALREADY_EXISTS : LDAP_OTHER,
NULL, rc > 0 ? NULL : "cache add failed", NULL, NULL );
return( -1 );
}
......@@ -240,8 +242,8 @@ ldbm_back_add(
if ( index_add_entry( be, e ) != 0 ) {
Debug( LDAP_DEBUG_TRACE, "index_add_entry failed\n", 0,
0, 0 );
send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
NULL, NULL, NULL, NULL );
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "index generation failed", NULL, NULL );
goto return_results;
}
......@@ -250,8 +252,8 @@ ldbm_back_add(
if ( dn2id_add( be, e->e_ndn, e->e_id ) != 0 ) {
Debug( LDAP_DEBUG_TRACE, "dn2id_add failed\n", 0,
0, 0 );
send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
NULL, NULL, NULL, NULL );
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "DN index generation failed", NULL, NULL );
goto return_results;
}
......@@ -261,8 +263,8 @@ ldbm_back_add(
Debug( LDAP_DEBUG_TRACE, "id2entry_add failed\n", 0,
0, 0 );
(void) dn2id_delete( be, e->e_ndn, e->e_id );
send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
NULL, NULL, NULL, NULL );
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "entry store failed", NULL, NULL );
goto return_results;
}
......
......@@ -36,7 +36,8 @@ int ldbm_modify_internal(
Entry *e
)
{
int err;
int rc, err;
char *text;
Modification *mod;
Modifications *ml;
Attribute *save_attrs;
......@@ -105,11 +106,13 @@ int ldbm_modify_internal(
ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
/* check that the entry still obeys the schema */
if ( schema_check_entry( e ) != 0 ) {
rc = entry_schema_check( e, save_attrs, &text );
if ( rc != LDAP_SUCCESS ) {
attrs_free( e->e_attrs );
e->e_attrs = save_attrs;
Debug( LDAP_DEBUG_ANY, "entry failed schema check\n", 0, 0, 0 );
return LDAP_OBJECT_CLASS_VIOLATION;
Debug( LDAP_DEBUG_ANY, "entry failed schema check: %s\n",
text, 0, 0 );
return rc;
}
/* check for abandon */
......@@ -397,7 +400,7 @@ delete_values(
Debug( LDAP_DEBUG_ARGS,
"could not find value for attr %s\n",
mod->mod_type, 0, 0 );
return( LDAP_NO_SUCH_ATTRIBUTE );
return LDAP_NO_SUCH_ATTRIBUTE;
}
}
#endif
......
......@@ -69,9 +69,10 @@ main( int argc, char **argv )
if( !noschemacheck ) {
/* check schema */
if ( schema_check_entry( e ) != 0 ) {
fprintf( stderr, "%s: schema violation in entry dn=\"%s\" (line=%d)\n",
progname, e->e_dn, lineno );
char *text;
if ( entry_schema_check( e, NULL, &text ) != LDAP_SUCCESS ) {
fprintf( stderr, "%s: dn=\"%s\" (line=%d): %s\n",
progname, e->e_dn, lineno, text );
rc = EXIT_FAILURE;
entry_free( e );
if( continuemode ) continue;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment