~ttx/openldap/lucid-gssapi-495418

« back to all changes in this revision

Viewing changes to servers/slapd/syncrepl.c

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug
  • Date: 2009-03-06 17:34:21 UTC
  • mto: (0.3.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 12.
  • Revision ID: james.westby@ubuntu.com-20090306173421-n2o3ca73v9tmrdiy
Tags: upstream-2.4.15
ImportĀ upstreamĀ versionĀ 2.4.15

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* syncrepl.c -- Replication Engine which uses the LDAP Sync protocol */
2
 
/* $OpenLDAP: pkg/ldap/servers/slapd/syncrepl.c,v 1.254.2.61 2009/02/10 16:43:11 quanah Exp $ */
 
2
/* $OpenLDAP: pkg/ldap/servers/slapd/syncrepl.c,v 1.254.2.63 2009/02/17 21:17:20 quanah Exp $ */
3
3
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4
4
 *
5
5
 * Copyright 2003-2009 The OpenLDAP Foundation.
2876
2876
        Backend *be = op->o_bd;
2877
2877
        Modifications mod;
2878
2878
        struct berval first = BER_BVNULL;
 
2879
#ifdef CHECK_CSN
 
2880
        Syntax *syn = slap_schema.si_ad_contextCSN->ad_type->sat_syntax;
 
2881
#endif
2879
2882
 
2880
2883
        int rc, i, j;
2881
2884
        ber_len_t len;
2892
2895
 
2893
2896
        ldap_pvt_thread_mutex_lock( &si->si_cookieState->cs_mutex );
2894
2897
 
 
2898
#ifdef CHECK_CSN
 
2899
        for ( i=0; i<syncCookie->numcsns; i++ ) {
 
2900
                assert( !syn->ssyn_validate( syn, syncCookie->ctxcsn+i ));
 
2901
        }
 
2902
        for ( i=0; i<si->si_cookieState->cs_num; i++ ) {
 
2903
                assert( !syn->ssyn_validate( syn, si->si_cookieState->cs_vals+i ));
 
2904
        }
 
2905
#endif
 
2906
 
2895
2907
        /* clone the cookieState CSNs so we can Replace the whole thing */
2896
2908
        mod.sml_numvals = si->si_cookieState->cs_num;
2897
2909
        mod.sml_values = op->o_tmpalloc(( mod.sml_numvals+1 )*sizeof(struct berval), op->o_tmpmemctx );
2994
3006
        if ( mod.sml_next ) slap_mods_free( mod.sml_next, 1 );
2995
3007
        op->o_tmpfree( mod.sml_values, op->o_tmpmemctx );
2996
3008
 
 
3009
#ifdef CHECK_CSN
 
3010
        for ( i=0; i<si->si_cookieState->cs_num; i++ ) {
 
3011
                assert( !syn->ssyn_validate( syn, si->si_cookieState->cs_vals+i ));
 
3012
        }
 
3013
#endif
 
3014
 
2997
3015
        return rc;
2998
3016
}
2999
3017
 
4307
4325
                        BER_BVISNULL( &si->si_bindconf.sb_uri ) ?
4308
4326
                        "(null)" : si->si_bindconf.sb_uri.bv_val, 0, 0 );
4309
4327
                if ( c->be->be_syncinfo ) {
 
4328
                        syncinfo_t *sip;
 
4329
 
4310
4330
                        si->si_cookieState = c->be->be_syncinfo->si_cookieState;
 
4331
 
 
4332
                        // add new syncrepl to end of list (same order as when deleting)
 
4333
                        for ( sip = c->be->be_syncinfo; sip->si_next; sip = sip->si_next );
 
4334
                        sip->si_next = si;
4311
4335
                } else {
4312
4336
                        si->si_cookieState = ch_calloc( 1, sizeof( cookie_state ));
4313
4337
                        ldap_pvt_thread_mutex_init( &si->si_cookieState->cs_mutex );
 
4338
 
 
4339
                        c->be->be_syncinfo = si;
4314
4340
                }
4315
 
                si->si_next = c->be->be_syncinfo;
4316
 
                c->be->be_syncinfo = si;
 
4341
 
 
4342
                si->si_next = NULL;
 
4343
 
4317
4344
                return 0;
4318
4345
        }
4319
4346
}