mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
s4:wrepl_server: use irpc_binding_handle_by_name() in wreplsrv_scavenging_replica_active_records()
metze
This commit is contained in:
parent
f43ec0e751
commit
993d37baf5
@ -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;
|
||||
}
|
||||
|
||||
ireq->async.fn = verify_handler;
|
||||
ireq->async.private_data= s;
|
||||
subreq = dcerpc_nbtd_proxy_wins_challenge_r_send(s,
|
||||
service->task->event_ctx,
|
||||
irpc_handle,
|
||||
&s->r);
|
||||
NT_STATUS_HAVE_NO_MEMORY(subreq);
|
||||
|
||||
tevent_req_set_callback(subreq, verify_handler, s);
|
||||
|
||||
talloc_steal(service, s);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user