SLAPD_SCHEMA_NOT_COMPAT: fix bugs in add/modify logic

This commit is contained in:
Kurt Zeilenga 2000-05-23 18:08:19 +00:00
parent bf3a229423
commit 62eea3b452
3 changed files with 31 additions and 6 deletions

View file

@ -233,7 +233,15 @@ do_add( Connection *conn, Operation *op )
#endif
{
#ifdef SLAPD_SCHEMA_NOT_COMPAT
rc = slap_mods_opattrs( op, &mods, &text );
Modifications **modstail;
for( modstail = &mods;
*modstail != NULL;
modstail = &(*modstail)->sml_next )
{
assert( (*modstail)->sml_op == LDAP_MOD_ADD );
assert( (*modstail)->sml_desc != NULL );
}
rc = slap_mods_opattrs( op, modstail, &text );
#else
char *text = "no-user-modification attribute type";
rc = add_created_attrs( op, e );
@ -307,6 +315,7 @@ static int slap_mods2entry(
Attribute *attr;
assert( mods->sml_op == LDAP_MOD_ADD );
assert( mods->sml_desc != NULL );
attr = attr_find( (*e)->e_attrs, mods->sml_desc );
@ -317,7 +326,12 @@ static int slap_mods2entry(
attr = ch_calloc( 1, sizeof(Attribute) );
/* should check for duplicates */
/* move ad to attr structure */
attr->a_desc = mods->sml_desc;
mods->sml_desc = NULL;
/* move values to attr structure */
/* should check for duplicates */
attr->a_vals = mods->sml_bvalues;
mods->sml_bvalues = NULL;

View file

@ -235,7 +235,14 @@ do_modify(
global_lastmod == ON)) && !update )
{
#ifdef SLAPD_SCHEMA_NOT_COMPAT
rc = slap_mods_opattrs( op, &mods, &text );
Modifications **modstail;
for( modstail = &mods;
*modstail != NULL;
modstail = &(*modstail)->sml_next )
{
/* empty */
}
rc = slap_mods_opattrs( op, modstail, &text );
#else
char *text = "no-user-modification attribute type";
rc = add_modified_attrs( op, &mods );
@ -303,16 +310,16 @@ int slap_modlist2mods(
mod = (Modifications *)
ch_calloc( 1, sizeof(Modifications) );
ad = mod->sml_desc;
/* convert to attribute description */
rc = slap_str2ad( ml->ml_type, &ad, text );
rc = slap_str2ad( ml->ml_type, &mod->sml_desc, text );
if( rc != LDAP_SUCCESS ) {
slap_mods_free( mod );
return rc;
}
ad = mod->sml_desc;
if( slap_syntax_is_binary( ad->ad_type->sat_syntax )
&& !slap_ad_is_binary( ad ))
{
@ -405,6 +412,9 @@ int slap_mods_opattrs(
int mop = op->o_tag == LDAP_REQ_ADD
? LDAP_MOD_ADD : LDAP_MOD_REPLACE;
assert( modtail != NULL );
assert( *modtail == NULL );
ldap_pvt_thread_mutex_lock( &gmtime_mutex );
ltm = gmtime( &now );
strftime( timebuf, sizeof(timebuf), "%Y%m%d%H%M%SZ", ltm );

View file

@ -52,6 +52,7 @@ entry_schema_check(
if ( (aoc = attr_find( e->e_attrs, ad_objectClass )) == NULL ) {
Debug( LDAP_DEBUG_ANY, "No object class for entry (%s)\n",
e->e_dn, 0, 0 );
assert(0);
*text = "no objectclass attribute";
return oldattrs != NULL