version 1.31, 2004/11/27 19:34:12
|
version 1.32, 2004/11/28 23:48:26
|
Line 131 syncprov_state_ctrl(
|
Line 131 syncprov_state_ctrl(
|
Operation *op, |
Operation *op, |
SlapReply *rs, |
SlapReply *rs, |
Entry *e, |
Entry *e, |
int entry_sync_state, |
int entry_sync_state, |
LDAPControl **ctrls, |
LDAPControl **ctrls, |
int num_ctrls, |
int num_ctrls, |
int send_cookie, |
int send_cookie, |
struct berval *cookie) |
struct berval *cookie ) |
{ |
{ |
Attribute* a; |
Attribute* a; |
int ret; |
int ret; |
Line 145 syncprov_state_ctrl(
|
Line 145 syncprov_state_ctrl(
|
BerElementBuffer berbuf; |
BerElementBuffer berbuf; |
BerElement *ber = (BerElement *)&berbuf; |
BerElement *ber = (BerElement *)&berbuf; |
|
|
struct berval entryuuid_bv = BER_BVNULL; |
struct berval entryuuid_bv = BER_BVNULL; |
|
|
ber_init2( ber, 0, LBER_USE_DER ); |
ber_init2( ber, 0, LBER_USE_DER ); |
ber_set_option( ber, LBER_OPT_BER_MEMCTX, &op->o_tmpmemctx ); |
ber_set_option( ber, LBER_OPT_BER_MEMCTX, &op->o_tmpmemctx ); |
|
|
ctrls[num_ctrls] = op->o_tmpalloc( sizeof ( LDAPControl ), op->o_tmpmemctx ); |
ctrls[num_ctrls] = op->o_tmpalloc( sizeof ( LDAPControl ), op->o_tmpmemctx ); |
|
|
for ( a = e->e_attrs; a != NULL; a = a->a_next ) { |
/* NOTE: this function is called also for referrals; |
AttributeDescription *desc = a->a_desc; |
* in this case, e is null, right? */ |
if ( desc == slap_schema.si_ad_entryUUID ) { |
if ( e ) { |
entryuuid_bv = a->a_nvals[0]; |
for ( a = e->e_attrs; a != NULL; a = a->a_next ) { |
break; |
AttributeDescription *desc = a->a_desc; |
|
if ( desc == slap_schema.si_ad_entryUUID ) { |
|
entryuuid_bv = a->a_nvals[0]; |
|
break; |
|
} |
} |
} |
} |
|
|
|
if ( send_cookie && cookie ) { |
if ( send_cookie && cookie ) { |
ber_printf( ber, "{eOON}", |
ber_printf( ber, "{eOON}", |
entry_sync_state, &entryuuid_bv, cookie ); |
entry_sync_state, &entryuuid_bv, cookie ); |
} else { |
} else { |
ber_printf( ber, "{eON}", |
ber_printf( ber, "{eON}", |
entry_sync_state, &entryuuid_bv ); |
entry_sync_state, &entryuuid_bv ); |
|
} |
} |
} |
|
|
ctrls[num_ctrls]->ldctl_oid = LDAP_CONTROL_SYNC_STATE; |
ctrls[num_ctrls]->ldctl_oid = LDAP_CONTROL_SYNC_STATE; |
Line 1258 syncprov_search_response( Operation *op,
|
Line 1262 syncprov_search_response( Operation *op,
|
|
|
if ( rs->sr_type == REP_SEARCH || rs->sr_type == REP_SEARCHREF ) { |
if ( rs->sr_type == REP_SEARCH || rs->sr_type == REP_SEARCHREF ) { |
int i; |
int i; |
if ( srs->sr_state.ctxcsn ) { |
/* FIXME: when rs->sr_type == REP_SEARCHREF, |
|
* rs->sr_entry is NULL! */ |
|
if ( srs->sr_state.ctxcsn && rs->sr_entry ) { |
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 */ |
Line 1603 syncprov_db_open(
|
Line 1609 syncprov_db_open(
|
BackendDB *be |
BackendDB *be |
) |
) |
{ |
{ |
slap_overinst *on = (slap_overinst *) be->bd_info; |
slap_overinst *on = (slap_overinst *) be->bd_info; |
syncprov_info_t *si = (syncprov_info_t *)on->on_bi.bi_private; |
syncprov_info_t *si = (syncprov_info_t *)on->on_bi.bi_private; |
|
|
char opbuf[OPERATION_BUFFER_SIZE]; |
char opbuf[OPERATION_BUFFER_SIZE]; |
Operation *op = (Operation *)opbuf; |
Operation *op = (Operation *)opbuf; |
Line 1624 syncprov_db_open(
|
Line 1630 syncprov_db_open(
|
rc = be_entry_get_rw( op, be->be_nsuffix, NULL, |
rc = be_entry_get_rw( op, be->be_nsuffix, NULL, |
slap_schema.si_ad_contextCSN, 0, &e ); |
slap_schema.si_ad_contextCSN, 0, &e ); |
|
|
|
BER_BVZERO( &si->si_ctxcsn ); |
|
|
|
/* FIXME: when rs->sr_type == REP_SEARCHREF, |
|
* rs->sr_entry == NULL! */ |
if ( e ) { |
if ( e ) { |
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 ) { |
Line 1636 syncprov_db_open(
|
Line 1646 syncprov_db_open(
|
} |
} |
be_entry_release_r( op, e ); |
be_entry_release_r( op, e ); |
} |
} |
|
|
|
if ( BER_BVISNULL( &si->si_ctxcsn ) ) { |
|
slap_get_csn( op, si->si_ctxcsnbuf, sizeof(si->si_ctxcsnbuf), |
|
&si->si_ctxcsn, 0 ); |
|
} |
|
|
op->o_bd->bd_info = (BackendInfo *)on; |
op->o_bd->bd_info = (BackendInfo *)on; |
return 0; |
return 0; |
} |
} |
|
|
/* Write the current contextCSN into the underlying db. |
/* Write the current contextCSN into the underlying db. |