Add initial entry_encode() routine for back-sleepy (behind #if)

Need to add entry_decode().
This commit is contained in:
Kurt Zeilenga 2000-09-12 00:28:08 +00:00
parent a3ae90ac8a
commit fdc16c2f94
2 changed files with 45 additions and 1 deletions

View File

@ -223,6 +223,47 @@ entry2str(
return( (char *) ebuf );
}
#if SLAPD_SLEEPY
int entry_encode(
Entry *e,
struct berval **bv )
{
int rc = -1;
Attribute *a;
BerElement *ber;
ber = ber_alloc_t( LBER_USE_DER );
if( ber == NULL ) {
goto done;
}
rc = ber_printf( ber, "{s{" /*"}}"*/, e->e_dn );
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 );
return rc;
}
#endif
void
entry_free( Entry *e )
{

View File

@ -314,8 +314,11 @@ LDAP_SLAPD_F (int) entry_destroy LDAP_P((void));
LDAP_SLAPD_F (Entry *) str2entry LDAP_P(( char *s ));
LDAP_SLAPD_F (char *) entry2str LDAP_P(( Entry *e, int *len ));
LDAP_SLAPD_F (void) entry_free LDAP_P(( Entry *e ));
LDAP_SLAPD_F (int) entry_decode LDAP_P(( struct berval *bv, Entry **e ));
LDAP_SLAPD_F (int) entry_encode LDAP_P(( Entry *e, struct berval **bv ));
LDAP_SLAPD_F (void) entry_free LDAP_P(( Entry *e ));
LDAP_SLAPD_F (int) entry_cmp LDAP_P(( Entry *a, Entry *b ));
LDAP_SLAPD_F (int) entry_dn_cmp LDAP_P(( Entry *a, Entry *b ));
LDAP_SLAPD_F (int) entry_id_cmp LDAP_P(( Entry *a, Entry *b ));