2 Unix SMB/CIFS implementation.
3 async implementation of commands submitted over IRPC
4 Copyright (C) Volker Lendecke 2009
5 Copyright (C) Guenther Deschner 2009
6 Copyright (C) Andrew Bartlett 2014
7 Copyright (C) Andrew Tridgell 2009
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
25 #include "librpc/gen_ndr/ndr_winbind_c.h"
26 #include "source4/lib/messaging/irpc.h"
27 #include "librpc/gen_ndr/ndr_winbind.h"
28 #include "librpc/gen_ndr/ndr_lsa.h"
29 #include "librpc/gen_ndr/ndr_lsa_c.h"
30 #include "libcli/security/dom_sid.h"
31 #include "passdb/lookup_sid.h" /* only for LOOKUP_NAME_NO_NSS flag */
32 #include "librpc/gen_ndr/ndr_irpc.h"
33 #include "librpc/gen_ndr/ndr_netlogon.h"
35 struct wb_irpc_forward_state
{
36 struct irpc_message
*msg
;
37 struct winbind_DsrUpdateReadOnlyServerDnsRecords
*req
;
40 struct dcesrv_call_state
*dce_call
;
44 called when the forwarded rpc request is finished
46 static void wb_irpc_forward_callback(struct tevent_req
*subreq
)
48 struct wb_irpc_forward_state
*st
=
49 tevent_req_callback_data(subreq
,
50 struct wb_irpc_forward_state
);
51 const char *opname
= st
->opname
;
54 status
= dcerpc_binding_handle_call_recv(subreq
);
56 if (!NT_STATUS_IS_OK(status
)) {
57 DEBUG(0,("RPC callback failed for %s - %s\n",
58 opname
, nt_errstr(status
)));
59 irpc_send_reply(st
->msg
, status
);
63 irpc_send_reply(st
->msg
, status
);
69 * Forward a RPC call using IRPC to another task
72 static NTSTATUS
wb_irpc_forward_rpc_call(struct irpc_message
*msg
, TALLOC_CTX
*mem_ctx
,
73 struct tevent_context
*ev
,
74 void *r
, uint32_t callid
,
76 struct winbindd_domain
*domain
,
79 struct wb_irpc_forward_state
*st
;
80 struct dcerpc_binding_handle
*binding_handle
;
81 struct tevent_req
*subreq
;
83 st
= talloc(mem_ctx
, struct wb_irpc_forward_state
);
85 return NT_STATUS_NO_MEMORY
;
91 binding_handle
= dom_child_handle(domain
);
92 if (binding_handle
== NULL
) {
93 DEBUG(0,("%s: Failed to forward request to winbind handler for %s\n",
94 opname
, domain
->name
));
95 return NT_STATUS_UNSUCCESSFUL
;
98 /* reset timeout for the handle */
99 dcerpc_binding_handle_set_timeout(binding_handle
, timeout
);
101 /* forward the call */
102 subreq
= dcerpc_binding_handle_call_send(st
, ev
,
104 NULL
, &ndr_table_winbind
,
107 if (subreq
== NULL
) {
108 DEBUG(0,("%s: Failed to forward request to winbind handler for %s\n",
109 opname
, domain
->name
));
110 return NT_STATUS_UNSUCCESSFUL
;
113 /* mark the request as replied async */
114 msg
->defer_reply
= true;
116 /* setup the callback */
117 tevent_req_set_callback(subreq
, wb_irpc_forward_callback
, st
);
121 static NTSTATUS
wb_irpc_DsrUpdateReadOnlyServerDnsRecords(struct irpc_message
*msg
,
122 struct winbind_DsrUpdateReadOnlyServerDnsRecords
*req
)
124 struct winbindd_domain
*domain
= find_our_domain();
125 if (domain
== NULL
) {
126 return NT_STATUS_NO_SUCH_DOMAIN
;
129 DEBUG(5, ("wb_irpc_DsrUpdateReadOnlyServerDnsRecords called\n"));
131 return wb_irpc_forward_rpc_call(msg
, msg
,
132 server_event_context(),
133 req
, NDR_WINBIND_DSRUPDATEREADONLYSERVERDNSRECORDS
,
134 "winbind_DsrUpdateReadOnlyServerDnsRecords",
135 domain
, IRPC_CALL_TIMEOUT
);
138 static NTSTATUS
wb_irpc_SamLogon(struct irpc_message
*msg
,
139 struct winbind_SamLogon
*req
)
141 struct winbindd_domain
*domain
;
142 struct netr_IdentityInfo
*identity_info
;
143 const char *target_domain_name
= NULL
;
144 const char *account_name
= NULL
;
146 switch (req
->in
.logon_level
) {
147 case NetlogonInteractiveInformation
:
148 case NetlogonServiceInformation
:
149 case NetlogonInteractiveTransitiveInformation
:
150 case NetlogonServiceTransitiveInformation
:
151 if (req
->in
.logon
.password
== NULL
) {
152 return NT_STATUS_REQUEST_NOT_ACCEPTED
;
154 identity_info
= &req
->in
.logon
.password
->identity_info
;
157 case NetlogonNetworkInformation
:
158 case NetlogonNetworkTransitiveInformation
:
159 if (req
->in
.logon
.network
== NULL
) {
160 return NT_STATUS_REQUEST_NOT_ACCEPTED
;
163 identity_info
= &req
->in
.logon
.network
->identity_info
;
166 case NetlogonGenericInformation
:
167 if (req
->in
.logon
.generic
== NULL
) {
168 return NT_STATUS_REQUEST_NOT_ACCEPTED
;
171 identity_info
= &req
->in
.logon
.generic
->identity_info
;
175 return NT_STATUS_REQUEST_NOT_ACCEPTED
;
178 target_domain_name
= identity_info
->domain_name
.string
;
179 if (target_domain_name
== NULL
) {
180 target_domain_name
= "";
183 account_name
= identity_info
->account_name
.string
;
184 if (account_name
== NULL
) {
188 if (IS_DC
&& target_domain_name
[0] == '\0') {
189 const char *p
= NULL
;
191 p
= strchr_m(account_name
, '@');
193 target_domain_name
= p
+ 1;
197 if (IS_DC
&& target_domain_name
[0] == '\0') {
198 DBG_ERR("target_domain[%s] account[%s]\n",
199 target_domain_name
, account_name
);
200 return NT_STATUS_REQUEST_NOT_ACCEPTED
;
203 domain
= find_auth_domain(0, target_domain_name
);
204 if (domain
== NULL
) {
205 DBG_INFO("target_domain[%s] for account[%s] not known\n",
206 target_domain_name
, account_name
);
207 req
->out
.result
= NT_STATUS_NO_SUCH_USER
;
208 req
->out
.authoritative
= 0;
212 DEBUG(5, ("wb_irpc_SamLogon called\n"));
214 return wb_irpc_forward_rpc_call(msg
, msg
,
215 server_event_context(),
216 req
, NDR_WINBIND_SAMLOGON
,
218 domain
, IRPC_CALL_TIMEOUT
);
221 static NTSTATUS
wb_irpc_LogonControl(struct irpc_message
*msg
,
222 struct winbind_LogonControl
*req
)
224 TALLOC_CTX
*frame
= talloc_stackframe();
225 char *domain_name
= NULL
;
226 struct winbindd_domain
*domain
= NULL
;
228 DEBUG(5, ("wb_irpc_LogonControl called\n"));
230 switch (req
->in
.function_code
) {
231 case NETLOGON_CONTROL_REDISCOVER
:
232 case NETLOGON_CONTROL_TC_QUERY
:
233 case NETLOGON_CONTROL_CHANGE_PASSWORD
:
234 case NETLOGON_CONTROL_TC_VERIFY
:
235 if (req
->in
.data
->domain
== NULL
) {
237 return NT_STATUS_INVALID_PARAMETER
;
240 domain_name
= talloc_strdup(frame
, req
->in
.data
->domain
);
241 if (domain_name
== NULL
) {
242 req
->out
.result
= WERR_NOT_ENOUGH_MEMORY
;
250 return NT_STATUS_NOT_IMPLEMENTED
;
253 if (req
->in
.function_code
== NETLOGON_CONTROL_REDISCOVER
) {
257 * NETLOGON_CONTROL_REDISCOVER
258 * get's an optional \dcname appended to the domain name
260 p
= strchr_m(domain_name
, '\\');
266 domain
= find_domain_from_name_noinit(domain_name
);
267 if (domain
== NULL
) {
268 req
->out
.result
= WERR_NO_SUCH_DOMAIN
;
274 return wb_irpc_forward_rpc_call(msg
, msg
,
275 server_event_context(),
276 req
, NDR_WINBIND_LOGONCONTROL
,
277 "winbind_LogonControl",
278 domain
, 45 /* timeout */);
281 static NTSTATUS
wb_irpc_GetForestTrustInformation(struct irpc_message
*msg
,
282 struct winbind_GetForestTrustInformation
*req
)
284 struct winbindd_domain
*domain
= NULL
;
286 if (req
->in
.trusted_domain_name
== NULL
) {
287 req
->out
.result
= WERR_NO_SUCH_DOMAIN
;
291 domain
= find_trust_from_name_noinit(req
->in
.trusted_domain_name
);
292 if (domain
== NULL
) {
293 req
->out
.result
= WERR_NO_SUCH_DOMAIN
;
298 * checking for domain->internal and domain->primary
299 * makes sure we only do some work when running as DC.
302 if (domain
->internal
) {
303 req
->out
.result
= WERR_NO_SUCH_DOMAIN
;
307 if (domain
->primary
) {
308 req
->out
.result
= WERR_NO_SUCH_DOMAIN
;
312 DEBUG(5, ("wb_irpc_GetForestTrustInformation called\n"));
314 return wb_irpc_forward_rpc_call(msg
, msg
,
315 server_event_context(),
316 req
, NDR_WINBIND_GETFORESTTRUSTINFORMATION
,
317 "winbind_GetForestTrustInformation",
318 domain
, 45 /* timeout */);
321 static NTSTATUS
wb_irpc_SendToSam(struct irpc_message
*msg
,
322 struct winbind_SendToSam
*req
)
324 /* TODO make sure that it is RWDC */
325 struct winbindd_domain
*domain
= find_our_domain();
326 if (domain
== NULL
) {
327 return NT_STATUS_NO_SUCH_DOMAIN
;
330 DEBUG(5, ("wb_irpc_SendToSam called\n"));
332 return wb_irpc_forward_rpc_call(msg
, msg
,
333 server_event_context(),
334 req
, NDR_WINBIND_SENDTOSAM
,
336 domain
, IRPC_CALL_TIMEOUT
);
339 struct wb_irpc_lsa_LookupSids3_state
{
340 struct irpc_message
*msg
;
341 struct lsa_LookupSids3
*req
;
344 static void wb_irpc_lsa_LookupSids3_done(struct tevent_req
*subreq
);
346 static NTSTATUS
wb_irpc_lsa_LookupSids3_call(struct irpc_message
*msg
,
347 struct lsa_LookupSids3
*req
)
349 struct wb_irpc_lsa_LookupSids3_state
*state
= NULL
;
350 struct tevent_req
*subreq
= NULL
;
351 struct dom_sid
*sids
= NULL
;
354 state
= talloc_zero(msg
, struct wb_irpc_lsa_LookupSids3_state
);
356 return NT_STATUS_NO_MEMORY
;
362 state
->req
->out
.domains
= talloc_zero(state
->msg
,
363 struct lsa_RefDomainList
*);
364 if (state
->req
->out
.domains
== NULL
) {
365 return NT_STATUS_NO_MEMORY
;
367 state
->req
->out
.names
= talloc_zero(state
->msg
,
368 struct lsa_TransNameArray2
);
369 if (state
->req
->out
.names
== NULL
) {
370 return NT_STATUS_NO_MEMORY
;
372 state
->req
->out
.count
= talloc_zero(state
->msg
, uint32_t);
373 if (state
->req
->out
.count
== NULL
) {
374 return NT_STATUS_NO_MEMORY
;
377 state
->req
->out
.names
->names
= talloc_zero_array(state
->msg
,
378 struct lsa_TranslatedName2
,
379 req
->in
.sids
->num_sids
);
380 if (state
->req
->out
.names
->names
== NULL
) {
381 return NT_STATUS_NO_MEMORY
;
384 sids
= talloc_zero_array(state
, struct dom_sid
,
385 req
->in
.sids
->num_sids
);
387 return NT_STATUS_NO_MEMORY
;
390 for (i
= 0; i
< req
->in
.sids
->num_sids
; i
++) {
391 if (req
->in
.sids
->sids
[i
].sid
== NULL
) {
392 return NT_STATUS_REQUEST_NOT_ACCEPTED
;
395 sids
[i
] = *req
->in
.sids
->sids
[i
].sid
;
398 subreq
= wb_lookupsids_send(msg
,
399 server_event_context(),
400 sids
, req
->in
.sids
->num_sids
);
401 if (subreq
== NULL
) {
402 return NT_STATUS_NO_MEMORY
;
404 tevent_req_set_callback(subreq
, wb_irpc_lsa_LookupSids3_done
, state
);
405 msg
->defer_reply
= true;
410 static void wb_irpc_lsa_LookupSids3_done(struct tevent_req
*subreq
)
412 struct wb_irpc_lsa_LookupSids3_state
*state
=
413 tevent_req_callback_data(subreq
,
414 struct wb_irpc_lsa_LookupSids3_state
);
415 struct lsa_RefDomainList
*domains
= NULL
;
416 struct lsa_TransNameArray
*names
= NULL
;
420 status
= wb_lookupsids_recv(subreq
, state
->msg
,
423 if (!NT_STATUS_IS_OK(status
)) {
424 DEBUG(0,("RPC callback failed for %s - %s\n",
425 __func__
, nt_errstr(status
)));
426 irpc_send_reply(state
->msg
, status
);
430 if (names
->count
> state
->req
->in
.sids
->num_sids
) {
431 status
= NT_STATUS_INTERNAL_ERROR
;
432 DEBUG(0,("RPC callback failed for %s - %s\n",
433 __func__
, nt_errstr(status
)));
434 irpc_send_reply(state
->msg
, status
);
438 *state
->req
->out
.domains
= domains
;
439 for (i
= 0; i
< names
->count
; i
++) {
440 struct lsa_TranslatedName2
*n2
=
441 &state
->req
->out
.names
->names
[i
];
443 n2
->sid_type
= names
->names
[i
].sid_type
;
444 n2
->name
= names
->names
[i
].name
;
445 n2
->sid_index
= names
->names
[i
].sid_index
;
448 if (n2
->sid_type
!= SID_NAME_UNKNOWN
) {
449 (*state
->req
->out
.count
)++;
452 state
->req
->out
.names
->count
= names
->count
;
454 if (*state
->req
->out
.count
== 0) {
455 state
->req
->out
.result
= NT_STATUS_NONE_MAPPED
;
456 } else if (*state
->req
->out
.count
!= names
->count
) {
457 state
->req
->out
.result
= NT_STATUS_SOME_NOT_MAPPED
;
459 state
->req
->out
.result
= NT_STATUS_OK
;
462 irpc_send_reply(state
->msg
, NT_STATUS_OK
);
466 struct wb_irpc_lsa_LookupNames4_name
{
469 const char *namespace;
473 enum lsa_SidType type
;
474 struct dom_sid
*authority_sid
;
477 struct wb_irpc_lsa_LookupNames4_state
{
478 struct irpc_message
*msg
;
479 struct lsa_LookupNames4
*req
;
480 struct wb_irpc_lsa_LookupNames4_name
*names
;
481 uint32_t num_pending
;
482 uint32_t num_domain_sids
;
483 struct dom_sid
*domain_sids
;
486 static void wb_irpc_lsa_LookupNames4_done(struct tevent_req
*subreq
);
488 static NTSTATUS
wb_irpc_lsa_LookupNames4_call(struct irpc_message
*msg
,
489 struct lsa_LookupNames4
*req
)
491 struct wb_irpc_lsa_LookupNames4_state
*state
= NULL
;
492 struct tevent_req
*subreq
= NULL
;
496 state
= talloc_zero(msg
, struct wb_irpc_lsa_LookupNames4_state
);
498 return NT_STATUS_NO_MEMORY
;
504 state
->req
->out
.domains
= talloc_zero(state
->msg
,
505 struct lsa_RefDomainList
*);
506 if (state
->req
->out
.domains
== NULL
) {
507 return NT_STATUS_NO_MEMORY
;
509 state
->req
->out
.sids
= talloc_zero(state
->msg
,
510 struct lsa_TransSidArray3
);
511 if (state
->req
->out
.sids
== NULL
) {
512 return NT_STATUS_NO_MEMORY
;
514 state
->req
->out
.count
= talloc_zero(state
->msg
, uint32_t);
515 if (state
->req
->out
.count
== NULL
) {
516 return NT_STATUS_NO_MEMORY
;
519 state
->req
->out
.sids
->sids
= talloc_zero_array(state
->msg
,
520 struct lsa_TranslatedSid3
,
522 if (state
->req
->out
.sids
->sids
== NULL
) {
523 return NT_STATUS_NO_MEMORY
;
526 state
->names
= talloc_zero_array(state
,
527 struct wb_irpc_lsa_LookupNames4_name
,
529 if (state
->names
== NULL
) {
530 return NT_STATUS_NO_MEMORY
;
533 for (i
= 0; i
< req
->in
.num_names
; i
++) {
534 struct wb_irpc_lsa_LookupNames4_name
*nstate
=
538 if (req
->in
.names
[i
].string
== NULL
) {
539 DBG_ERR("%s: name[%s] NT_STATUS_REQUEST_NOT_ACCEPTED.\n",
540 __location__
, req
->in
.names
[i
].string
);
541 return NT_STATUS_REQUEST_NOT_ACCEPTED
;
543 nstate
->state
= state
;
545 nstate
->name
= talloc_strdup(state
->names
,
546 req
->in
.names
[i
].string
);
547 if (nstate
->name
== NULL
) {
548 return NT_STATUS_NO_MEMORY
;
550 nstate
->type
= SID_NAME_UNKNOWN
;
552 /* cope with the name being a fully qualified name */
553 p
= strchr(nstate
->name
, '\\');
556 nstate
->domain
= nstate
->name
;
557 nstate
->namespace = nstate
->domain
;
559 } else if ((p
= strchr(nstate
->name
, '@')) != NULL
) {
562 nstate
->namespace = p
+ 1;
565 * TODO: select the domain based on
566 * req->in.level and req->in.client_revision
568 * For now we don't allow this.
570 DBG_ERR("%s: name[%s] NT_STATUS_REQUEST_NOT_ACCEPTED.\n",
571 __location__
, nstate
->name
);
572 return NT_STATUS_REQUEST_NOT_ACCEPTED
;
575 subreq
= wb_lookupname_send(msg
,
576 server_event_context(),
581 if (subreq
== NULL
) {
582 return NT_STATUS_NO_MEMORY
;
584 tevent_req_set_callback(subreq
,
585 wb_irpc_lsa_LookupNames4_done
,
587 state
->num_pending
++;
590 msg
->defer_reply
= true;
595 static void wb_irpc_lsa_LookupNames4_domains_done(struct tevent_req
*subreq
);
597 static void wb_irpc_lsa_LookupNames4_done(struct tevent_req
*subreq
)
599 struct wb_irpc_lsa_LookupNames4_name
*nstate
=
600 (struct wb_irpc_lsa_LookupNames4_name
*)
601 tevent_req_callback_data_void(subreq
);
602 struct wb_irpc_lsa_LookupNames4_state
*state
=
603 talloc_get_type_abort(nstate
->state
,
604 struct wb_irpc_lsa_LookupNames4_state
);
607 SMB_ASSERT(state
->num_pending
> 0);
608 state
->num_pending
--;
609 status
= wb_lookupname_recv(subreq
, &nstate
->sid
, &nstate
->type
);
611 if (!NT_STATUS_IS_OK(status
)) {
612 DEBUG(0,("RPC callback failed for %s - %s\n",
613 __func__
, nt_errstr(status
)));
614 irpc_send_reply(state
->msg
, status
);
618 status
= dom_sid_split_rid(state
, &nstate
->sid
,
619 &nstate
->authority_sid
, NULL
);
620 if (!NT_STATUS_IS_OK(status
)) {
621 DBG_ERR("dom_sid_split_rid(%s) failed - %s\n",
622 sid_string_dbg(&nstate
->sid
), nt_errstr(status
));
623 irpc_send_reply(state
->msg
, status
);
627 status
= add_sid_to_array_unique(state
,
628 nstate
->authority_sid
,
630 &state
->num_domain_sids
);
631 if (!NT_STATUS_IS_OK(status
)) {
632 DBG_ERR("add_sid_to_array_unique(%s) failed - %s\n",
633 sid_string_dbg(nstate
->authority_sid
), nt_errstr(status
));
634 irpc_send_reply(state
->msg
, status
);
638 if (state
->num_pending
> 0) {
646 * Now resolve all domains back to a name
647 * to get a good lsa_RefDomainList
649 subreq
= wb_lookupsids_send(state
,
650 server_event_context(),
652 state
->num_domain_sids
);
653 if (subreq
== NULL
) {
654 status
= NT_STATUS_NO_MEMORY
;
655 DBG_ERR("wb_lookupsids_send - %s\n",
657 irpc_send_reply(state
->msg
, status
);
660 tevent_req_set_callback(subreq
,
661 wb_irpc_lsa_LookupNames4_domains_done
,
667 static void wb_irpc_lsa_LookupNames4_domains_done(struct tevent_req
*subreq
)
669 struct wb_irpc_lsa_LookupNames4_state
*state
=
670 tevent_req_callback_data(subreq
,
671 struct wb_irpc_lsa_LookupNames4_state
);
672 struct lsa_RefDomainList
*domains
= NULL
;
673 struct lsa_TransNameArray
*names
= NULL
;
677 status
= wb_lookupsids_recv(subreq
, state
->msg
,
680 if (!NT_STATUS_IS_OK(status
)) {
681 DEBUG(0,("RPC callback failed for %s - %s\n",
682 __func__
, nt_errstr(status
)));
683 irpc_send_reply(state
->msg
, status
);
687 *state
->req
->out
.domains
= domains
;
688 for (i
= 0; i
< state
->req
->in
.num_names
; i
++) {
689 struct wb_irpc_lsa_LookupNames4_name
*nstate
=
691 struct lsa_TranslatedSid3
*s3
=
692 &state
->req
->out
.sids
->sids
[i
];
695 s3
->sid_type
= nstate
->type
;
696 if (s3
->sid_type
!= SID_NAME_UNKNOWN
) {
697 s3
->sid
= &nstate
->sid
;
701 s3
->sid_index
= UINT32_MAX
;
702 for (di
= 0; di
< domains
->count
; di
++) {
705 if (domains
->domains
[di
].sid
== NULL
) {
709 match
= dom_sid_equal(nstate
->authority_sid
,
710 domains
->domains
[di
].sid
);
716 if (s3
->sid_type
!= SID_NAME_UNKNOWN
) {
717 (*state
->req
->out
.count
)++;
720 state
->req
->out
.sids
->count
= state
->req
->in
.num_names
;
722 if (*state
->req
->out
.count
== 0) {
723 state
->req
->out
.result
= NT_STATUS_NONE_MAPPED
;
724 } else if (*state
->req
->out
.count
!= state
->req
->in
.num_names
) {
725 state
->req
->out
.result
= NT_STATUS_SOME_NOT_MAPPED
;
727 state
->req
->out
.result
= NT_STATUS_OK
;
730 irpc_send_reply(state
->msg
, NT_STATUS_OK
);
734 struct wb_irpc_GetDCName_state
{
735 struct irpc_message
*msg
;
736 struct wbint_DsGetDcName
*req
;
739 static void wb_irpc_GetDCName_done(struct tevent_req
*subreq
);
741 static NTSTATUS
wb_irpc_GetDCName(struct irpc_message
*msg
,
742 struct wbint_DsGetDcName
*req
)
745 struct tevent_req
*subreq
= NULL
;
746 struct wb_irpc_GetDCName_state
*state
= NULL
;
748 state
= talloc_zero(msg
, struct wb_irpc_GetDCName_state
);
750 return NT_STATUS_NO_MEMORY
;
756 subreq
= wb_dsgetdcname_send(msg
,
757 server_event_context(),
762 if (subreq
== NULL
) {
763 return NT_STATUS_NO_MEMORY
;
766 tevent_req_set_callback(subreq
,
767 wb_irpc_GetDCName_done
,
770 msg
->defer_reply
= true;
775 static void wb_irpc_GetDCName_done(struct tevent_req
*subreq
)
777 struct wb_irpc_GetDCName_state
*state
= tevent_req_callback_data(
778 subreq
, struct wb_irpc_GetDCName_state
);
781 status
= wb_dsgetdcname_recv(subreq
, state
->msg
,
782 state
->req
->out
.dc_info
);
784 if (!NT_STATUS_IS_OK(status
)) {
785 DBG_INFO("RPC callback failed for %s - %s\n", "DSGETDCNAME",
789 state
->req
->out
.result
= status
;
791 irpc_send_reply(state
->msg
, NT_STATUS_OK
);
794 NTSTATUS
wb_irpc_register(void)
798 status
= IRPC_REGISTER(winbind_imessaging_context(), winbind
, WINBIND_DSRUPDATEREADONLYSERVERDNSRECORDS
,
799 wb_irpc_DsrUpdateReadOnlyServerDnsRecords
, NULL
);
800 if (!NT_STATUS_IS_OK(status
)) {
803 status
= IRPC_REGISTER(winbind_imessaging_context(), winbind
, WINBIND_SAMLOGON
,
804 wb_irpc_SamLogon
, NULL
);
805 if (!NT_STATUS_IS_OK(status
)) {
808 status
= IRPC_REGISTER(winbind_imessaging_context(), winbind
,
809 WINBIND_LOGONCONTROL
,
810 wb_irpc_LogonControl
, NULL
);
811 if (!NT_STATUS_IS_OK(status
)) {
814 status
= IRPC_REGISTER(winbind_imessaging_context(), winbind
,
815 WINBIND_GETFORESTTRUSTINFORMATION
,
816 wb_irpc_GetForestTrustInformation
, NULL
);
817 if (!NT_STATUS_IS_OK(status
)) {
820 status
= IRPC_REGISTER(winbind_imessaging_context(), winbind
, WINBIND_SENDTOSAM
,
821 wb_irpc_SendToSam
, NULL
);
822 if (!NT_STATUS_IS_OK(status
)) {
825 status
= IRPC_REGISTER(winbind_imessaging_context(),
826 lsarpc
, LSA_LOOKUPSIDS3
,
827 wb_irpc_lsa_LookupSids3_call
, NULL
);
828 if (!NT_STATUS_IS_OK(status
)) {
831 status
= IRPC_REGISTER(winbind_imessaging_context(),
832 lsarpc
, LSA_LOOKUPNAMES4
,
833 wb_irpc_lsa_LookupNames4_call
, NULL
);
834 if (!NT_STATUS_IS_OK(status
)) {
837 status
= IRPC_REGISTER(winbind_imessaging_context(),
838 winbind
, WBINT_DSGETDCNAME
,
839 wb_irpc_GetDCName
, NULL
);
840 if (!NT_STATUS_IS_OK(status
)) {