Diff for /servers/slapd/back-bdb/dn2id.c between versions 1.76 and 1.77

version 1.76, 2003/04/23 04:34:55 version 1.77, 2003/04/23 06:46:23
Line 1 Line 1
 /* dn2id.c - routines to deal with the dn2id index */  /* dn2id.c - routines to deal with the dn2id index */
 /* $OpenLDAP: pkg/ldap/servers/slapd/back-bdb/dn2id.c,v 1.75 2003/04/22 16:59:37 hyc Exp $ */  /* $OpenLDAP: pkg/ldap/servers/slapd/back-bdb/dn2id.c,v 1.76 2003/04/23 04:34:55 hyc Exp $ */
 /*  /*
  * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.   * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file   * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
Line 545  bdb_dup_compare( Line 545  bdb_dup_compare(
 /* This function constructs a full DN for a given entry.  /* This function constructs a full DN for a given entry.
  */   */
 int bdb_fix_dn(  int bdb_fix_dn(
         Entry *e          Entry *e,
           int checkit
 )  )
 {  {
         EntryInfo *ei;          EntryInfo *ei;
         int rlen = 0, nrlen = 0;          int rlen = 0, nrlen = 0;
         char *ptr, *nptr;          char *ptr, *nptr;
           int max = 0;
                   
         for ( ei = BEI(e); ei && ei->bei_id; ei=ei->bei_parent ) {          for ( ei = BEI(e); ei && ei->bei_id; ei=ei->bei_parent ) {
                 rlen += ei->bei_rdn.bv_len + 1;                  rlen += ei->bei_rdn.bv_len + 1;
                 nrlen += ei->bei_nrdn.bv_len + 1;                  nrlen += ei->bei_nrdn.bv_len + 1;
                   if (ei->bei_modrdns > max) max = ei->bei_modrdns;
         }          }
   
           /* See if the entry DN was invalidated by a subtree rename */
           if ( checkit ) {
                   if ( BEI(e)->bei_modrdns >= max ) {
                           return 0;
                   }
                   /* We found a mismatch, tell the caller to lock it */
                   if ( checkit == 1 ) {
                           return 1;
                   }
                   /* checkit == 2. do the fix. */
                   free( e->e_name.bv_val );
           }
   
         e->e_name.bv_len = rlen - 1;          e->e_name.bv_len = rlen - 1;
         e->e_nname.bv_len = nrlen - 1;          e->e_nname.bv_len = nrlen - 1;
         e->e_name.bv_val = ch_malloc(rlen + nrlen);          e->e_name.bv_val = ch_malloc(rlen + nrlen);
Line 570  int bdb_fix_dn( Line 587  int bdb_fix_dn(
                         *nptr++ = ',';                          *nptr++ = ',';
                 }                  }
         }          }
           BEI(e)->bei_modrdns = max;
         ptr[-1] = '\0';          ptr[-1] = '\0';
         nptr[-1] = '\0';          nptr[-1] = '\0';
   

Removed from v.1.76  
changed lines
  Added in v.1.77


______________
© Copyright 1998-2020, OpenLDAP Foundation, info@OpenLDAP.org