Diff for /servers/slapd/overlays/syncprov.c between versions 1.65 and 1.66

version 1.65, 2005/01/13 20:14:52 version 1.66, 2005/01/14 03:26:59
Line 1 Line 1
 /* $OpenLDAP: pkg/ldap/servers/slapd/overlays/syncprov.c,v 1.64 2005/01/13 18:51:01 hyc Exp $ */  /* $OpenLDAP: pkg/ldap/servers/slapd/overlays/syncprov.c,v 1.65 2005/01/13 20:14:52 hyc Exp $ */
 /* syncprov.c - syncrepl provider */  /* syncprov.c - syncrepl provider */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.  /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *   *
Line 612  syncprov_findcsn( Operation *op, int mod Line 612  syncprov_findcsn( Operation *op, int mod
         if ( mode != FIND_MAXCSN ) {          if ( mode != FIND_MAXCSN ) {
                 srs = op->o_controls[slap_cids.sc_LDAPsync];                  srs = op->o_controls[slap_cids.sc_LDAPsync];
   
                 if ( srs->sr_state.ctxcsn->bv_len >= LDAP_LUTIL_CSNSTR_BUFSIZE ) {                  if ( srs->sr_state.ctxcsn.bv_len >= LDAP_LUTIL_CSNSTR_BUFSIZE ) {
                         return LDAP_OTHER;                          return LDAP_OTHER;
                 }                  }
         }          }
Line 648  syncprov_findcsn( Operation *op, int mod Line 648  syncprov_findcsn( Operation *op, int mod
                 break;                  break;
         case FIND_CSN:          case FIND_CSN:
                 cf.f_choice = LDAP_FILTER_LE;                  cf.f_choice = LDAP_FILTER_LE;
                 cf.f_av_value = *srs->sr_state.ctxcsn;                  cf.f_av_value = srs->sr_state.ctxcsn;
                 fbuf.bv_len = sprintf( buf, "(entryCSN<=%s)",                  fbuf.bv_len = sprintf( buf, "(entryCSN<=%s)",
                         cf.f_av_value.bv_val );                          cf.f_av_value.bv_val );
                 fop.ors_attrsonly = 1;                  fop.ors_attrsonly = 1;
Line 662  syncprov_findcsn( Operation *op, int mod Line 662  syncprov_findcsn( Operation *op, int mod
                 af.f_next = NULL;                  af.f_next = NULL;
                 af.f_and = &cf;                  af.f_and = &cf;
                 cf.f_choice = LDAP_FILTER_LE;                  cf.f_choice = LDAP_FILTER_LE;
                 cf.f_av_value = *srs->sr_state.ctxcsn;                  cf.f_av_value = srs->sr_state.ctxcsn;
                 cf.f_next = op->ors_filter;                  cf.f_next = op->ors_filter;
                 fop.ors_filter = &af;                  fop.ors_filter = &af;
                 filter2bv_x( &fop, fop.ors_filter, &fop.ors_filterstr );                  filter2bv_x( &fop, fop.ors_filter, &fop.ors_filterstr );
Line 921  syncprov_matchops( Operation *op, opcook Line 921  syncprov_matchops( Operation *op, opcook
                 e = op->ora_e;                  e = op->ora_e;
         }          }
   
         /* Never replicate these */  
         if ( is_entry_syncConsumerSubentry( e )) {  
                 goto done;  
         }  
         if ( saveit ) {          if ( saveit ) {
                 ber_dupbv_x( &opc->sdn, &e->e_name, op->o_tmpmemctx );                  ber_dupbv_x( &opc->sdn, &e->e_name, op->o_tmpmemctx );
                 ber_dupbv_x( &opc->sndn, &e->e_nname, op->o_tmpmemctx );                  ber_dupbv_x( &opc->sndn, &e->e_nname, op->o_tmpmemctx );
Line 1294  syncprov_op_response( Operation *op, Sla Line 1290  syncprov_op_response( Operation *op, Sla
                         }                          }
                 }                  }
   
                   /* Don't do any processing for consumer contextCSN updates */
                   if ( SLAP_SYNC_SHADOW( op->o_bd ) && 
                           op->o_msgid == SLAP_SYNC_UPDATE_MSGID ) {
                           ldap_pvt_thread_mutex_unlock( &si->si_csn_mutex );
                           return SLAP_CB_CONTINUE;
                   }
   
                 si->si_numops++;                  si->si_numops++;
                 if ( si->si_chkops || si->si_chktime ) {                  if ( si->si_chkops || si->si_chktime ) {
                         int do_check=0;                          int do_check=0;
Line 1605  syncprov_search_response( Operation *op, Line 1608  syncprov_search_response( Operation *op,
                         Debug( LDAP_DEBUG_ANY, "bogus referral in context\n",0,0,0 );                          Debug( LDAP_DEBUG_ANY, "bogus referral in context\n",0,0,0 );
                         return SLAP_CB_CONTINUE;                          return SLAP_CB_CONTINUE;
                 }                  }
                 if ( srs->sr_state.ctxcsn ) {                  if ( !BER_BVISNULL( &srs->sr_state.ctxcsn )) {
                         Attribute *a = attr_find( rs->sr_entry->e_attrs,                          Attribute *a = attr_find( rs->sr_entry->e_attrs,
                                 slap_schema.si_ad_entryCSN );                                  slap_schema.si_ad_entryCSN );
                                                   
                         /* Don't send the ctx entry twice */                          /* Don't send the ctx entry twice */
                         if ( a && bvmatch( &a->a_nvals[0], srs->sr_state.ctxcsn ) )                          if ( a && bvmatch( &a->a_nvals[0], &srs->sr_state.ctxcsn ) )
                                 return LDAP_SUCCESS;                                  return LDAP_SUCCESS;
                 }                  }
                 rs->sr_ctrls = op->o_tmpalloc( sizeof(LDAPControl *)*2,                  rs->sr_ctrls = op->o_tmpalloc( sizeof(LDAPControl *)*2,
Line 1760  syncprov_op_search( Operation *op, SlapR Line 1763  syncprov_op_search( Operation *op, SlapR
         ctxcsn.bv_val = csnbuf;          ctxcsn.bv_val = csnbuf;
                   
         /* If we have a cookie, handle the PRESENT lookups */          /* If we have a cookie, handle the PRESENT lookups */
         if ( srs->sr_state.ctxcsn ) {          if ( !BER_BVISNULL( &srs->sr_state.ctxcsn )) {
                 sessionlog *sl;                  sessionlog *sl;
   
                 /* The cookie was validated when it was parsed, just use it */                  /* The cookie was validated when it was parsed, just use it */
   
                 /* If just Refreshing and nothing has changed, shortcut it */                  /* If just Refreshing and nothing has changed, shortcut it */
                 if ( bvmatch( srs->sr_state.ctxcsn, &ctxcsn )) {                  if ( bvmatch( &srs->sr_state.ctxcsn, &ctxcsn )) {
                         nochange = 1;                          nochange = 1;
                         if ( !(op->o_sync_mode & SLAP_SYNC_PERSIST) ) {                          if ( !(op->o_sync_mode & SLAP_SYNC_PERSIST) ) {
                                 LDAPControl     *ctrls[2];                                  LDAPControl     *ctrls[2];
Line 1787  syncprov_op_search( Operation *op, SlapR Line 1790  syncprov_op_search( Operation *op, SlapR
                 sl=si->si_logs;                  sl=si->si_logs;
                 if ( sl ) {                  if ( sl ) {
                         ldap_pvt_thread_mutex_lock( &sl->sl_mutex );                          ldap_pvt_thread_mutex_lock( &sl->sl_mutex );
                         if ( ber_bvcmp( srs->sr_state.ctxcsn, &sl->sl_mincsn ) >= 0 ) {                          if ( ber_bvcmp( &srs->sr_state.ctxcsn, &sl->sl_mincsn ) >= 0 ) {
                                 do_present = 0;                                  do_present = 0;
                                 /* mutex is unlocked in playlog */                                  /* mutex is unlocked in playlog */
                                 syncprov_playlog( op, rs, sl, srs->sr_state.ctxcsn, &ctxcsn );                                  syncprov_playlog( op, rs, sl, &srs->sr_state.ctxcsn, &ctxcsn );
                         } else {                          } else {
                                 ldap_pvt_thread_mutex_unlock( &sl->sl_mutex );                                  ldap_pvt_thread_mutex_unlock( &sl->sl_mutex );
                         }                          }
Line 1838  shortcut: Line 1841  shortcut:
                 fava->f_choice = LDAP_FILTER_GE;                  fava->f_choice = LDAP_FILTER_GE;
                 fava->f_ava = op->o_tmpalloc( sizeof(AttributeAssertion), op->o_tmpmemctx );                  fava->f_ava = op->o_tmpalloc( sizeof(AttributeAssertion), op->o_tmpmemctx );
                 fava->f_ava->aa_desc = slap_schema.si_ad_entryCSN;                  fava->f_ava->aa_desc = slap_schema.si_ad_entryCSN;
                 ber_dupbv_x( &fava->f_ava->aa_value, srs->sr_state.ctxcsn, op->o_tmpmemctx );                  ber_dupbv_x( &fava->f_ava->aa_value, &srs->sr_state.ctxcsn, op->o_tmpmemctx );
         }          }
         fava->f_next = op->ors_filter;          fava->f_next = op->ors_filter;
         op->ors_filter = fand;          op->ors_filter = fand;
Line 2210  static int syncprov_parseCtrl ( Line 2213  static int syncprov_parseCtrl (
         sr = op->o_tmpcalloc( 1, sizeof(struct sync_control), op->o_tmpmemctx );          sr = op->o_tmpcalloc( 1, sizeof(struct sync_control), op->o_tmpmemctx );
         sr->sr_rhint = rhint;          sr->sr_rhint = rhint;
         if (!BER_BVISNULL(&cookie)) {          if (!BER_BVISNULL(&cookie)) {
                 ber_bvarray_add( &sr->sr_state.octet_str, &cookie );                  ber_dupbv( &sr->sr_state.octet_str, &cookie );
                 slap_parse_sync_cookie( &sr->sr_state );                  slap_parse_sync_cookie( &sr->sr_state );
         }          }
   

Removed from v.1.65  
changed lines
  Added in v.1.66


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