summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-09-03 11:34:17 +0200
committerStefan Metzmacher <metze@samba.org>2010-09-03 17:00:19 +0200
commitff0362fc3567ec2dab902c685f7715a6070a63e3 (patch)
tree99f6d986b26521838d1188eb51a44efd43fa863b
parent3c4150522cc85fd5774ca3346ff11f9d481bca7a (diff)
downloadsamba-ff0362fc3567ec2dab902c685f7715a6070a63e3.tar.gz
samba-ff0362fc3567ec2dab902c685f7715a6070a63e3.tar.bz2
samba-ff0362fc3567ec2dab902c685f7715a6070a63e3.zip
s4:dsdb/kcc: use irpc_binding_handle_by_name()
metze
-rw-r--r--source4/dsdb/kcc/kcc_periodic.c45
-rw-r--r--source4/dsdb/wscript_build2
2 files changed, 40 insertions, 7 deletions
diff --git a/source4/dsdb/kcc/kcc_periodic.c b/source4/dsdb/kcc/kcc_periodic.c
index 0955c99354..28ff404748 100644
--- a/source4/dsdb/kcc/kcc_periodic.c
+++ b/source4/dsdb/kcc/kcc_periodic.c
@@ -33,7 +33,7 @@
#include "librpc/gen_ndr/ndr_misc.h"
#include "librpc/gen_ndr/ndr_drsuapi.h"
#include "librpc/gen_ndr/ndr_drsblobs.h"
-#include "librpc/gen_ndr/ndr_irpc.h"
+#include "librpc/gen_ndr/ndr_irpc_c.h"
#include "param/param.h"
/*
@@ -97,6 +97,11 @@ static bool check_MasterNC(struct kccsrv_partition *p, struct repsFromToBlob *r,
return false;
}
+struct kccsrv_notify_drepl_server_state {
+ struct dreplsrv_refresh r;
+};
+
+static void kccsrv_notify_drepl_server_done(struct tevent_req *subreq);
/**
* Force dreplsrv to update its state as topology is changed
@@ -104,16 +109,44 @@ static bool check_MasterNC(struct kccsrv_partition *p, struct repsFromToBlob *r,
static void kccsrv_notify_drepl_server(struct kccsrv_service *s,
TALLOC_CTX *mem_ctx)
{
- struct dreplsrv_refresh r;
- struct server_id *drepl_srv;
+ struct kccsrv_notify_drepl_server_state *state;
+ struct dcerpc_binding_handle *irpc_handle;
+ struct tevent_req *subreq;
- drepl_srv = irpc_servers_byname(s->task->msg_ctx, mem_ctx, "dreplsrv");
- if (!drepl_srv) {
+ state = talloc_zero(mem_ctx, struct kccsrv_notify_drepl_server_state);
+ if (state == NULL) {
+ return;
+ }
+
+ irpc_handle = irpc_binding_handle_by_name(state, s->task->msg_ctx,
+ "dreplsrv", &ndr_table_irpc);
+ if (irpc_handle == NULL) {
/* dreplsrv is not running yet */
+ TALLOC_FREE(state);
+ return;
+ }
+
+ subreq = dcerpc_dreplsrv_refresh_r_send(state, s->task->event_ctx,
+ irpc_handle, &state->r);
+ if (subreq == NULL) {
+ TALLOC_FREE(state);
return;
}
+ tevent_req_set_callback(subreq, kccsrv_notify_drepl_server_done, state);
+}
+
+static void kccsrv_notify_drepl_server_done(struct tevent_req *subreq)
+{
+ struct kccsrv_notify_drepl_server_state *state =
+ tevent_req_callback_data(subreq,
+ struct kccsrv_notify_drepl_server_state);
+ NTSTATUS status;
+
+ status = dcerpc_dreplsrv_refresh_r_recv(subreq, state);
+ TALLOC_FREE(subreq);
- IRPC_CALL(s->task->msg_ctx, drepl_srv[0], irpc, DREPLSRV_REFRESH, &r, mem_ctx);
+ /* we don't care about errors */
+ TALLOC_FREE(state);
}
/*
diff --git a/source4/dsdb/wscript_build b/source4/dsdb/wscript_build
index 3b3dae9e66..d3961f52d5 100644
--- a/source4/dsdb/wscript_build
+++ b/source4/dsdb/wscript_build
@@ -38,7 +38,7 @@ bld.SAMBA_MODULE('KCC_SRV',
autoproto='kcc/kcc_service_proto.h',
subsystem='service',
init_function='server_service_kcc_init',
- deps='SAMDB process_model RPC_NDR_DRSUAPI'
+ deps='SAMDB process_model RPC_NDR_IRPC RPC_NDR_DRSUAPI'
)