Diff for /servers/slapd/overlays/syncprov.c between versions 1.191 and 1.198

version 1.191, 2007/07/18 19:02:14 version 1.198, 2007/09/23 02:40:17
Line 1 Line 1
 /* $OpenLDAP: pkg/ldap/servers/slapd/overlays/syncprov.c,v 1.190 2007/06/08 07:05:35 hyc Exp $ */  /* $OpenLDAP: pkg/ldap/servers/slapd/overlays/syncprov.c,v 1.197 2007/09/21 06:43:57 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 585  syncprov_findcsn( Operation *op, find_cs Line 585  syncprov_findcsn( Operation *op, find_cs
         char cbuf[LDAP_LUTIL_CSNSTR_BUFSIZE];          char cbuf[LDAP_LUTIL_CSNSTR_BUFSIZE];
         struct berval maxcsn;          struct berval maxcsn;
         Filter cf;          Filter cf;
 #ifdef LDAP_COMP_MATCH          AttributeAssertion eq = ATTRIBUTEASSERTION_INIT;
         AttributeAssertion eq = { NULL, BER_BVNULL, NULL };  
 #else  
         AttributeAssertion eq = { NULL, BER_BVNULL };  
 #endif  
         fpres_cookie pcookie;          fpres_cookie pcookie;
         sync_control *srs = NULL;          sync_control *srs = NULL;
         struct slap_limits_set fc_limits;          struct slap_limits_set fc_limits;
Line 659  again: Line 655  again:
                 } else {                  } else {
                         cf.f_choice = LDAP_FILTER_LE;                          cf.f_choice = LDAP_FILTER_LE;
                         fop.ors_limit = &fc_limits;                          fop.ors_limit = &fc_limits;
                           memset( &fc_limits, 0, sizeof( fc_limits ));
                         fc_limits.lms_s_unchecked = 1;                          fc_limits.lms_s_unchecked = 1;
                         fop.ors_filterstr.bv_len = sprintf( buf, "(entryCSN<=%s)",                          fop.ors_filterstr.bv_len = sprintf( buf, "(entryCSN<=%s)",
                                 cf.f_av_value.bv_val );                                  cf.f_av_value.bv_val );
Line 1482  syncprov_playlog( Operation *op, SlapRep Line 1479  syncprov_playlog( Operation *op, SlapRep
                 SlapReply frs = { REP_RESULT };                  SlapReply frs = { REP_RESULT };
                 int rc;                  int rc;
                 Filter mf, af;                  Filter mf, af;
 #ifdef LDAP_COMP_MATCH                  AttributeAssertion eq = ATTRIBUTEASSERTION_INIT;
                 AttributeAssertion eq = { NULL, BER_BVNULL, NULL };  
 #else  
                 AttributeAssertion eq;  
 #endif  
                 slap_callback cb = {0};                  slap_callback cb = {0};
   
                 fop = *op;                  fop = *op;
Line 2307  syncprov_operational( Line 2300  syncprov_operational(
                                                 a = attr_find( rs->sr_entry->e_attrs,                                                  a = attr_find( rs->sr_entry->e_attrs,
                                                         slap_schema.si_ad_contextCSN );                                                          slap_schema.si_ad_contextCSN );
                                         }                                          }
                                         free( a->a_vals );                                          if ( a->a_nvals != a->a_vals ) {
                                                   ber_bvarray_free( a->a_nvals );
                                           }
                                           a->a_nvals = NULL;
                                           ber_bvarray_free( a->a_vals );
                                           a->a_vals = NULL;
                                           a->a_numvals = 0;
                                 }                                  }
                                 ber_bvarray_dup_x( &a->a_vals, si->si_ctxcsn, NULL );                                  attr_valadd( a, si->si_ctxcsn, si->si_ctxcsn, si->si_numcsns );
                                 a->a_nvals = a->a_vals;  
                         }                          }
                         ldap_pvt_thread_rdwr_runlock( &si->si_csn_rwlock );                          ldap_pvt_thread_rdwr_runlock( &si->si_csn_rwlock );
                 }                  }
Line 2369  sp_cf_gen(ConfigArgs *c) Line 2367  sp_cf_gen(ConfigArgs *c)
                 case SP_CHKPT:                  case SP_CHKPT:
                         if ( si->si_chkops || si->si_chktime ) {                          if ( si->si_chkops || si->si_chktime ) {
                                 struct berval bv;                                  struct berval bv;
                                 bv.bv_len = sprintf( c->msg, "%d %d",                                  bv.bv_len = sprintf( c->cr_msg, "%d %d",
                                         si->si_chkops, si->si_chktime );                                          si->si_chkops, si->si_chktime );
                                 bv.bv_val = c->msg;                                  bv.bv_val = c->cr_msg;
                                 value_add_one( &c->rvalue_vals, &bv );                                  value_add_one( &c->rvalue_vals, &bv );
                         } else {                          } else {
                                 rc = 1;                                  rc = 1;
Line 2430  sp_cf_gen(ConfigArgs *c) Line 2428  sp_cf_gen(ConfigArgs *c)
         switch ( c->type ) {          switch ( c->type ) {
         case SP_CHKPT:          case SP_CHKPT:
                 if ( lutil_atoi( &si->si_chkops, c->argv[1] ) != 0 ) {                  if ( lutil_atoi( &si->si_chkops, c->argv[1] ) != 0 ) {
                         snprintf( c->msg, sizeof( c->msg ), "%s unable to parse checkpoint ops # \"%s\"",                          snprintf( c->cr_msg, sizeof( c->cr_msg ), "%s unable to parse checkpoint ops # \"%s\"",
                                 c->argv[0], c->argv[1] );                                  c->argv[0], c->argv[1] );
                         Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,                          Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,
                                 "%s: %s\n", c->log, c->msg, 0 );                                  "%s: %s\n", c->log, c->cr_msg, 0 );
                         return ARG_BAD_CONF;                          return ARG_BAD_CONF;
                 }                  }
                 if ( si->si_chkops <= 0 ) {                  if ( si->si_chkops <= 0 ) {
                         snprintf( c->msg, sizeof( c->msg ), "%s invalid checkpoint ops # \"%d\"",                          snprintf( c->cr_msg, sizeof( c->cr_msg ), "%s invalid checkpoint ops # \"%d\"",
                                 c->argv[0], si->si_chkops );                                  c->argv[0], si->si_chkops );
                         Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,                          Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,
                                 "%s: %s\n", c->log, c->msg, 0 );                                  "%s: %s\n", c->log, c->cr_msg, 0 );
                         return ARG_BAD_CONF;                          return ARG_BAD_CONF;
                 }                  }
                 if ( lutil_atoi( &si->si_chktime, c->argv[2] ) != 0 ) {                  if ( lutil_atoi( &si->si_chktime, c->argv[2] ) != 0 ) {
                         snprintf( c->msg, sizeof( c->msg ), "%s unable to parse checkpoint time \"%s\"",                          snprintf( c->cr_msg, sizeof( c->cr_msg ), "%s unable to parse checkpoint time \"%s\"",
                                 c->argv[0], c->argv[1] );                                  c->argv[0], c->argv[1] );
                         Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,                          Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,
                                 "%s: %s\n", c->log, c->msg, 0 );                                  "%s: %s\n", c->log, c->cr_msg, 0 );
                         return ARG_BAD_CONF;                          return ARG_BAD_CONF;
                 }                  }
                 if ( si->si_chktime <= 0 ) {                  if ( si->si_chktime <= 0 ) {
                         snprintf( c->msg, sizeof( c->msg ), "%s invalid checkpoint time \"%d\"",                          snprintf( c->cr_msg, sizeof( c->cr_msg ), "%s invalid checkpoint time \"%d\"",
                                 c->argv[0], si->si_chkops );                                  c->argv[0], si->si_chkops );
                         Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,                          Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,
                                 "%s: %s\n", c->log, c->msg, 0 );                                  "%s: %s\n", c->log, c->cr_msg, 0 );
                         return ARG_BAD_CONF;                          return ARG_BAD_CONF;
                 }                  }
                 si->si_chktime *= 60;                  si->si_chktime *= 60;
Line 2464  sp_cf_gen(ConfigArgs *c) Line 2462  sp_cf_gen(ConfigArgs *c)
                 int size = c->value_int;                  int size = c->value_int;
   
                 if ( size < 0 ) {                  if ( size < 0 ) {
                         snprintf( c->msg, sizeof( c->msg ), "%s size %d is negative",                          snprintf( c->cr_msg, sizeof( c->cr_msg ), "%s size %d is negative",
                                 c->argv[0], size );                                  c->argv[0], size );
                         Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,                          Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,
                                 "%s: %s\n", c->log, c->msg, 0 );                                  "%s: %s\n", c->log, c->cr_msg, 0 );
                         return ARG_BAD_CONF;                          return ARG_BAD_CONF;
                 }                  }
                 sl = si->si_logs;                  sl = si->si_logs;
Line 2511  syncprov_db_otask( Line 2509  syncprov_db_otask(
  */   */
 static int  static int
 syncprov_db_open(  syncprov_db_open(
     BackendDB *be          BackendDB *be,
           ConfigReply *cr
 )  )
 {  {
         slap_overinst   *on = (slap_overinst *) be->bd_info;          slap_overinst   *on = (slap_overinst *) be->bd_info;
Line 2555  syncprov_db_open( Line 2554  syncprov_db_open(
   
                 a = attr_find( e->e_attrs, slap_schema.si_ad_contextCSN );                  a = attr_find( e->e_attrs, slap_schema.si_ad_contextCSN );
                 if ( a ) {                  if ( a ) {
                         int i;  
                         ber_bvarray_dup_x( &si->si_ctxcsn, a->a_vals, NULL );                          ber_bvarray_dup_x( &si->si_ctxcsn, a->a_vals, NULL );
                         for ( i = 0; !BER_BVISNULL( &a->a_vals[i] ); i++ );                          si->si_numcsns = a->a_numvals;
                         si->si_numcsns = i;                          si->si_sids = slap_parse_csn_sids( si->si_ctxcsn, a->a_numvals, NULL );
                         si->si_sids = slap_parse_csn_sids( si->si_ctxcsn, i, NULL );  
                 }                  }
                 overlay_entry_release_ov( op, e, 0, on );                  overlay_entry_release_ov( op, e, 0, on );
                 if ( si->si_ctxcsn ) {                  if ( si->si_ctxcsn ) {
Line 2604  out: Line 2601  out:
  */   */
 static int  static int
 syncprov_db_close(  syncprov_db_close(
     BackendDB *be          BackendDB *be,
           ConfigReply *cr
 )  )
 {  {
     slap_overinst   *on = (slap_overinst *) be->bd_info;      slap_overinst   *on = (slap_overinst *) be->bd_info;
Line 2634  syncprov_db_close( Line 2632  syncprov_db_close(
   
 static int  static int
 syncprov_db_init(  syncprov_db_init(
         BackendDB *be          BackendDB *be,
           ConfigReply *cr
 )  )
 {  {
         slap_overinst   *on = (slap_overinst *)be->bd_info;          slap_overinst   *on = (slap_overinst *)be->bd_info;
Line 2666  syncprov_db_init( Line 2665  syncprov_db_init(
   
 static int  static int
 syncprov_db_destroy(  syncprov_db_destroy(
         BackendDB *be          BackendDB *be,
           ConfigReply *cr
 )  )
 {  {
         slap_overinst   *on = (slap_overinst *)be->bd_info;          slap_overinst   *on = (slap_overinst *)be->bd_info;

Removed from v.1.191  
changed lines
  Added in v.1.198


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