don't bother about slap_dummy_bv

This commit is contained in:
Pierangelo Masarati 2005-05-13 09:06:28 +00:00
parent cf31d48665
commit 96773427db
3 changed files with 21 additions and 50 deletions

View File

@ -38,8 +38,7 @@
static int
ldap_build_entry( Operation *op, LDAPMessage *e, Entry *ent,
struct berval *bdn, int flags );
#define LDAP_BUILD_ENTRY_PRIVATE 0x01
struct berval *bdn );
/*
* Quick'n'dirty rewrite of filter in case of error, to deal with
@ -269,35 +268,23 @@ fail:;
do_retry = 0;
e = ldap_first_entry( lc->lc_ld, res );
rc = ldap_build_entry( op, e, &ent, &bdn,
LDAP_BUILD_ENTRY_PRIVATE );
rc = ldap_build_entry( op, e, &ent, &bdn );
if ( rc == LDAP_SUCCESS ) {
rs->sr_entry = &ent;
rs->sr_attrs = op->ors_attrs;
rs->sr_operational_attrs = NULL;
rs->sr_flags = 0;
abort = send_search_entry( op, rs );
while ( ent.e_attrs ) {
Attribute *a;
a = ent.e_attrs;
ent.e_attrs = a->a_next;
if ( a->a_nvals != a->a_vals ) {
ber_bvarray_free( a->a_nvals );
}
if ( a->a_vals != &slap_dummy_bv ) {
ber_bvarray_free( a->a_vals );
}
ch_free( a );
if ( !BER_BVISNULL( &ent.e_name ) && ( ent.e_name.bv_val != bdn.bv_val ) )
{
free( ent.e_name.bv_val );
BER_BVZERO( &ent.e_name );
}
if ( ent.e_dn && ( ent.e_dn != bdn.bv_val ) ) {
free( ent.e_dn );
}
if ( ent.e_ndn ) {
free( ent.e_ndn );
if ( !BER_BVISNULL( &ent.e_nname ) ) {
free( ent.e_nname.bv_val );
BER_BVZERO( &ent.e_nname );
}
entry_clean( &ent );
}
ldap_msgfree( res );
if ( abort ) {
@ -445,15 +432,13 @@ ldap_build_entry(
Operation *op,
LDAPMessage *e,
Entry *ent,
struct berval *bdn,
int flags )
struct berval *bdn )
{
struct berval a;
BerElement ber = *e->lm_ber;
Attribute *attr, **attrp;
const char *text;
int last;
int private = flags & LDAP_BUILD_ENTRY_PRIVATE;
/* safe assumptions ... */
assert( ent );
@ -530,13 +515,7 @@ ldap_build_entry(
* Note: attr->a_vals can be null when using
* values result filter
*/
if ( private ) {
attr->a_vals = (struct berval *)&slap_dummy_bv;
} else {
attr->a_vals = ch_malloc( sizeof( struct berval ) );
BER_BVZERO( &attr->a_vals[ 0 ] );
}
attr->a_vals = (struct berval *)&slap_dummy_bv;
last = 0;
} else {
@ -708,7 +687,7 @@ retry:
*ent = ch_calloc( 1, sizeof( Entry ) );
rc = ldap_build_entry( op, e, *ent, &bdn, 0 );
rc = ldap_build_entry( op, e, *ent, &bdn );
if ( rc != LDAP_SUCCESS ) {
ch_free( *ent );

View File

@ -942,24 +942,16 @@ meta_send_entry(
send_search_entry( op, rs );
rs->sr_entry = NULL;
rs->sr_attrs = NULL;
while ( ent.e_attrs ) {
attr = ent.e_attrs;
ent.e_attrs = attr->a_next;
if ( attr->a_vals != &slap_dummy_bv ) {
if ( attr->a_nvals != attr->a_vals ) {
ber_bvarray_free( attr->a_nvals );
}
ber_bvarray_free( attr->a_vals );
}
free( attr );
}
if ( ent.e_dn && ent.e_dn != bdn.bv_val ) {
free( ent.e_dn );
if ( !BER_BVISNULL( &ent.e_name ) && ent.e_name.bv_val != bdn.bv_val ) {
free( ent.e_name.bv_val );
BER_BVZERO( &ent.e_name );
}
if ( ent.e_ndn ) {
free( ent.e_ndn );
if ( !BER_BVISNULL( &ent.e_nname ) ) {
free( ent.e_nname.bv_val );
BER_BVZERO( &ent.e_nname );
}
entry_clean( &ent );
return LDAP_SUCCESS;
}

View File

@ -868,7 +868,7 @@ rwm_attrs( Operation *op, SlapReply *rs, Attribute** a_first, int stripEntryDN )
/* just count */ ;
if ( last == 0 ) {
/* empty? for now, we leave it in place */
/* empty? leave it in place because of attrsonly and vlv */
goto next_attr;
}
last--;