version 1.171, 2007/02/05 03:50:07
|
version 1.172, 2007/02/05 08:19:46
|
Line 1
|
Line 1
|
/* $OpenLDAP: pkg/ldap/servers/slapd/overlays/syncprov.c,v 1.170 2007/01/25 10:56:49 hyc Exp $ */ |
/* $OpenLDAP: pkg/ldap/servers/slapd/overlays/syncprov.c,v 1.171 2007/02/05 03:50:07 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 2061 syncprov_op_search( Operation *op, SlapR
|
Line 2061 syncprov_op_search( Operation *op, SlapR
|
|
|
/* snapshot the ctxcsn */ |
/* snapshot the ctxcsn */ |
ldap_pvt_thread_mutex_lock( &si->si_csn_mutex ); |
ldap_pvt_thread_mutex_lock( &si->si_csn_mutex ); |
ber_bvarray_dup_x( &ctxcsn, si->si_ctxcsn, op->o_tmpmemctx ); |
|
numcsns = si->si_numcsns; |
numcsns = si->si_numcsns; |
sids = op->o_tmpalloc( numcsns * sizeof(int), op->o_tmpmemctx ); |
if ( numcsns ) { |
for ( i=0; i<numcsns; i++ ) |
ber_bvarray_dup_x( &ctxcsn, si->si_ctxcsn, op->o_tmpmemctx ); |
sids[i] = si->si_sids[i]; |
sids = op->o_tmpalloc( numcsns * sizeof(int), op->o_tmpmemctx ); |
|
for ( i=0; i<numcsns; i++ ) |
|
sids[i] = si->si_sids[i]; |
|
} else { |
|
ctxcsn = NULL; |
|
sids = NULL; |
|
} |
ldap_pvt_thread_mutex_unlock( &si->si_csn_mutex ); |
ldap_pvt_thread_mutex_unlock( &si->si_csn_mutex ); |
|
|
/* If we have a cookie, handle the PRESENT lookups */ |
/* If we have a cookie, handle the PRESENT lookups */ |
Line 2073 syncprov_op_search( Operation *op, SlapR
|
Line 2078 syncprov_op_search( Operation *op, SlapR
|
sessionlog *sl; |
sessionlog *sl; |
int i, j; |
int i, j; |
|
|
|
/* If we don't have any CSN of our own yet, pretend nothing |
|
* has changed. |
|
*/ |
|
if ( !numcsns ) |
|
goto no_change; |
|
|
/* If there are SIDs we don't recognize in the cookie, drop them */ |
/* If there are SIDs we don't recognize in the cookie, drop them */ |
for (i=0; i<srs->sr_state.numcsns; ) { |
for (i=0; i<srs->sr_state.numcsns; ) { |
for (j=0; j<numcsns; j++) { |
for (j=0; j<numcsns; j++) { |
Line 2116 syncprov_op_search( Operation *op, SlapR
|
Line 2127 syncprov_op_search( Operation *op, SlapR
|
break; |
break; |
} |
} |
if ( !changed ) { |
if ( !changed ) { |
nochange = 1; |
no_change: 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 2534 syncprov_db_open(
|
Line 2545 syncprov_db_open(
|
char csnbuf[ LDAP_LUTIL_CSNSTR_BUFSIZE ]; |
char csnbuf[ LDAP_LUTIL_CSNSTR_BUFSIZE ]; |
struct berval csn; |
struct berval csn; |
|
|
if ( SLAP_SYNC_SHADOW( op->o_bd ) && SLAP_SINGLE_SHADOW( op->o_bd )) { |
if ( SLAP_SYNC_SHADOW( op->o_bd )) { |
/* If we're also a consumer, and we're not multimaster, |
/* If we're also a consumer, then don't generate anything. |
* then don't generate anything, wait for our provider to send it |
* Wait for our provider to send it to us, or for a local |
* to us. |
* modify if we have multimaster. |
*/ |
*/ |
goto out; |
goto out; |
} |
} |