-
- *entry = e;
- return LDAP_SUCCESS;
-}
-
-int entry_encode(
- Entry *e,
- struct berval **bv )
-{
- int rc = -1;
- Attribute *a;
- BerElement *ber;
-
-#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
- "entry_encode: id: 0x%08lx \"%s\"\n",
- (long) e->e_id, e->e_dn ));
-#else
- Debug( LDAP_DEBUG_TRACE, "=> entry_encode(0x%08lx): %s\n",
- (long) e->e_id, e->e_dn, 0 );
-#endif
- ber = ber_alloc_t( LBER_USE_DER );
- if( ber == NULL ) {
- goto done;
- }
-
- rc = ber_printf( ber, "{ss{" /*"}}"*/, e->e_dn, e->e_ndn );
- if( rc < 0 ) {
- goto done;
- }
-
- for ( a = e->e_attrs; a != NULL; a = a->a_next ) {
- rc = ber_printf( ber, "{O{V}}",
- &a->a_desc->ad_cname,
- a->a_vals );
- if( rc < 0 ) {
- goto done;
- }
- }
-
- rc = ber_printf( ber, /*"{{"*/ "}}" );
- if( rc < 0 ) {
- goto done;
- }
-
- rc = ber_flatten( ber, bv );
-
-done:
- ber_free( ber, 1 );
- if( rc ) {
-#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "entry_encode: id=0x%08lx failed (%d)\n",
- (long) e->e_id, rc ));
-#else
- Debug( LDAP_DEBUG_ANY, "=> entry_encode(0x%08lx): failed (%d)\n",
- (long) e->e_id, rc, 0 );
-#endif
- }
- return rc;