]> git.sur5r.net Git - openldap/commitdiff
don't bother about slap_dummy_bv
authorPierangelo Masarati <ando@openldap.org>
Fri, 13 May 2005 09:06:28 +0000 (09:06 +0000)
committerPierangelo Masarati <ando@openldap.org>
Fri, 13 May 2005 09:06:28 +0000 (09:06 +0000)
servers/slapd/back-ldap/search.c
servers/slapd/back-meta/search.c
servers/slapd/overlays/rwm.c

index 144e27f6014eda16f71d2ad12b77dc2989aa01d6..2c6d296f5c7c1bbc14720bd4a309b3825a26b84f 100644 (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 ( 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 );
                        }
                        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 );
index d5113fb3f3b66fe441c9766d856b091e680931e8..90abb9f6c79f8eb947777017751e300f9e58f599 100644 (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;
 }
index 4ff18d6573aafac930bf906a970f95307f78064f..b91ba2c17fd670dcdf3a9dd99fd70616f3c0572b 100644 (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--;