Commit c96f12ee authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

SLAPD_SCHEMA_NOT_COMPAT: Fix memory stomping

parent 433d9388
......@@ -657,7 +657,7 @@ Attribute *backend_operational(
{
Attribute *a = ch_malloc( sizeof( Attribute ) );
#ifdef SLAPD_SCHEMA_NOT_COMPAT
a->a_desc = slap_schema.si_ad_subschemaSubentry;
a->a_desc = ad_dup( slap_schema.si_ad_subschemaSubentry );
#else
a->a_type = ch_strdup("subschemasubentry");
a->a_syntax = SYNTAX_DN | SYNTAX_CIS;
......@@ -665,9 +665,7 @@ Attribute *backend_operational(
/* Should be backend specific */
a->a_vals = ch_malloc( 2 * sizeof( struct berval * ) );
a->a_vals[0] = ch_malloc( sizeof( struct berval ) );
a->a_vals[0]->bv_val = ch_strdup( SLAPD_SCHEMA_DN );
a->a_vals[0]->bv_len = sizeof( SLAPD_SCHEMA_DN ) - 1;
a->a_vals[0] = ber_bvstrdup( SLAPD_SCHEMA_DN );
a->a_vals[1] = NULL;
a->a_next = NULL;
......
......@@ -433,7 +433,7 @@ int slap_mods_opattrs(
if( op->o_tag == LDAP_REQ_ADD ) {
mod = (Modifications *) ch_calloc( 1, sizeof( Modifications ) );
mod->sml_op = mop;
mod->sml_desc = slap_schema.si_ad_creatorsName;
mod->sml_desc = ad_dup( slap_schema.si_ad_creatorsName );
mod->sml_bvalues = (struct berval **) malloc( 2 * sizeof( struct berval * ) );
mod->sml_bvalues[0] = ber_bvdup( &name );
mod->sml_bvalues[1] = NULL;
......@@ -443,7 +443,7 @@ int slap_mods_opattrs(
mod = (Modifications *) ch_calloc( 1, sizeof( Modifications ) );
mod->sml_op = mop;
mod->sml_desc = slap_schema.si_ad_createTimestamp;
mod->sml_desc = ad_dup( slap_schema.si_ad_createTimestamp );
mod->sml_bvalues = (struct berval **) malloc( 2 * sizeof( struct berval * ) );
mod->sml_bvalues[0] = ber_bvdup( &timestamp );
mod->sml_bvalues[1] = NULL;
......
......@@ -129,12 +129,12 @@ struct berval **get_entry_referrals(
unsigned i, j;
#ifdef SLAPD_SCHEMA_NOT_COMPAT
AttributeDescription *ref = slap_schema.si_ad_ref;
AttributeDescription *ad_ref = slap_schema.si_ad_ref;
#else
static const char *ref = "ref";
static const char *ad_ref = "ref";
#endif
attr = attr_find( e->e_attrs, ref );
attr = attr_find( e->e_attrs, ad_ref );
if( attr == NULL ) return NULL;
......@@ -629,15 +629,15 @@ send_search_entry(
int opattrs;
#ifdef SLAPD_SCHEMA_NOT_COMPAT
AttributeDescription *entry = slap_schema.si_ad_entry;
AttributeDescription *ad_entry = slap_schema.si_ad_entry;
#else
static const char *entry = "entry";
static const char *ad_entry = "entry";
#endif
Debug( LDAP_DEBUG_TRACE, "=> send_search_entry: \"%s\"\n", e->e_dn, 0, 0 );
if ( ! access_allowed( be, conn, op, e,
entry, NULL, ACL_READ ) )
ad_entry, NULL, ACL_READ ) )
{
Debug( LDAP_DEBUG_ACL, "acl: access to entry not allowed\n",
0, 0, 0 );
......@@ -901,17 +901,17 @@ send_search_reference(
int bytes;
#ifdef SLAPD_SCHEMA_NOT_COMPAT
AttributeDescription *ref = slap_schema.si_ad_ref;
AttributeDescription *entry = slap_schema.si_ad_entry;
AttributeDescription *ad_ref = slap_schema.si_ad_ref;
AttributeDescription *ad_entry = slap_schema.si_ad_entry;
#else
static const char *ref = "ref";
static const char *entry = "entry";
static const char *ad_ref = "ref";
static const char *ad_entry = "entry";
#endif
Debug( LDAP_DEBUG_TRACE, "=> send_search_reference (%s)\n", e->e_dn, 0, 0 );
if ( ! access_allowed( be, conn, op, e,
entry, NULL, ACL_READ ) )
ad_entry, NULL, ACL_READ ) )
{
Debug( LDAP_DEBUG_ACL,
"send_search_reference: access to entry not allowed\n",
......@@ -920,7 +920,7 @@ send_search_reference(
}
if ( ! access_allowed( be, conn, op, e,
ref, NULL, ACL_READ ) )
ad_ref, NULL, ACL_READ ) )
{
Debug( LDAP_DEBUG_ACL,
"send_search_reference: access to reference not allowed\n",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment