/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 2002-2006 The OpenLDAP Foundation.
+ * Copyright 2002-2007 The OpenLDAP Foundation.
* Portions Copyright 1997,2002-2003 IBM Corporation.
* All rights reserved.
*
Slapi_Entry *
slapi_entry_alloc( void )
{
- return (Slapi_Entry *)slapi_ch_calloc( 1, sizeof(Slapi_Entry) );
+ return (Slapi_Entry *)entry_alloc();
}
void
} else {
if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH )
rs->sr_nentries = nentries;
+ if ( urls != NULL )
+ bvptr2obj( urls, &rs->sr_ref );
send_ldap_result( pb->pb_op, rs );
+
+ if ( urls != NULL )
+ slapi_ch_free( (void **)&rs->sr_ref );
}
}
int attrsonly )
{
SlapReply rs = { REP_SEARCH };
- int i = 0;
+ int i = 0, j = 0;
AttributeName *an = NULL;
const char *text;
int rc;
}
if ( i ) {
- an = (AttributeName *) slapi_ch_malloc( (i+1) * sizeof(AttributeName) );
+ an = (AttributeName *) slapi_ch_calloc( i + 1, sizeof(AttributeName) );
for ( i = 0; attrs[i] != NULL; i++ ) {
- an[i].an_name.bv_val = attrs[i];
- an[i].an_name.bv_len = strlen( attrs[i] );
- an[i].an_desc = NULL;
- (void) slap_bv2ad( &an[i].an_name, &an[i].an_desc, &text );
+ an[j].an_name.bv_val = attrs[i];
+ an[j].an_name.bv_len = strlen( attrs[i] );
+ an[j].an_desc = NULL;
+ if ( slap_bv2ad( &an[j].an_name, &an[j].an_desc, &text ) == LDAP_SUCCESS) {
+ j++;
+ }
}
- an[i].an_name.bv_len = 0;
- an[i].an_name.bv_val = NULL;
+ an[j].an_name.bv_len = 0;
+ an[j].an_name.bv_val = NULL;
}
rs.sr_err = LDAP_SUCCESS;
if ( pb == NULL || pb->pb_op == NULL )
return LDAP_PARAM_ERROR;
- ml = slapi_int_ldapmods2modifications( mods );
+ ml = slapi_int_ldapmods2modifications( pb->pb_op, mods );
if ( ml == NULL ) {
return LDAP_OTHER;
}
* before prettying (and we can't easily get out of calling
* slap_mods_check() because we need normalized values).
*/
-Modifications *slapi_int_ldapmods2modifications ( LDAPMod **mods )
+Modifications *slapi_int_ldapmods2modifications ( Operation *op, LDAPMod **mods )
{
Modifications *modlist = NULL, **modtail;
LDAPMod **modp;
modtail = &mod->sml_next;
}
- if ( slap_mods_check( modlist, &text, textbuf, sizeof( textbuf ), NULL ) != LDAP_SUCCESS ) {
+ if ( slap_mods_check( op, modlist, &text, textbuf, sizeof( textbuf ), NULL ) != LDAP_SUCCESS ) {
slap_mods_free( modlist, 1 );
modlist = NULL;
}
pb->pb_op->o_bd = select_backend( &e->e_nname, 0, 0 );
if ( pb->pb_op->o_bd != NULL ) {
- rc = entry_schema_check( pb->pb_op, e, NULL, 0,
+ rc = entry_schema_check( pb->pb_op, e, NULL, 0, 0,
&text, textbuf, textlen );
}
pb->pb_op->o_bd = be_orig;