]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
Support zero-length entries
authorHoward Chu <hyc@openldap.org>
Sat, 27 Aug 2011 21:41:05 +0000 (14:41 -0700)
committerHoward Chu <hyc@openldap.org>
Sat, 27 Aug 2011 21:47:20 +0000 (14:47 -0700)
servers/slapd/back-mdb/id2entry.c

index 10c6c2164881eca13d8ac611e19b745a5bba5f00..04e528846d3463aef24084d199d11643f55c8483 100644 (file)
@@ -122,13 +122,16 @@ int mdb_id2entry(
        rc = entry_header( &eh );
        if ( rc ) return rc;
 
-       eh.bv.bv_len = eh.nvals * sizeof( struct berval );
-       eh.bv.bv_val = ch_malloc( eh.bv.bv_len );
-       rc = entry_decode(&eh, e);
+       if ( eh.nvals ) {
+               eh.bv.bv_len = eh.nvals * sizeof( struct berval );
+               eh.bv.bv_val = ch_malloc( eh.bv.bv_len );
+               rc = entry_decode(&eh, e);
+       } else {
+               *e = entry_alloc();
+       }
 
        if( rc == 0 ) {
                (*e)->e_id = id;
-               (*e)->e_bv = eh.bv;
                (*e)->e_name.bv_val = NULL;
                (*e)->e_nname.bv_val = NULL;
        } else {