summaryrefslogtreecommitdiff
path: root/source4/wrepl_server
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-09-03 13:18:14 +0200
committerStefan Metzmacher <metze@samba.org>2010-09-03 17:02:10 +0200
commit993d37baf589da85f5285f4a0edc45da692cc192 (patch)
tree041a64a5458d5e09392fb493796287dc8f53589f /source4/wrepl_server
parentf43ec0e7516a1039172ce3e7f26ad47eb0271310 (diff)
downloadsamba-993d37baf589da85f5285f4a0edc45da692cc192.tar.gz
samba-993d37baf589da85f5285f4a0edc45da692cc192.tar.bz2
samba-993d37baf589da85f5285f4a0edc45da692cc192.zip
s4:wrepl_server: use irpc_binding_handle_by_name() in wreplsrv_scavenging_replica_active_records()
metze
Diffstat (limited to 'source4/wrepl_server')
-rw-r--r--source4/wrepl_server/wrepl_scavenging.c41
1 files changed, 23 insertions, 18 deletions
diff --git a/source4/wrepl_server/wrepl_scavenging.c b/source4/wrepl_server/wrepl_scavenging.c
index 91ba917d1b..68af6793bf 100644
--- a/source4/wrepl_server/wrepl_scavenging.c
+++ b/source4/wrepl_server/wrepl_scavenging.c
@@ -28,7 +28,7 @@
#include "system/time.h"
#include "smbd/service_task.h"
#include "lib/messaging/irpc.h"
-#include "librpc/gen_ndr/ndr_irpc.h"
+#include "librpc/gen_ndr/ndr_irpc_c.h"
#include "librpc/gen_ndr/ndr_nbt.h"
#include "param/param.h"
@@ -312,10 +312,11 @@ struct verify_state {
struct nbtd_proxy_wins_challenge r;
};
-static void verify_handler(struct irpc_request *ireq)
+static void verify_handler(struct tevent_req *subreq)
{
- struct verify_state *s = talloc_get_type(ireq->async.private_data,
- struct verify_state);
+ struct verify_state *s =
+ tevent_req_callback_data(subreq,
+ struct verify_state);
struct winsdb_record *rec = s->rec;
const char *action;
const char *old_state = "active";
@@ -336,7 +337,8 @@ static void verify_handler(struct irpc_request *ireq)
* - if they match do nothing
* - if an error happens do nothing
*/
- status = irpc_call_recv(ireq);
+ status = dcerpc_nbtd_proxy_wins_challenge_r_recv(subreq, s);
+ TALLOC_FREE(subreq);
if (NT_STATUS_EQUAL(NT_STATUS_OBJECT_NAME_NOT_FOUND, status)) {
delete_record = true;
new_state = "deleted";
@@ -425,14 +427,9 @@ static NTSTATUS wreplsrv_scavenging_replica_active_records(struct wreplsrv_servi
int ret;
time_t now = time(NULL);
const char *now_timestr;
- struct irpc_request *ireq;
+ struct tevent_req *subreq;
struct verify_state *s;
- struct server_id *nbt_servers;
-
- nbt_servers = irpc_servers_byname(service->task->msg_ctx, tmp_mem, "nbt_server");
- if ((nbt_servers == NULL) || (nbt_servers[0].id == 0)) {
- return NT_STATUS_INTERNAL_ERROR;
- }
+ struct dcerpc_binding_handle *irpc_handle;
now_timestr = ldb_timestring(tmp_mem, now);
NT_STATUS_HAVE_NO_MEMORY(now_timestr);
@@ -489,13 +486,21 @@ static NTSTATUS wreplsrv_scavenging_replica_active_records(struct wreplsrv_servi
/* TODO: fix pidl to handle inline ipv4address arrays */
s->r.in.addrs[0].addr = rec->wins_owner;
- ireq = IRPC_CALL_SEND(s->msg_ctx, nbt_servers[0],
- irpc, NBTD_PROXY_WINS_CHALLENGE,
- &s->r, s);
- NT_STATUS_HAVE_NO_MEMORY(ireq);
+ irpc_handle = irpc_binding_handle_by_name(s,
+ service->task->msg_ctx,
+ "nbt_server",
+ &ndr_table_irpc);
+ if (irpc_handle == NULL) {
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ subreq = dcerpc_nbtd_proxy_wins_challenge_r_send(s,
+ service->task->event_ctx,
+ irpc_handle,
+ &s->r);
+ NT_STATUS_HAVE_NO_MEMORY(subreq);
- ireq->async.fn = verify_handler;
- ireq->async.private_data= s;
+ tevent_req_set_callback(subreq, verify_handler, s);
talloc_steal(service, s);
}