result to client.
int update = op->o_bd->be_update_ndn.bv_len;
char textbuf[SLAP_TEXT_BUFLEN];
size_t textlen = sizeof textbuf;
+ slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
rs->sr_err = slap_mods_check( modlist, update, &rs->sr_text,
textbuf, textlen, NULL );
#endif /* LDAP_SLAPI */
op->ora_e = e;
- repstamp( op );
- if ( (op->o_bd->be_add)( op, rs ) == 0 ) {
#ifdef SLAPD_MULTIMASTER
- if ( !repl_user )
+ if ( !repl_user )
#endif
- {
- replog( op );
- }
+ {
+ cb.sc_next = op->o_callback;
+ op->o_callback = &cb;
+ }
+ if ( (op->o_bd->be_add)( op, rs ) == 0 ) {
be_entry_release_w( op, e );
e = NULL;
}
if ( LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo ))
#endif
{
+ slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
if ( !repl_user ) {
struct berval csn = { 0 , NULL };
slap_get_csn( op, csnbuf, sizeof(csnbuf), &csn, 1 );
}
- repstamp( op );
- if ( (op->o_bd->be_delete)( op, rs ) == 0 ) {
#ifdef SLAPD_MULTIMASTER
- if ( !op->o_bd->be_update_ndn.bv_len || !repl_user )
+ if ( !op->o_bd->be_update_ndn.bv_len || !repl_user )
#endif
- {
- replog( op );
- }
+ {
+ cb.sc_next = op->o_callback;
+ op->o_callback = &cb;
}
+ op->o_bd->be_delete( op, rs );
#ifndef SLAPD_MULTIMASTER
} else {
BerVarray defref = NULL;
int update = op->o_bd->be_update_ndn.bv_len;
char textbuf[SLAP_TEXT_BUFLEN];
size_t textlen = sizeof textbuf;
+ slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
rs->sr_err = slap_mods_check( modlist, update, &rs->sr_text,
textbuf, textlen, NULL );
}
op->orm_modlist = modlist;
- repstamp( op );
- if ( (op->o_bd->be_modify)( op, rs ) == 0
#ifdef SLAPD_MULTIMASTER
- && !repl_user
+ if ( !repl_user )
#endif
- ) {
+ {
/* but we log only the ones not from a replicator user */
- replog( op );
+ cb.sc_next = op->o_callback;
+ op->o_callback = &cb;
}
+ op->o_bd->be_modify( op, rs );
#ifndef SLAPD_MULTIMASTER
/* send a referral */
if ( LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo ))
#endif
{
+ slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
op->orr_deleteoldrdn = deloldrdn;
- repstamp( op );
- if ( (op->o_bd->be_modrdn)( op, rs ) == 0
#ifdef SLAPD_MULTIMASTER
- && ( !op->o_bd->be_update_ndn.bv_len || !repl_user )
+ if ( !op->o_bd->be_update_ndn.bv_len || !repl_user )
#endif
- ) {
- replog( op );
+ {
+ cb.sc_next = op->o_callback;
+ op->o_callback = &cb;
}
+ op->o_bd->be_modrdn( op, rs );
+
#ifndef SLAPD_MULTIMASTER
} else {
BerVarray defref = NULL;
Modifications ml, **modtail;
Operation op2;
slap_callback cb = { NULL, slap_null_cb, NULL, NULL };
+ slap_callback cb2 = { &cb, slap_replog_cb, NULL, NULL };
assert( ber_bvcmp( &slap_EXOP_MODIFY_PASSWD, &op->ore_reqoid ) == 0 );
op2 = *op;
op2.o_tag = LDAP_REQ_MODIFY;
- op2.o_callback = &cb;
+ op2.o_callback = &cb2;
op2.o_req_dn = dn;
op2.o_req_ndn = ndn;
op2.orm_modlist = &ml;
NULL, 0 );
if ( rs->sr_err == LDAP_SUCCESS ) {
- repstamp( &op2 );
rs->sr_err = op2.o_bd->be_modify( &op2, rs );
}
if ( rs->sr_err == LDAP_SUCCESS ) {
- replog( &op2 );
rs->sr_rspdata = rsp;
} else if ( rsp ) {
ber_bvfree( rsp );
return 0;
}
+int slap_replog_cb( Operation *op, SlapReply *rs )
+{
+ if ( rs->sr_err == LDAP_SUCCESS ) {
+ replog( op );
+ }
+ return SLAP_CB_CONTINUE;
+}
+
static char *v2ref( BerVarray ref, const char *text )
{
size_t len = 0, i = 0;
if ( op->o_bd->be_delete ) {
int repl_user = be_isupdate( op->o_bd, &op->o_ndn );
if ( !op->o_bd->be_update_ndn.bv_len || repl_user ) {
- if ( log_change ) repstamp( op );
- if ( (*op->o_bd->be_delete)( op, &rs ) == 0 ) {
- if ( log_change ) {
- replog( op );
- }
- } else {
+ slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
+ if ( log_change ) op->o_callback = &cb;
+ if ( (*op->o_bd->be_delete)( op, &rs ) ) {
rs.sr_err = LDAP_OTHER;
}
} else {
if ( op->o_bd->be_add ) {
int repl_user = be_isupdate( op->o_bd, &op->o_ndn );
if ( !op->o_bd->be_update_ndn.bv_len || repl_user ) {
- if ( log_changes ) repstamp( op );
+ slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
+ if ( log_changes ) op->o_callback = &cb;
if ( (*op->o_bd->be_add)( op, &rs ) == 0 ) {
- if ( log_changes ) {
- replog( op );
- }
be_entry_release_w( op, *e );
*e = NULL;
}
if ( op->o_bd->be_modrdn ) {
int repl_user = be_isupdate( op->o_bd, &op->o_ndn );
if ( !op->o_bd->be_update_ndn.bv_len || repl_user ) {
- if ( log_change ) repstamp( op );
- if ( (*op->o_bd->be_modrdn)( op, &rs ) == 0 ) {
- if ( log_change ) {
- replog( op );
- }
- } else {
+ slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
+ if ( log_change ) op->o_callback = &cb;
+ if ( (*op->o_bd->be_modrdn)( op, &rs ) ) {
rs.sr_err = LDAP_OTHER;
}
} else {
const char *text = NULL;
char textbuf[SLAP_TEXT_BUFLEN];
size_t textlen = sizeof( textbuf );
+ slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
rs.sr_err = slap_mods_check( modlist, update,
&text, textbuf, textlen, NULL );
goto cleanup;
}
}
- if ( log_change ) repstamp( op );
- if ( (*op->o_bd->be_modify)( op, &rs ) == 0 ) {
- if ( log_change ) {
- replog( op );
- }
- } else {
+ if ( log_change ) op->o_callback = &cb;
+ if ( (*op->o_bd->be_modify)( op, &rs ) ) {
rs.sr_err = LDAP_OTHER;
}
} else {
assert(0);
}
+int
+slap_replog_cb(
+ Operation *op, SlapReply *rs
+)
+{
+ assert(0);
+}
+
void
slap_send_ldap_extended(
Operation *op, SlapReply *rs
return NULL;
}
-void repstamp( Operation *op )
-{
- assert(0);
-}
-
void replog( Operation *op )
{
assert(0);