mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-24 00:29:35 -05:00
Fix entry_encode; must save the given e->e_dn without modification.
This commit is contained in:
parent
c981026a6c
commit
c108e66222
1 changed files with 5 additions and 7 deletions
|
|
@ -392,7 +392,7 @@ entry_id_cmp( Entry *e1, Entry *e2 )
|
|||
int entry_encode(Entry *e, struct berval **bv)
|
||||
{
|
||||
int siz = sizeof(Entry);
|
||||
int len, dnlen;
|
||||
int len, dnlen, ndnlen;
|
||||
int i, j;
|
||||
Entry *f;
|
||||
Attribute *a, *b;
|
||||
|
|
@ -400,8 +400,6 @@ int entry_encode(Entry *e, struct berval **bv)
|
|||
char *ptr, *base, *data;
|
||||
|
||||
*bv = ch_malloc(sizeof(struct berval));
|
||||
/* Compress any white space in the DN */
|
||||
dn_validate(e->e_dn);
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
|
||||
"entry_encode: id: 0x%08lx \"%s\"\n",
|
||||
|
|
@ -411,8 +409,8 @@ int entry_encode(Entry *e, struct berval **bv)
|
|||
(long) e->e_id, e->e_dn, 0 );
|
||||
#endif
|
||||
dnlen = strlen(e->e_dn);
|
||||
/* The dn and ndn are always the same length */
|
||||
len = dnlen + dnlen + 2; /* two trailing NUL bytes */
|
||||
ndnlen = strlen(e->e_ndn);
|
||||
len = dnlen + ndnlen + 2; /* two trailing NUL bytes */
|
||||
for (a=e->e_attrs; a; a=a->a_next) {
|
||||
/* For AttributeDesc, we only store the attr name */
|
||||
siz += sizeof(Attribute);
|
||||
|
|
@ -436,8 +434,8 @@ int entry_encode(Entry *e, struct berval **bv)
|
|||
ptr += dnlen;
|
||||
*ptr++ = '\0';
|
||||
f->e_ndn = (char *)(ptr-base);
|
||||
memcpy(ptr, e->e_ndn, dnlen);
|
||||
ptr += dnlen;
|
||||
memcpy(ptr, e->e_ndn, ndnlen);
|
||||
ptr += ndnlen;
|
||||
*ptr++ = '\0';
|
||||
f->e_attrs = e->e_attrs ? (Attribute *)sizeof(Entry) : NULL;
|
||||
f->e_private = NULL;
|
||||
|
|
|
|||
Loading…
Reference in a new issue