p.cookie = cookie;
+ op2.o_hdr = cp->op->o_hdr;
op2.o_tag = LDAP_REQ_SEARCH;
- op2.o_protocol = LDAP_VERSION3;
op2.o_ndn = op2.o_bd->be_rootndn;
op2.o_callback = &cb;
op2.o_time = slap_get_time();
op2.o_do_not_cache = 1;
op2.o_is_auth_check = 0;
- op2.o_threadctx = cp->op->o_threadctx;
- op2.o_tmpmemctx = cp->op->o_tmpmemctx;
- op2.o_tmpmfuncs = cp->op->o_tmpmfuncs;
-#ifdef LDAP_SLAPI
- op2.o_pb = cp->op->o_pb;
-#endif
- op2.o_conn = cp->op->o_conn;
- op2.o_connid = cp->op->o_connid;
ber_dupbv_x( &op2.o_req_dn, &op2.o_req_ndn, cp->op->o_tmpmemctx );
op2.ors_slimit = SLAP_NO_LIMIT;
op2.ors_tlimit = SLAP_NO_LIMIT;
{
Connection conn = { 0 };
Operation op = { 0 };
+ Opheader ohdr = { 0 };
SlapReply rs = { 0 };
slap_callback cb = { NULL, monitor_filter2ndn_cb, NULL, NULL };
AttributeName anlist[ 2 ];
return -1;
}
- connection_fake_init( &conn, &op, &conn );
+ connection_fake_init( &conn, &op, &ohdr, &conn );
op.o_tag = LDAP_REQ_SEARCH;
connection_fake_init(
Connection *conn,
Operation *op,
+ Opheader *ohdr,
void *ctx )
{
conn->c_connid = -1;
conn->c_peer_domain = slap_empty_bv;
conn->c_peer_name = slap_empty_bv;
+ op->o_hdr = ohdr;
/* set memory context */
op->o_tmpmemctx = slap_sl_mem_create(SLAP_SLAB_SIZE, SLAP_SLAB_STACK, ctx);
op->o_tmpmfuncs = &slap_sl_mfuncs;
filter_free( Filter *f )
{
Operation op;
+ Opheader ohdr;
+ op.o_hdr = &ohdr;
op.o_tmpmemctx = slap_sl_context( f );
op.o_tmpmfuncs = &slap_sl_mfuncs;
filter_free_x( &op, f );
filter2bv( Filter *f, struct berval *fstr )
{
Operation op;
+ Opheader ohdr;
+
+ op.o_hdr = &ohdr;
op.o_tmpmemctx = NULL;
op.o_tmpmfuncs = &ch_mfuncs;
while ( (o = LDAP_STAILQ_FIRST( &slap_free_ops )) != NULL) {
LDAP_STAILQ_REMOVE_HEAD( &slap_free_ops, o_next );
LDAP_STAILQ_NEXT(o, o_next) = NULL;
- ch_free( o->o_controls );
ch_free( o );
}
ldap_pvt_thread_mutex_destroy( &slap_op_mutex );
slap_op_free( Operation *op )
{
struct berval slap_empty_bv_dup;
- void **controls;
assert( LDAP_STAILQ_NEXT(op, o_next) == NULL );
#endif /* defined( LDAP_SLAPI ) */
- controls = op->o_controls;
- memset( controls, 0, sizeof(void *) * SLAP_MAX_CIDS );
- memset( op, 0, sizeof(Operation) );
- op->o_controls = controls;
+ memset( op, 0, sizeof(Operation) + sizeof(Opheader) + SLAP_MAX_CIDS * sizeof(void *) );
+ op->o_hdr = (Opheader *)(op+1);
+ op->o_controls = (void **)(op->o_hdr+1);
#if 0
slap_sync_cookie_free( &op->o_sync_state, 0 );
ldap_pvt_thread_mutex_unlock( &slap_op_mutex );
if (!op) {
- op = (Operation *) ch_calloc( 1, sizeof(Operation) );
- op->o_controls = (void **) ch_calloc( SLAP_MAX_CIDS, sizeof( void *));
+ op = (Operation *) ch_calloc( 1, sizeof(Operation)
+ + sizeof(Opheader) + SLAP_MAX_CIDS * sizeof(void *) );
+ op->o_hdr = (Opheader *)(op + 1);
+ op->o_controls = (void **)(op->o_hdr+1);
}
op->o_ber = ber;
cache_manager *cm = on->on_bi.bi_private;
query_manager *qm = cm->qm;
Operation op = {0};
+ Opheader ohdr = {0};
Connection conn = {0};
SlapReply rs = {REP_RESULT};
int i, return_val, pause = 1;
QueryTemplate* templ;
- connection_fake_init( &conn, &op, ctx );
+ connection_fake_init( &conn, &op, &ohdr, ctx );
op.o_bd = &cm->db;
op.o_dn = cm->db.be_rootdn;
#include "portable.h"
-#define SLAPD_OVER_SYNCPROV SLAPD_MOD_DYNAMIC
-
#ifdef SLAPD_OVER_SYNCPROV
#include <ac/string.h>
Entry e_uuid = {0};
Attribute a_uuid = {0};
Operation sop = *so->s_op;
+ Opheader ohdr;
syncrepl_state *srs = sop.o_controls[sync_cid];
+ ohdr = *sop.o_hdr;
+ sop.o_hdr = &ohdr;
sop.o_tmpmemctx = op->o_tmpmemctx;
ctrls[1] = NULL;
Filter *fand, *fava;
syncops *sop = NULL;
searchstate *ss;
- syncrepl_state *srs = op->o_controls[sync_cid];
+ syncrepl_state *srs;
if ( !(op->o_sync_mode & SLAP_SYNC_REFRESH) ) return SLAP_CB_CONTINUE;
return rs->sr_err;
}
+ srs = op->o_controls[sync_cid];
+
/* If this is a persistent search, set it up right away */
if ( op->o_sync_mode & SLAP_SYNC_PERSIST ) {
syncops so;
rs->sr_err = LDAP_OTHER;
} else {
- op2 = *op;
+ op2.o_hdr = op->o_hdr;
op2.o_tag = LDAP_REQ_MODIFY;
op2.o_callback = &cb2;
op2.orm_modlist = qpw->rs_mods;
LDAP_SLAPD_F (void) connection_fake_init LDAP_P((
Connection *conn,
Operation *op,
+ Opheader *ohdr,
void *threadctx ));
LDAP_SLAPD_F (void) connection_assign_nextid LDAP_P((Connection *));
if ( op.o_bd && op.o_bd->be_search ) {
SlapReply rs = {REP_RESULT};
+ op.o_hdr = conn->c_sasl_bindop->o_hdr;
op.o_tag = LDAP_REQ_SEARCH;
- op.o_protocol = LDAP_VERSION3;
op.o_ndn = conn->c_ndn;
op.o_callback = &cb;
op.o_time = slap_get_time();
op.o_do_not_cache = 1;
op.o_is_auth_check = 1;
- op.o_threadctx = conn->c_sasl_bindop->o_threadctx;
- op.o_tmpmemctx = conn->c_sasl_bindop->o_tmpmemctx;
- op.o_tmpmfuncs = conn->c_sasl_bindop->o_tmpmfuncs;
- op.o_conn = conn;
- op.o_connid = conn->c_connid;
op.o_req_dn = op.o_req_ndn;
op.ors_scope = LDAP_SCOPE_BASE;
op.ors_deref = LDAP_DEREF_NEVER;
}
if ( rc == LDAP_SUCCESS ) {
+ op.o_hdr = conn->c_sasl_bindop->o_hdr;
op.o_tag = LDAP_REQ_MODIFY;
- op.o_protocol = LDAP_VERSION3;
op.o_ndn = op.o_req_ndn;
op.o_callback = &cb;
op.o_time = slap_get_time();
op.o_do_not_cache = 1;
op.o_is_auth_check = 1;
- op.o_threadctx = conn->c_sasl_bindop->o_threadctx;
- op.o_tmpmemctx = conn->c_sasl_bindop->o_tmpmemctx;
- op.o_tmpmfuncs = conn->c_sasl_bindop->o_tmpmfuncs;
- op.o_conn = conn;
- op.o_connid = conn->c_connid;
op.o_req_dn = op.o_req_ndn;
op.orm_modlist = modlist;
goto CONCLUDED;
}
+ op.o_hdr = opx->o_hdr;
op.o_tag = LDAP_REQ_SEARCH;
- op.o_protocol = LDAP_VERSION3;
op.o_ndn = *authc;
op.o_callback = &cb;
op.o_time = slap_get_time();
op.o_do_not_cache = 1;
op.o_is_auth_check = 1;
- op.o_threadctx = opx->o_threadctx;
- op.o_tmpmemctx = opx->o_tmpmemctx;
- op.o_tmpmfuncs = opx->o_tmpmfuncs;
-#ifdef LDAP_SLAPI
- op.o_pb = opx->o_pb;
-#endif
- op.o_conn = opx->o_conn;
- op.o_connid = opx->o_connid;
/* use req_ndn as req_dn instead of non-pretty base of uri */
if( !BER_BVISNULL( &base ) ) {
ch_free( base.bv_val );
goto FINISHED;
}
- op.o_conn = opx->o_conn;
- op.o_connid = opx->o_connid;
+ op.o_hdr = opx->o_hdr;
op.o_tag = LDAP_REQ_SEARCH;
- op.o_protocol = LDAP_VERSION3;
op.o_ndn = opx->o_conn->c_ndn;
op.o_callback = &cb;
op.o_time = slap_get_time();
op.o_do_not_cache = 1;
op.o_is_auth_check = 1;
- op.o_threadctx = opx->o_threadctx;
- op.o_tmpmemctx = opx->o_tmpmemctx;
- op.o_tmpmfuncs = opx->o_tmpmfuncs;
-#ifdef LDAP_SLAPI
- op.o_pb = opx->o_pb;
-#endif
op.ors_deref = LDAP_DEREF_NEVER;
op.ors_slimit = 1;
op.ors_tlimit = SLAP_NO_LIMIT;
/*
* represents an operation pending from an ldap client
*/
+typedef struct slap_op_header {
+ unsigned long oh_opid; /* id of this operation */
+ unsigned long oh_connid; /* id of conn initiating this op */
+ struct slap_conn *oh_conn; /* connection spawning this op */
+
+ ber_int_t oh_msgid; /* msgid of the request */
+ ber_int_t oh_protocol; /* version of the LDAP protocol used by client */
+
+ ldap_pvt_thread_t oh_tid; /* thread handling this op */
+
+ void *oh_threadctx; /* thread pool thread context */
+ void *oh_tmpmemctx; /* slab malloc context */
+ BerMemoryFunctions *oh_tmpmfuncs;
+
+ char oh_log_prefix[sizeof("conn=18446744073709551615 op=18446744073709551615")];
+
+#ifdef LDAP_SLAPI
+ void *oh_pb; /* NS-SLAPI plugin */
+ void *oh_extensions; /* NS-SLAPI plugin */
+#endif
+} Opheader;
+
typedef struct slap_op {
- unsigned long o_opid; /* id of this operation */
- unsigned long o_connid; /* id of conn initiating this op */
- char o_log_prefix[sizeof("conn=18446744073709551615 op=18446744073709551615")];
- struct slap_conn *o_conn; /* connection spawning this op */
- BackendDB *o_bd; /* backend DB processing this op */
+ Opheader *o_hdr;
+
+#define o_opid o_hdr->oh_opid
+#define o_connid o_hdr->oh_connid
+#define o_conn o_hdr->oh_conn
+#define o_msgid o_hdr->oh_msgid
+#define o_protocol o_hdr->oh_protocol
+#define o_tid o_hdr->oh_tid
+#define o_threadctx o_hdr->oh_threadctx
+#define o_tmpmemctx o_hdr->oh_tmpmemctx
+#define o_tmpmfuncs o_hdr->oh_tmpmfuncs
+
+#define o_tmpalloc o_tmpmfuncs->bmf_malloc
+#define o_tmpcalloc o_tmpmfuncs->bmf_calloc
+#define o_tmprealloc o_tmpmfuncs->bmf_realloc
+#define o_tmpfree o_tmpmfuncs->bmf_free
+
+#define o_log_prefix o_hdr->oh_log_prefix
+
+#ifdef LDAP_SLAPI
+#define o_pb o_hdr->oh_pb
+#define o_extensions o_hdr->oh_extensions
+#endif
- ber_int_t o_msgid; /* msgid of the request */
- ber_int_t o_protocol; /* version of the LDAP protocol used by client */
ber_tag_t o_tag; /* tag of the request */
time_t o_time; /* time op was initiated */
+ BackendDB *o_bd; /* backend DB processing this op */
struct berval o_req_dn; /* DN of target of request */
struct berval o_req_ndn;
#define ore_reqoid oq_extended.rs_reqoid
#define ore_flags oq_extended.rs_flags
#define ore_reqdata oq_extended.rs_reqdata
-
- ldap_pvt_thread_t o_tid; /* thread handling this op */
-
volatile sig_atomic_t o_abandon; /* abandon flag */
volatile sig_atomic_t o_cancel; /* cancel flag */
#define SLAP_CANCEL_NONE 0x00
slap_callback *o_callback; /* callback pointers */
LDAPControl **o_ctrls; /* controls */
- void *o_threadctx; /* thread pool thread context */
- void *o_tmpmemctx; /* slab malloc context */
- BerMemoryFunctions *o_tmpmfuncs;
-#define o_tmpalloc o_tmpmfuncs->bmf_malloc
-#define o_tmpcalloc o_tmpmfuncs->bmf_calloc
-#define o_tmprealloc o_tmpmfuncs->bmf_realloc
-#define o_tmpfree o_tmpmfuncs->bmf_free
void *o_private; /* anything the backend needs */
LDAP_STAILQ_ENTRY(slap_op) o_next; /* next operation in list */
-
int o_nocaching;
int o_delete_glue_parent;
-#ifdef LDAP_SLAPI
- void *o_pb; /* NS-SLAPI plugin */
- void *o_extensions; /* NS-SLAPI plugin */
-#endif
-
} Operation;
#define send_ldap_error( op, rs, err, text ) do { \
{
int rc = EXIT_SUCCESS;
const char *progname = "slapacl";
- Connection conn;
- Operation op;
+ Connection conn = {0};
+ Operation op = {0};
+ Opheader ohdr = {0};
Entry e = { 0 };
char *attr = NULL;
argv = &argv[ optind ];
argc -= optind;
- memset( &conn, 0, sizeof( Connection ) );
- memset( &op, 0, sizeof( Operation ) );
-
- connection_fake_init( &conn, &op, &conn );
+ connection_fake_init( &conn, &op, &ohdr, &conn );
if ( !BER_BVISNULL( &authcID ) ) {
rc = slap_sasl_getdn( &conn, &op, &authcID, NULL,
{
int rc = EXIT_SUCCESS;
const char *progname = "slapauth";
- Connection conn;
- Operation op;
+ Connection conn = {0};
+ Operation op = {0};
+ Opheader ohdr = {0};
slap_tool_init( progname, SLAPAUTH, argc, argv );
argv = &argv[ optind ];
argc -= optind;
- memset( &conn, 0, sizeof( Connection ) );
- memset( &op, 0, sizeof( Operation ) );
-
- connection_fake_init( &conn, &op, &conn );
+ connection_fake_init( &conn, &op, &ohdr, &conn );
if ( !BER_BVISNULL( &authzID ) ) {
struct berval authzdn;
syncinfo_t *si = ( syncinfo_t * ) rtask->arg;
Connection conn = {0};
Operation op = {0};
+ Opheader ohdr = {0};
int rc = LDAP_SUCCESS;
int first = 0;
int dostop = 0;
return NULL;
}
- connection_fake_init( &conn, &op, ctx );
+ connection_fake_init( &conn, &op, &ohdr, ctx );
/* use global malloc for now */
op.o_tmpmemctx = NULL;