ITS#7420 move entry_naming_check earlier in Add

Make sure RDN is present in e_attrs before passing entry to overlays
This commit is contained in:
Howard Chu 2023-12-19 13:08:14 +00:00 committed by Quanah Gibson-Mount
parent 314800db23
commit f5c96f4469
4 changed files with 22 additions and 9 deletions

View file

@ -184,6 +184,15 @@ do_add( Operation *op, SlapReply *rs )
goto done;
}
/* make sure RDN is present in attrs */
if ( !is_entry_glue ( op->ora_e )) {
rs->sr_err = entry_naming_check( op->ora_e, get_relax( op ), 1, &rs->sr_text, textbuf, textlen );
if ( rs->sr_err != LDAP_SUCCESS ) {
send_ldap_result( op, rs );
goto done;
}
}
freevals = 0;
oex = op->o_tmpalloc( sizeof(OpExtraDB), op->o_tmpmemctx );
oex->oe.oe_key = (void *)do_add;

View file

@ -1799,6 +1799,13 @@ LDAP_SLAPD_F( int ) entry_schema_check(
const char** text,
char *textbuf, size_t textlen );
LDAP_SLAPD_F( int ) entry_naming_check(
Entry *e,
int manage,
int add_naming,
const char** text,
char *textbuf, size_t textlen );
LDAP_SLAPD_F( int ) mods_structural_class(
Modifications *mods,
struct berval *oc,

View file

@ -29,12 +29,6 @@ static char * oc_check_required(
ObjectClass *oc,
struct berval *ocname );
static int entry_naming_check(
Entry *e,
int manage,
int add_naming,
const char** text,
char *textbuf, size_t textlen );
/*
* entry_schema_check - check that entry e conforms to the schema required
* by its object class(es).
@ -237,8 +231,8 @@ got_soc:
}
/* naming check */
if ( !is_entry_glue ( e ) ) {
rc = entry_naming_check( e, manage, add, text, textbuf, textlen );
if ( !is_entry_glue ( e ) && !add ) { /* add already did this */
rc = entry_naming_check( e, manage, 0, text, textbuf, textlen );
if( rc != LDAP_SUCCESS ) {
goto done;
}
@ -772,7 +766,7 @@ int mods_structural_class(
}
static int
int
entry_naming_check(
Entry *e,
int manage,

View file

@ -1180,6 +1180,9 @@ slap_tool_entry_check(
int rc = entry_schema_check( op, e, manage, 1, NULL,
text, textbuf, textlen );
if( rc == LDAP_SUCCESS )
rc = entry_naming_check( e, manage, 1, text, textbuf, textlen );
if( rc != LDAP_SUCCESS ) {
fprintf( stderr, "%s: dn=\"%s\" (line=%d): (%d) %s\n",
progname, e->e_dn, lineno, rc, *text );