summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/dsdb/repl/drepl_notify.c25
-rw-r--r--source4/dsdb/repl/drepl_out_helpers.c74
-rw-r--r--source4/dsdb/repl/drepl_service.h1
3 files changed, 62 insertions, 38 deletions
diff --git a/source4/dsdb/repl/drepl_notify.c b/source4/dsdb/repl/drepl_notify.c
index 5047da3307..7ae4af724f 100644
--- a/source4/dsdb/repl/drepl_notify.c
+++ b/source4/dsdb/repl/drepl_notify.c
@@ -38,6 +38,7 @@
struct dreplsrv_op_notify_state {
+ struct tevent_context *ev;
struct dreplsrv_notify_operation *op;
void *ndr_struct_ptr;
};
@@ -60,6 +61,7 @@ static struct tevent_req *dreplsrv_op_notify_send(TALLOC_CTX *mem_ctx,
if (req == NULL) {
return NULL;
}
+ state->ev = ev;
state->op = op;
subreq = dreplsrv_out_drsuapi_send(state,
@@ -90,7 +92,7 @@ static void dreplsrv_op_notify_connect_done(struct tevent_req *subreq)
dreplsrv_op_notify_replica_sync_trigger(req);
}
-static void dreplsrv_op_notify_replica_sync_done(struct rpc_request *rreq);
+static void dreplsrv_op_notify_replica_sync_done(struct tevent_req *subreq);
static void dreplsrv_op_notify_replica_sync_trigger(struct tevent_req *req)
{
@@ -99,8 +101,8 @@ static void dreplsrv_op_notify_replica_sync_trigger(struct tevent_req *req)
struct dreplsrv_op_notify_state);
struct dreplsrv_partition *partition = state->op->source_dsa->partition;
struct dreplsrv_drsuapi_connection *drsuapi = state->op->source_dsa->conn->drsuapi;
- struct rpc_request *rreq;
struct drsuapi_DsReplicaSync *r;
+ struct tevent_req *subreq;
r = talloc_zero(state, struct drsuapi_DsReplicaSync);
if (tevent_req_nomem(r, req)) {
@@ -125,17 +127,21 @@ static void dreplsrv_op_notify_replica_sync_trigger(struct tevent_req *req)
state->ndr_struct_ptr = r;
- rreq = dcerpc_drsuapi_DsReplicaSync_send(drsuapi->pipe, r, r);
- if (tevent_req_nomem(rreq, req)) {
+ subreq = dcerpc_drsuapi_DsReplicaSync_r_send(state,
+ state->ev,
+ drsuapi->drsuapi_handle,
+ r);
+ if (tevent_req_nomem(subreq, req)) {
return;
}
- composite_continue_rpc(NULL, rreq, dreplsrv_op_notify_replica_sync_done, req);
+ tevent_req_set_callback(subreq, dreplsrv_op_notify_replica_sync_done, req);
}
-static void dreplsrv_op_notify_replica_sync_done(struct rpc_request *rreq)
+static void dreplsrv_op_notify_replica_sync_done(struct tevent_req *subreq)
{
- struct tevent_req *req = talloc_get_type(rreq->async.private_data,
- struct tevent_req);
+ struct tevent_req *req =
+ tevent_req_callback_data(subreq,
+ struct tevent_req);
struct dreplsrv_op_notify_state *state =
tevent_req_data(req,
struct dreplsrv_op_notify_state);
@@ -145,7 +151,8 @@ static void dreplsrv_op_notify_replica_sync_done(struct rpc_request *rreq)
state->ndr_struct_ptr = NULL;
- status = dcerpc_drsuapi_DsReplicaSync_recv(rreq);
+ status = dcerpc_drsuapi_DsReplicaSync_r_recv(subreq, r);
+ TALLOC_FREE(subreq);
if (tevent_req_nterror(req, status)) {
return;
}
diff --git a/source4/dsdb/repl/drepl_out_helpers.c b/source4/dsdb/repl/drepl_out_helpers.c
index a8a3f80fa6..a12481b897 100644
--- a/source4/dsdb/repl/drepl_out_helpers.c
+++ b/source4/dsdb/repl/drepl_out_helpers.c
@@ -37,6 +37,8 @@
#include "../lib/util/tevent_ntstatus.h"
struct dreplsrv_out_drsuapi_state {
+ struct tevent_context *ev;
+
struct dreplsrv_out_connection *conn;
struct dreplsrv_drsuapi_connection *drsuapi;
@@ -61,6 +63,7 @@ struct tevent_req *dreplsrv_out_drsuapi_send(TALLOC_CTX *mem_ctx,
return NULL;
}
+ state->ev = ev;
state->conn = conn;
state->drsuapi = conn->drsuapi;
@@ -90,7 +93,7 @@ struct tevent_req *dreplsrv_out_drsuapi_send(TALLOC_CTX *mem_ctx,
return req;
}
-static void dreplsrv_out_drsuapi_bind_done(struct rpc_request *rreq);
+static void dreplsrv_out_drsuapi_bind_done(struct tevent_req *subreq);
static void dreplsrv_out_drsuapi_connect_done(struct composite_context *creq)
{
@@ -99,7 +102,7 @@ static void dreplsrv_out_drsuapi_connect_done(struct composite_context *creq)
struct dreplsrv_out_drsuapi_state *state = tevent_req_data(req,
struct dreplsrv_out_drsuapi_state);
NTSTATUS status;
- struct rpc_request *rreq;
+ struct tevent_req *subreq;
status = dcerpc_pipe_connect_b_recv(creq,
state->drsuapi,
@@ -108,6 +111,8 @@ static void dreplsrv_out_drsuapi_connect_done(struct composite_context *creq)
return;
}
+ state->drsuapi->drsuapi_handle = state->drsuapi->pipe->binding_handle;
+
status = gensec_session_key(state->drsuapi->pipe->conn->security_state.generic_state,
&state->drsuapi->gensec_skey);
if (tevent_req_nterror(req, status)) {
@@ -121,24 +126,26 @@ static void dreplsrv_out_drsuapi_connect_done(struct composite_context *creq)
state->bind_r.in.bind_info = &state->bind_info_ctr;
state->bind_r.out.bind_handle = &state->drsuapi->bind_handle;
- rreq = dcerpc_drsuapi_DsBind_send(state->drsuapi->pipe,
- state,
- &state->bind_r);
- if (tevent_req_nomem(rreq, req)) {
+ subreq = dcerpc_drsuapi_DsBind_r_send(state,
+ state->ev,
+ state->drsuapi->drsuapi_handle,
+ &state->bind_r);
+ if (tevent_req_nomem(subreq, req)) {
return;
}
- composite_continue_rpc(NULL, rreq, dreplsrv_out_drsuapi_bind_done, req);
+ tevent_req_set_callback(subreq, dreplsrv_out_drsuapi_bind_done, req);
}
-static void dreplsrv_out_drsuapi_bind_done(struct rpc_request *rreq)
+static void dreplsrv_out_drsuapi_bind_done(struct tevent_req *subreq)
{
- struct tevent_req *req = talloc_get_type(rreq->async.private_data,
- struct tevent_req);
+ struct tevent_req *req = tevent_req_callback_data(subreq,
+ struct tevent_req);
struct dreplsrv_out_drsuapi_state *state = tevent_req_data(req,
struct dreplsrv_out_drsuapi_state);
NTSTATUS status;
- status = dcerpc_drsuapi_DsBind_recv(rreq);
+ status = dcerpc_drsuapi_DsBind_r_recv(subreq, state);
+ TALLOC_FREE(subreq);
if (tevent_req_nterror(req, status)) {
return;
}
@@ -202,6 +209,7 @@ NTSTATUS dreplsrv_out_drsuapi_recv(struct tevent_req *req)
}
struct dreplsrv_op_pull_source_state {
+ struct tevent_context *ev;
struct dreplsrv_out_operation *op;
void *ndr_struct_ptr;
};
@@ -221,7 +229,7 @@ struct tevent_req *dreplsrv_op_pull_source_send(TALLOC_CTX *mem_ctx,
if (req == NULL) {
return NULL;
}
-
+ state->ev = ev;
state->op = op;
subreq = dreplsrv_out_drsuapi_send(state, ev, op->source_dsa->conn);
@@ -250,7 +258,7 @@ static void dreplsrv_op_pull_source_connect_done(struct tevent_req *subreq)
dreplsrv_op_pull_source_get_changes_trigger(req);
}
-static void dreplsrv_op_pull_source_get_changes_done(struct rpc_request *rreq);
+static void dreplsrv_op_pull_source_get_changes_done(struct tevent_req *subreq);
static void dreplsrv_op_pull_source_get_changes_trigger(struct tevent_req *req)
{
@@ -260,9 +268,9 @@ static void dreplsrv_op_pull_source_get_changes_trigger(struct tevent_req *req)
struct dreplsrv_service *service = state->op->service;
struct dreplsrv_partition *partition = state->op->source_dsa->partition;
struct dreplsrv_drsuapi_connection *drsuapi = state->op->source_dsa->conn->drsuapi;
- struct rpc_request *rreq;
struct drsuapi_DsGetNCChanges *r;
struct drsuapi_DsReplicaCursorCtrEx *uptodateness_vector;
+ struct tevent_req *subreq;
r = talloc(state, struct drsuapi_DsGetNCChanges);
if (tevent_req_nomem(r, req)) {
@@ -324,11 +332,14 @@ static void dreplsrv_op_pull_source_get_changes_trigger(struct tevent_req *req)
#endif
state->ndr_struct_ptr = r;
- rreq = dcerpc_drsuapi_DsGetNCChanges_send(drsuapi->pipe, r, r);
- if (tevent_req_nomem(rreq, req)) {
+ subreq = dcerpc_drsuapi_DsGetNCChanges_r_send(state,
+ state->ev,
+ drsuapi->drsuapi_handle,
+ r);
+ if (tevent_req_nomem(subreq, req)) {
return;
}
- composite_continue_rpc(NULL, rreq, dreplsrv_op_pull_source_get_changes_done, req);
+ tevent_req_set_callback(subreq, dreplsrv_op_pull_source_get_changes_done, req);
}
static void dreplsrv_op_pull_source_apply_changes_trigger(struct tevent_req *req,
@@ -337,10 +348,10 @@ static void dreplsrv_op_pull_source_apply_changes_trigger(struct tevent_req *req
struct drsuapi_DsGetNCChangesCtr1 *ctr1,
struct drsuapi_DsGetNCChangesCtr6 *ctr6);
-static void dreplsrv_op_pull_source_get_changes_done(struct rpc_request *rreq)
+static void dreplsrv_op_pull_source_get_changes_done(struct tevent_req *subreq)
{
- struct tevent_req *req = talloc_get_type(rreq->async.private_data,
- struct tevent_req);
+ struct tevent_req *req = tevent_req_callback_data(subreq,
+ struct tevent_req);
struct dreplsrv_op_pull_source_state *state = tevent_req_data(req,
struct dreplsrv_op_pull_source_state);
NTSTATUS status;
@@ -352,7 +363,8 @@ static void dreplsrv_op_pull_source_get_changes_done(struct rpc_request *rreq)
state->ndr_struct_ptr = NULL;
- status = dcerpc_drsuapi_DsGetNCChanges_recv(rreq);
+ status = dcerpc_drsuapi_DsGetNCChanges_r_recv(subreq, r);
+ TALLOC_FREE(subreq);
if (tevent_req_nterror(req, status)) {
return;
}
@@ -514,7 +526,7 @@ static void dreplsrv_op_pull_source_apply_changes_trigger(struct tevent_req *req
dreplsrv_update_refs_trigger(req);
}
-static void dreplsrv_update_refs_done(struct rpc_request *rreq);
+static void dreplsrv_update_refs_done(struct tevent_req *subreq);
/*
send a UpdateRefs request to refresh our repsTo record on the server
@@ -526,10 +538,10 @@ static void dreplsrv_update_refs_trigger(struct tevent_req *req)
struct dreplsrv_service *service = state->op->service;
struct dreplsrv_partition *partition = state->op->source_dsa->partition;
struct dreplsrv_drsuapi_connection *drsuapi = state->op->source_dsa->conn->drsuapi;
- struct rpc_request *rreq;
struct drsuapi_DsReplicaUpdateRefs *r;
char *ntds_guid_str;
char *ntds_dns_name;
+ struct tevent_req *subreq;
r = talloc(state, struct drsuapi_DsReplicaUpdateRefs);
if (tevent_req_nomem(r, req)) {
@@ -559,19 +571,22 @@ static void dreplsrv_update_refs_trigger(struct tevent_req *req)
}
state->ndr_struct_ptr = r;
- rreq = dcerpc_drsuapi_DsReplicaUpdateRefs_send(drsuapi->pipe, r, r);
- if (tevent_req_nomem(rreq, req)) {
+ subreq = dcerpc_drsuapi_DsReplicaUpdateRefs_r_send(state,
+ state->ev,
+ drsuapi->drsuapi_handle,
+ r);
+ if (tevent_req_nomem(subreq, req)) {
return;
}
- composite_continue_rpc(NULL, rreq, dreplsrv_update_refs_done, req);
+ tevent_req_set_callback(subreq, dreplsrv_update_refs_done, req);
}
/*
receive a UpdateRefs reply
*/
-static void dreplsrv_update_refs_done(struct rpc_request *rreq)
+static void dreplsrv_update_refs_done(struct tevent_req *subreq)
{
- struct tevent_req *req = talloc_get_type(rreq->async.private_data,
+ struct tevent_req *req = tevent_req_callback_data(subreq,
struct tevent_req);
struct dreplsrv_op_pull_source_state *state = tevent_req_data(req,
struct dreplsrv_op_pull_source_state);
@@ -581,7 +596,8 @@ static void dreplsrv_update_refs_done(struct rpc_request *rreq)
state->ndr_struct_ptr = NULL;
- status = dcerpc_drsuapi_DsReplicaUpdateRefs_recv(rreq);
+ status = dcerpc_drsuapi_DsReplicaUpdateRefs_r_recv(subreq, r);
+ TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("UpdateRefs failed with %s\n",
nt_errstr(status)));
diff --git a/source4/dsdb/repl/drepl_service.h b/source4/dsdb/repl/drepl_service.h
index b9ee5aed5d..7813f92cbe 100644
--- a/source4/dsdb/repl/drepl_service.h
+++ b/source4/dsdb/repl/drepl_service.h
@@ -33,6 +33,7 @@ struct dreplsrv_drsuapi_connection {
* for a valid connection
*/
struct dcerpc_pipe *pipe;
+ struct dcerpc_binding_handle *drsuapi_handle;
DATA_BLOB gensec_skey;
struct drsuapi_DsBindInfo28 remote_info28;