librpc/idl: Merge wbint.idl with winbind.idl so we can forward IRPC requests to inter...
[Samba/wip.git] / source3 / winbindd / winbindd_update_rodc_dns.c
blob9c13c0630040243be22fd2a4b69f7d76b868f66b
1 /*
2 Unix SMB/CIFS implementation.
3 async implementation of WINBINDD_CHANGE_MACHINE_ACCT
4 Copyright (C) Volker Lendecke 2009
5 Copyright (C) Guenther Deschner 2009
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "includes.h"
22 #include "winbindd.h"
23 #include "librpc/gen_ndr/ndr_winbind_c.h"
24 #include "source4/lib/messaging/irpc.h"
26 struct wb_irpc_DsrUpdateReadOnlyServerDnsRecords_state {
27 struct irpc_message *msg;
28 struct winbind_DsrUpdateReadOnlyServerDnsRecords *req;
31 static void wb_irpc_DsrUpdateReadOnlyServerDnsRecords_callback(struct tevent_req *subreq);
33 NTSTATUS wb_irpc_DsrUpdateReadOnlyServerDnsRecords(struct irpc_message *msg,
34 struct winbind_DsrUpdateReadOnlyServerDnsRecords *req)
36 struct wb_irpc_DsrUpdateReadOnlyServerDnsRecords_state *s;
37 struct tevent_req *subreq;
38 struct winbindd_domain *domain;
40 DEBUG(5, ("wb_irpc_DsrUpdateReadOnlyServerDnsRecords called\n"));
42 s = talloc(msg, struct wb_irpc_DsrUpdateReadOnlyServerDnsRecords_state);
43 NT_STATUS_HAVE_NO_MEMORY(s);
45 s->msg = msg;
46 s->req = req;
48 domain = find_our_domain();
49 if (domain == NULL) {
50 return NT_STATUS_NO_SUCH_DOMAIN;
53 subreq = dcerpc_winbind_DsrUpdateReadOnlyServerDnsRecords_send(s, winbind_event_context(),
54 dom_child_handle(domain),
55 req->in.site_name,
56 req->in.dns_ttl,
57 req->in.dns_names);
58 if (!subreq) {
59 return NT_STATUS_NO_MEMORY;
62 tevent_req_set_callback(subreq,
63 wb_irpc_DsrUpdateReadOnlyServerDnsRecords_callback,
64 s);
66 msg->defer_reply = true;
67 return NT_STATUS_OK;
70 static void wb_irpc_DsrUpdateReadOnlyServerDnsRecords_callback(struct tevent_req *subreq)
72 struct wb_irpc_DsrUpdateReadOnlyServerDnsRecords_state *s =
73 tevent_req_callback_data(subreq,
74 struct wb_irpc_DsrUpdateReadOnlyServerDnsRecords_state);
75 NTSTATUS status, result;
77 DEBUG(5, ("wb_irpc_DsrUpdateReadOnlyServerDnsRecords_callback called\n"));
79 status = dcerpc_winbind_DsrUpdateReadOnlyServerDnsRecords_recv(subreq, s, &result);
80 any_nt_status_not_ok(status, result, &status);
81 TALLOC_FREE(subreq);
83 irpc_send_reply(s->msg, status);