]> git.sur5r.net Git - openldap/commitdiff
allow to look-ahead entry DN without decoding the whole entry
authorPierangelo Masarati <ando@openldap.org>
Fri, 14 Aug 2009 15:33:09 +0000 (15:33 +0000)
committerPierangelo Masarati <ando@openldap.org>
Fri, 14 Aug 2009 15:33:09 +0000 (15:33 +0000)
servers/slapd/entry.c
servers/slapd/proto-slap.h

index 65e34fba98da7b23923ddabd6f0f557068b07299..c0e81c54c876842a4f4d7da9c213e81c05d837c0 100644 (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
index dc41cbd1203003ea357928e3b560f21f3069d218..48ba6cf4c31dac030d745ac4d6ab78c275470166 100644 (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 ));