allow to look-ahead entry DN without decoding the whole entry

This commit is contained in:
Pierangelo Masarati 2009-08-14 15:33:09 +00:00
parent 8ecfb077bf
commit dc12e58d38
2 changed files with 31 additions and 0 deletions

View File

@ -820,6 +820,35 @@ int entry_header(EntryHeader *eh)
return LDAP_SUCCESS;
}
int
entry_decode_dn( EntryHeader *eh, struct berval *dn, struct berval *ndn )
{
int i;
unsigned char *ptr = (unsigned char *)eh->bv.bv_val;
assert( dn != NULL || ndn != NULL );
ptr = (unsigned char *)eh->data;
i = entry_getlen(&ptr);
if ( dn != NULL ) {
dn->bv_val = (char *) ptr;
dn->bv_len = i;
}
if ( ndn != NULL ) {
ptr += i + 1;
i = entry_getlen(&ptr);
ndn->bv_val = (char *) ptr;
ndn->bv_len = i;
}
Debug( LDAP_DEBUG_TRACE,
"entry_decode_dn: \"%s\"\n",
dn ? dn->bv_val : ndn->bv_val, 0, 0 );
return 0;
}
#ifdef SLAP_ZONE_ALLOC
int entry_decode(EntryHeader *eh, Entry **e, void *ctx)
#else

View File

@ -976,6 +976,8 @@ LDAP_SLAPD_F (void) entry_partsize LDAP_P(( Entry *e, ber_len_t *len,
int *nattrs, int *nvals, int norm ));
LDAP_SLAPD_F (int) entry_header LDAP_P(( EntryHeader *eh ));
LDAP_SLAPD_F (int) entry_decode_dn LDAP_P((
EntryHeader *eh, struct berval *dn, struct berval *ndn ));
#ifdef SLAP_ZONE_ALLOC
LDAP_SLAPD_F (int) entry_decode LDAP_P((
EntryHeader *eh, Entry **e, void *ctx ));