int res,
const struct berval *dn );
-#ifdef LDAP_X_TXN
static int txn = 0;
static int txnabort = 0;
struct berval *txn_id = NULL;
-#endif
void
usage( void )
fprintf( stderr, _(" -f file read operations from `file'\n"));
fprintf( stderr, _(" -M enable Manage DSA IT control (-MM to make critical)\n"));
fprintf( stderr, _(" -P version protocol version (default: 3)\n"));
-#ifdef LDAP_X_TXN
fprintf( stderr,
_(" [!]txn=<commit|abort> (transaction)\n"));
-#endif
fprintf( stderr, _(" -S file write skipped modifications to `file'\n"));
tool_common_usage();
*cvalue++ = '\0';
}
-#ifdef LDAP_X_TXN
if( strcasecmp( control, "txn" ) == 0 ) {
/* Transaction */
if( txn ) {
txn = 1 + crit;
} else
-#endif
{
fprintf( stderr, _("Invalid modify extension name: %s\n"),
control );
tool_bind( ld );
}
-#ifdef LDAP_X_TXN
if( txn ) {
/* start transaction */
rc = ldap_txn_start_s( ld, NULL, NULL, &txn_id );
txn = 0;
}
}
-#endif
- if ( 0
-#ifdef LDAP_X_TXN
- || txn
-#endif
- )
- {
-#ifdef LDAP_X_TXN
- if( txn ) {
- c[i].ldctl_oid = LDAP_CONTROL_X_TXN_SPEC;
- c[i].ldctl_value = *txn_id;
- c[i].ldctl_iscritical = 1;
- i++;
- }
-#endif
+ if( txn ) {
+ c[i].ldctl_oid = LDAP_CONTROL_TXN_SPEC;
+ c[i].ldctl_value = *txn_id;
+ c[i].ldctl_iscritical = 1;
+ i++;
}
tool_server_controls( ld, c, i );
if ( ldifrc < 0 )
retval = LDAP_OTHER;
-#ifdef LDAP_X_TXN
if( retval == 0 && txn ) {
rc = ldap_set_option( ld, LDAP_OPT_SERVER_CONTROLS, NULL );
if ( rc != LDAP_OPT_SUCCESS ) {
retval = rc;
}
}
-#endif
fail:;
if ( rejfp != NULL ) {
rc = ldap_parse_result( ld, res, &err, &matched, &text, &refs, &ctrls, 1 );
if ( rc == LDAP_SUCCESS ) rc = err;
-#ifdef LDAP_X_TXN
- if ( rc == LDAP_X_TXN_SPECIFY_OKAY ) {
+ if ( rc == LDAP_TXN_SPECIFY_OKAY ) {
rc = LDAP_SUCCESS;
- } else
-#endif
- if ( rc != LDAP_SUCCESS ) {
+ } else if ( rc != LDAP_SUCCESS ) {
tool_perror( res2str( op ), rc, NULL, matched, text, refs );
} else if ( msgtype != op ) {
fprintf( stderr, "%s: msgtype: expected %d got %d\n",
#define LDAP_URLEXT_X_FAILEDNAME "x-failedName"
#define LDAP_TXN "1.3.6.1.1.21" /* RFC 5805 */
-#define LDAP_EXOP_TXN_START LDAP_X_TXN ".1"
-#define LDAP_CONTROL_TXN_SPEC LDAP_X_TXN ".2"
-#define LDAP_EXOP_TXN_END LDAP_X_TXN ".3"
-#define LDAP_EXOP_TXN_ABORTED_NOTICE LDAP_X_TXN ".4"
-
-#define LDAP_X_TXN LDAP_TXN
-#define LDAP_EXOP_X_TXN_START LDAP_EXOP_TXN_START
-#define LDAP_CONTROL_X_TXN_SPEC LDAP_CONTROL_TXN_SPEC
-#define LDAP_EXOP_X_TXN_END LDAP_EXOP_TXN_END
-#define LDAP_EXOP_X_TXN_ABORTED_NOTICE LDAP_EXOP_TXN_ABORTED_NOTICE
+#define LDAP_EXOP_TXN_START LDAP_TXN ".1"
+#define LDAP_CONTROL_TXN_SPEC LDAP_TXN ".2"
+#define LDAP_EXOP_TXN_END LDAP_TXN ".3"
+#define LDAP_EXOP_TXN_ABORTED_NOTICE LDAP_TXN ".4"
/* LDAP Features */
#define LDAP_FEATURE_ALL_OP_ATTRS "1.3.6.1.4.1.4203.1.5.1" /* RFC 3673 */
#define LDAP_X_INVALIDREFERENCE 0x4112
#endif
-#ifdef LDAP_X_TXN
-#define LDAP_X_TXN_SPECIFY_OKAY 0x4120
-#define LDAP_X_TXN_ID_INVALID 0x4121
-#endif
+#define LDAP_TXN_SPECIFY_OKAY 0x4120
+#define LDAP_TXN_ID_INVALID 0x4121
/* API Error Codes
*
/*
* LDAP Transactions
*/
-#ifdef LDAP_X_TXN
LDAP_F( int )
ldap_txn_start LDAP_P(( LDAP *ld,
LDAPControl **sctrls,
LDAPControl **sctrl,
LDAPControl **cctrl,
int *retidp ));
-#endif
/*
* in ldap_sync.c
C(LDAP_CUP_UNSUPPORTED_SCHEME, N_("LCUP Unsupported Scheme"));
C(LDAP_CUP_RELOAD_REQUIRED, N_("LCUP Reload Required"));
-#ifdef LDAP_X_TXN
- /* Codes related to LDAP Transactions (draft-zeilenga-ldap-txn) */
- C(LDAP_X_TXN_SPECIFY_OKAY, N_("TXN specify okay"));
- C(LDAP_X_TXN_ID_INVALID, N_("TXN ID is invalid"));
-#endif
+ C(LDAP_TXN_SPECIFY_OKAY, N_("TXN specify okay"));
+ C(LDAP_TXN_ID_INVALID, N_("TXN ID is invalid"));
/* API codes - renumbered since draft-ietf-ldapext-ldap-c-api */
C(LDAP_SERVER_DOWN, N_("Can't contact LDAP server"));
#include "ldap-int.h"
#include "ldap_log.h"
-#ifdef LDAP_X_TXN
int
ldap_txn_start(
LDAP *ld,
LDAPControl **cctrls,
int *msgidp )
{
- return ldap_extended_operation( ld, LDAP_EXOP_X_TXN_START,
+ return ldap_extended_operation( ld, LDAP_EXOP_TXN_START,
NULL, sctrls, cctrls, msgidp );
}
{
assert( txnid != NULL );
- return ldap_extended_operation_s( ld, LDAP_EXOP_X_TXN_START,
+ return ldap_extended_operation_s( ld, LDAP_EXOP_TXN_START,
NULL, sctrls, cctrls, NULL, txnid );
}
ber_flatten( txnber, &txnval );
- rc = ldap_extended_operation( ld, LDAP_EXOP_X_TXN_END,
+ rc = ldap_extended_operation( ld, LDAP_EXOP_TXN_END,
txnval, sctrls, cctrls, msgidp );
ber_free( txnber, 1 );
ber_flatten( txnber, &txnval );
- rc = ldap_extended_operation_s( ld, LDAP_EXOP_X_TXN_END,
+ rc = ldap_extended_operation_s( ld, LDAP_EXOP_TXN_END,
txnval, sctrls, cctrls, NULL, &retdata );
ber_free( txnber, 1 );
return rc;
}
-#endif
}
LDAP_SLIST_REMOVE(&op->o_extra, &oex->oe, OpExtra, oe_next);
-#ifdef LDAP_X_TXN
- if ( rc == LDAP_X_TXN_SPECIFY_OKAY ) {
+ if ( rc == LDAP_TXN_SPECIFY_OKAY ) {
/* skip cleanup */
return rc;
- } else
-#endif
- if ( rc == 0 ) {
+ } else if ( rc == 0 ) {
if ( op->ora_e != NULL && oex->oe_db != NULL ) {
BackendDB *bd = op->o_bd;
Debug(LDAP_DEBUG_ARGS, "==> " LDAP_XSTRING(mdb_add) ": %s\n",
op->ora_e->e_name.bv_val );
-#ifdef LDAP_X_TXN
if( op->o_txnSpec && txn_preop( op, rs ))
return rs->sr_err;
-#endif
ctrls[num_ctrls] = 0;
Debug( LDAP_DEBUG_ARGS, "==> " LDAP_XSTRING(mdb_delete) ": %s\n",
op->o_req_dn.bv_val );
-#ifdef LDAP_X_TXN
if( op->o_txnSpec && txn_preop( op, rs ))
return rs->sr_err;
-#endif
ctrls[num_ctrls] = 0;
return 0;
}
-#ifdef LDAP_X_TXN
int mdb_txn( Operation *op, int txnop, OpExtra **ptr )
{
struct mdb_info *mdb = (struct mdb_info *) op->o_bd->be_private;
}
return LDAP_OTHER;
}
-#endif
/* Count up the sizes of the components of an entry */
static int mdb_entry_partsize(struct mdb_info *mdb, MDB_txn *txn, Entry *e,
LDAP_CONTROL_POST_READ,
LDAP_CONTROL_SUBENTRIES,
LDAP_CONTROL_X_PERMISSIVE_MODIFY,
-#ifdef LDAP_X_TXN
- LDAP_CONTROL_X_TXN_SPEC,
-#endif
+ LDAP_CONTROL_TXN_SPEC,
NULL
};
Debug( LDAP_DEBUG_ARGS, LDAP_XSTRING(mdb_modify) ": %s\n",
op->o_req_dn.bv_val );
-#ifdef LDAP_X_TXN
if( op->o_txnSpec && txn_preop( op, rs ))
return rs->sr_err;
-#endif
ctrls[num_ctrls] = NULL;
op->o_req_dn.bv_val,op->oq_modrdn.rs_newrdn.bv_val,
op->oq_modrdn.rs_newSup ? op->oq_modrdn.rs_newSup->bv_val : "NULL" );
-#ifdef LDAP_X_TXN
if( op->o_txnSpec && txn_preop( op, rs ))
return rs->sr_err;
-#endif
ctrls[num_ctrls] = NULL;
LDAP_CONTROL_POST_READ,
LDAP_CONTROL_SUBENTRIES,
LDAP_CONTROL_X_PERMISSIVE_MODIFY,
-#ifdef LDAP_X_TXN
- LDAP_CONTROL_X_TXN_SPEC,
-#endif
+ LDAP_CONTROL_TXN_SPEC,
NULL
};
Debug( LDAP_DEBUG_ARGS, "==> " LDAP_XSTRING(wt_delete) ": %s\n",
op->o_req_dn.bv_val );
-#ifdef LDAP_X_TXN
if( op->o_txnSpec && txn_preop( op, rs ))
return rs->sr_err;
-#endif
ctrls[num_ctrls] = 0;
rs->sr_text = NULL;
Debug( LDAP_DEBUG_ARGS, LDAP_XSTRING(wt_modify) ": %s\n",
op->o_req_dn.bv_val );
-#ifdef LDAP_X_TXN
if( op->o_txnSpec && txn_preop( op, rs ))
return rs->sr_err;
-#endif
ctrls[num_ctrls] = NULL;
LDAP_STAILQ_INIT(&c->c_ops);
LDAP_STAILQ_INIT(&c->c_pending_ops);
-#ifdef LDAP_X_TXN
c->c_txn = CONN_TXN_INACTIVE;
c->c_txn_backend = NULL;
LDAP_STAILQ_INIT(&c->c_txn_ops);
-#endif
BER_BVZERO( &c->c_sasl_bind_mech );
c->c_sasl_done = 0;
assert( BER_BVISNULL( &c->c_peer_name ) );
assert( LDAP_STAILQ_EMPTY(&c->c_ops) );
assert( LDAP_STAILQ_EMPTY(&c->c_pending_ops) );
-#ifdef LDAP_X_TXN
assert( c->c_txn == CONN_TXN_INACTIVE );
assert( c->c_txn_backend == NULL );
assert( LDAP_STAILQ_EMPTY(&c->c_txn_ops) );
-#endif
assert( BER_BVISNULL( &c->c_sasl_bind_mech ) );
assert( c->c_sasl_done == 0 );
assert( c->c_sasl_authctx == NULL );
assert( c->c_conn_state != SLAP_C_INVALID );
assert( LDAP_STAILQ_EMPTY(&c->c_ops) );
assert( LDAP_STAILQ_EMPTY(&c->c_pending_ops) );
-#ifdef LDAP_X_TXN
assert( c->c_txn == CONN_TXN_INACTIVE );
assert( c->c_txn_backend == NULL );
assert( LDAP_STAILQ_EMPTY(&c->c_txn_ops) );
-#endif
assert( c->c_writewaiter == 0);
assert( c->c_writers == 0);
frontendDB->be_abandon( &op, &rs );
}
-#ifdef LDAP_X_TXN
/* remove operations in pending transaction */
while ( (o = LDAP_STAILQ_FIRST( &c->c_txn_ops )) != NULL) {
LDAP_STAILQ_REMOVE_HEAD( &c->c_txn_ops, o_next );
/* clear transaction */
c->c_txn_backend = NULL;
c->c_txn = CONN_TXN_INACTIVE;
-#endif
/* remove pending operations */
while ( (o = LDAP_STAILQ_FIRST( &c->c_pending_ops )) != NULL) {
goto operations_error;
}
-#ifdef LDAP_X_TXN
if (( conn->c_txn == CONN_TXN_SPECIFY ) && (
( tag == LDAP_REQ_ADD ) ||
( tag == LDAP_REQ_DELETE ) ||
issued inside of a transaction */
op->o_tmpmemctx = NULL;
op->o_tmpmfuncs = &ch_mfuncs;
- } else
-#endif
- {
+ } else {
/* We can use Thread-Local storage for most mallocs. We can
* also use TL for ber parsing, but not on Add or Modify.
*/
ber_set_option( op->o_ber, LBER_OPT_BER_MEMCTX, &memctx_null );
-#ifdef LDAP_X_TXN
- if ( rc != LDAP_X_TXN_SPECIFY_OKAY )
-#endif
- {
+ if ( rc != LDAP_TXN_SPECIFY_OKAY ) {
LDAP_STAILQ_REMOVE( &conn->c_ops, op, Operation, o_next);
LDAP_STAILQ_NEXT(op, o_next) = NULL;
}
connection_resched( conn );
ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
-#ifdef LDAP_X_TXN
- if ( rc != LDAP_X_TXN_SPECIFY_OKAY )
-#endif
- {
+ if ( rc != LDAP_TXN_SPECIFY_OKAY ) {
slap_op_free( op, ctx );
}
return NULL;
SLAP_CTRL_GLOBAL|SLAP_CTRL_UPDATE|SLAP_CTRL_HIDE,
NULL, NULL,
parseRelax, LDAP_SLIST_ENTRY_INITIALIZER(next) },
-#ifdef LDAP_X_TXN
- { LDAP_CONTROL_X_TXN_SPEC,
+ { LDAP_CONTROL_TXN_SPEC,
(int)offsetof(struct slap_control_ids, sc_txnSpec),
SLAP_CTRL_UPDATE|SLAP_CTRL_HIDE,
NULL, NULL,
txn_spec_ctrl, LDAP_SLIST_ENTRY_INITIALIZER(next) },
-#endif
{ LDAP_CONTROL_MANAGEDSAIT,
(int)offsetof(struct slap_control_ids, sc_manageDSAit),
SLAP_CTRL_ACCESS,
return LDAP_PROTOCOL_ERROR;
}
-#ifdef LDAP_X_TXN
if ( op->o_txnSpec ) { /* temporary limitation */
rs->sr_text = READMSG( post, "cannot perform in transaction" );
return LDAP_UNWILLING_TO_PERFORM;
}
-#endif
ber = ber_init( &ctrl->ldctl_value );
if ( ber == NULL ) {
return rs->sr_err;
}
-#ifdef LDAP_X_TXN
- if( rs->sr_err == LDAP_X_TXN_SPECIFY_OKAY ) {
+ if( rs->sr_err == LDAP_TXN_SPECIFY_OKAY ) {
/* skip cleanup */
return rs->sr_err;
}
-#endif
cleanup:;
op->o_tmpfree( op->o_req_dn.bv_val, op->o_tmpmemctx );
slap_mask_t flags;
SLAP_EXTOP_MAIN_FN *ext_main;
} builtin_extops[] = {
-#ifdef LDAP_X_TXN
{ &slap_EXOP_TXN_START, 0, txn_start_extop },
{ &slap_EXOP_TXN_END, 0, txn_end_extop },
-#endif
{ &slap_EXOP_CANCEL, 0, cancel_extop },
{ &slap_EXOP_WHOAMI, 0, whoami_extop },
{ &slap_EXOP_MODIFY_PASSWD, SLAP_EXOP_WRITES, passwd_extop },
return rs->sr_err;
}
-#ifdef LDAP_X_TXN
- if( rs->sr_err == LDAP_X_TXN_SPECIFY_OKAY ) {
+ if( rs->sr_err == LDAP_TXN_SPECIFY_OKAY ) {
/* skip cleanup */
return rs->sr_err;
}
-#endif
cleanup:
op->o_tmpfree( op->o_req_dn.bv_val, op->o_tmpmemctx );
/* skip cleanup */
return rs->sr_err;
}
-#ifdef LDAP_X_TXN
- if( rs->sr_err == LDAP_X_TXN_SPECIFY_OKAY ) {
+ if( rs->sr_err == LDAP_TXN_SPECIFY_OKAY ) {
/* skip cleanup */
return rs->sr_err;
}
-#endif
cleanup:
op->o_tmpfree( op->o_req_dn.bv_val, op->o_tmpmemctx );
LDAP_SLAPD_V( const struct berval ) slap_EXOP_WHOAMI;
LDAP_SLAPD_V( const struct berval ) slap_EXOP_MODIFY_PASSWD;
LDAP_SLAPD_V( const struct berval ) slap_EXOP_START_TLS;
-#ifdef LDAP_X_TXN
LDAP_SLAPD_V( const struct berval ) slap_EXOP_TXN_START;
LDAP_SLAPD_V( const struct berval ) slap_EXOP_TXN_END;
-#endif
typedef int (SLAP_EXTOP_MAIN_FN) LDAP_P(( Operation *op, SlapReply *rs ));
/*
* txn.c
*/
-#ifdef LDAP_X_TXN
LDAP_SLAPD_F ( SLAP_CTRL_PARSE_FN ) txn_spec_ctrl;
LDAP_SLAPD_F ( SLAP_EXTOP_MAIN_FN ) txn_start_extop;
LDAP_SLAPD_F ( SLAP_EXTOP_MAIN_FN ) txn_end_extop;
LDAP_SLAPD_F ( int ) txn_preop LDAP_P(( Operation *op, SlapReply *rs ));
-#endif
/*
* cancel.c
typedef int (BI_acl_attribute) LDAP_P(( Operation *op, Entry *target,
struct berval *entry_ndn, AttributeDescription *entry_at,
BerVarray *vals, slap_access_t access ));
-#ifdef LDAP_X_TXN
struct OpExtra;
typedef int (BI_op_txn) LDAP_P(( Operation *op, int txnop, struct OpExtra **ptr ));
#define SLAP_TXN_BEGIN 1
#define SLAP_TXN_COMMIT 2
#define SLAP_TXN_ABORT 3
-#endif
typedef int (BI_conn_func) LDAP_P(( BackendDB *bd, Connection *c ));
typedef BI_conn_func BI_connection_init;
BI_operational *bi_operational;
BI_chk_referrals *bi_chk_referrals;
BI_chk_controls *bi_chk_controls;
-#ifdef LDAP_X_TXN
BI_op_txn *bi_op_txn;
-#endif
BI_entry_get_rw *bi_entry_get_rw;
BI_entry_release_rw *bi_entry_release_rw;
op_aux_operational,
op_aux_chk_referrals,
op_aux_chk_controls,
-#ifdef LDAP_X_TXN
op_txn,
-#endif
op_last
} slap_operation_t;
#ifdef SLAP_CONTROL_X_TREE_DELETE
int sc_treeDelete;
#endif
-#ifdef LDAP_X_TXN
int sc_txnSpec;
-#endif
#ifdef SLAP_CONTROL_X_SESSION_TRACKING
int sc_sessionTracking;
#endif
#define o_sortedresults o_ctrlflag[slap_cids.sc_sortedResults]
#endif
-#ifdef LDAP_X_TXN
#define o_txnSpec o_ctrlflag[slap_cids.sc_txnSpec]
-#endif
#ifdef SLAP_CONTROL_X_SESSION_TRACKING
#define o_session_tracking o_ctrlflag[slap_cids.sc_sessionTracking]
void *c_sasl_cbind; /* SASL channel binding */
Operation *c_sasl_bindop; /* set to current op if it's a bind */
-#ifdef LDAP_X_TXN
#define CONN_TXN_INACTIVE 0
#define CONN_TXN_SPECIFY 1
#define CONN_TXN_SETTLE -1
Backend *c_txn_backend;
LDAP_STAILQ_HEAD(c_to, Operation) c_txn_ops; /* list of operations in txn */
-#endif
PagedResultsState c_pagedresults_state; /* paged result state */
#include <lber_pvt.h>
#include <lutil.h>
-#ifdef LDAP_X_TXN
-const struct berval slap_EXOP_TXN_START = BER_BVC(LDAP_EXOP_X_TXN_START);
-const struct berval slap_EXOP_TXN_END = BER_BVC(LDAP_EXOP_X_TXN_END);
+const struct berval slap_EXOP_TXN_START = BER_BVC(LDAP_EXOP_TXN_START);
+const struct berval slap_EXOP_TXN_END = BER_BVC(LDAP_EXOP_TXN_END);
int txn_start_extop(
Operation *op, SlapReply *rs )
}
if ( ctrl->ldctl_value.bv_len != 0 ) {
rs->sr_text = "invalid transaction identifier";
- return LDAP_X_TXN_ID_INVALID;
+ return LDAP_TXN_ID_INVALID;
}
if ( op->o_preread ) { /* temporary limitation */
if( txnid.bv_len ) {
rs->sr_text = "invalid transaction identifier";
- return LDAP_X_TXN_ID_INVALID;
+ return LDAP_TXN_ID_INVALID;
}
/* acquire connection lock */
if( c->c_txn != CONN_TXN_SPECIFY ) {
rs->sr_text = "invalid transaction identifier";
- rc = LDAP_X_TXN_ID_INVALID;
+ rc = LDAP_TXN_ID_INVALID;
goto done;
}
c->c_txn = CONN_TXN_SETTLE;
ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
if( op->o_conn->c_txn == CONN_TXN_INACTIVE ) {
rs->sr_text = "invalid transaction identifier";
- rs->sr_err = LDAP_X_TXN_ID_INVALID;
+ rs->sr_err = LDAP_TXN_ID_INVALID;
goto txnReturn;
} else if( op->o_conn->c_txn == CONN_TXN_SETTLE ) {
settle=1;
if( !settle ) {
send_ldap_result( op, rs );
if ( !rs->sr_err )
- rs->sr_err = LDAP_X_TXN_SPECIFY_OKAY;
+ rs->sr_err = LDAP_TXN_SPECIFY_OKAY;
return rs->sr_err;
}
return LDAP_SUCCESS; /* proceed with operation */
}
-
-#endif /* LDAP_X_TXN */