2 Unix SMB/CIFS implementation.
4 Copyright (C) Stefan Metzmacher 2004
5 Copyright (C) Rafal Szczesniak 2005
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 2 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, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include "libnet/libnet.h"
24 #include "libcli/libcli.h"
25 #include "libcli/composite/composite.h"
26 #include "librpc/gen_ndr/ndr_lsa_c.h"
27 #include "librpc/gen_ndr/ndr_samr.h"
30 struct rpc_connect_srv_state {
31 struct libnet_RpcConnect r;
36 static void continue_pipe_connect(struct composite_context *ctx);
40 * Initiates connection to rpc pipe on remote server
42 * @param ctx initialised libnet context
43 * @param mem_ctx memory context of this call
44 * @param r data structure containing necessary parameters and return values
45 * @return composite context of this call
48 static struct composite_context* libnet_RpcConnectSrv_send(struct libnet_context *ctx,
50 struct libnet_RpcConnect *r)
52 struct composite_context *c;
53 struct rpc_connect_srv_state *s;
54 struct composite_context *pipe_connect_req;
56 /* composite context allocation and setup */
57 c = talloc_zero(mem_ctx, struct composite_context);
58 if (c == NULL) return NULL;
60 s = talloc_zero(c, struct rpc_connect_srv_state);
61 if (composite_nomem(s, c)) return c;
63 c->state = COMPOSITE_STATE_IN_PROGRESS;
65 c->event_ctx = ctx->event_ctx;
68 ZERO_STRUCT(s->r.out);
70 /* prepare binding string */
72 case LIBNET_RPC_CONNECT_DC:
73 case LIBNET_RPC_CONNECT_PDC:
74 case LIBNET_RPC_CONNECT_SERVER:
75 s->binding = talloc_asprintf(s, "ncacn_np:%s", r->in.name);
78 case LIBNET_RPC_CONNECT_BINDING:
79 s->binding = talloc_strdup(s, r->in.binding);
82 case LIBNET_RPC_CONNECT_DC_INFO:
83 /* this should never happen - DC_INFO level has a separate
85 composite_error(c, NT_STATUS_INVALID_LEVEL);
89 /* connect to remote dcerpc pipe */
90 pipe_connect_req = dcerpc_pipe_connect_send(c, &s->r.out.dcerpc_pipe,
91 s->binding, r->in.dcerpc_iface,
92 ctx->cred, c->event_ctx);
93 if (composite_nomem(pipe_connect_req, c)) return c;
95 composite_continue(c, pipe_connect_req, continue_pipe_connect, c);
101 Step 2 of RpcConnectSrv - get rpc connection
103 static void continue_pipe_connect(struct composite_context *ctx)
105 struct composite_context *c;
106 struct rpc_connect_srv_state *s;
108 c = talloc_get_type(ctx->async.private_data, struct composite_context);
109 s = talloc_get_type(c->private_data, struct rpc_connect_srv_state);
111 /* receive result of rpc pipe connection */
112 c->status = dcerpc_pipe_connect_recv(ctx, c, &s->r.out.dcerpc_pipe);
113 if (!composite_is_ok(c)) return;
115 s->r.out.error_string = NULL;
121 * Receives result of connection to rpc pipe on remote server
123 * @param c composite context
124 * @param ctx initialised libnet context
125 * @param mem_ctx memory context of this call
126 * @param r data structure containing necessary parameters and return values
127 * @return nt status of rpc connection
130 static NTSTATUS libnet_RpcConnectSrv_recv(struct composite_context *c,
131 struct libnet_context *ctx,
133 struct libnet_RpcConnect *r)
136 struct rpc_connect_srv_state *s = talloc_get_type(c->private_data,
137 struct rpc_connect_srv_state);
139 status = composite_wait(c);
140 if (NT_STATUS_IS_OK(status)) {
141 /* move the returned rpc pipe between memory contexts */
142 s = talloc_get_type(c->private_data, struct rpc_connect_srv_state);
143 r->out.dcerpc_pipe = talloc_steal(mem_ctx, s->r.out.dcerpc_pipe);
145 /* reference created pipe structure to long-term libnet_context
146 so that it can be used by other api functions even after short-term
148 if (r->in.dcerpc_iface == &dcerpc_table_samr) {
149 ctx->samr_pipe = talloc_reference(ctx, r->out.dcerpc_pipe);
151 ctx->pipe = talloc_reference(ctx, r->out.dcerpc_pipe);
154 r->out.error_string = talloc_steal(mem_ctx, s->r.out.error_string);
162 struct rpc_connect_dc_state {
163 struct libnet_context *ctx;
164 struct libnet_RpcConnect r;
165 struct libnet_RpcConnect r2;
166 struct libnet_LookupDCs f;
167 const char *connect_name;
171 static void continue_lookup_dc(struct composite_context *ctx);
172 static void continue_rpc_connect(struct composite_context *ctx);
176 * Initiates connection to rpc pipe on domain pdc
178 * @param ctx initialised libnet context
179 * @param mem_ctx memory context of this call
180 * @param r data structure containing necessary parameters and return values
181 * @return composite context of this call
184 static struct composite_context* libnet_RpcConnectDC_send(struct libnet_context *ctx,
186 struct libnet_RpcConnect *r)
188 struct composite_context *c;
189 struct rpc_connect_dc_state *s;
190 struct composite_context *lookup_dc_req;
192 /* composite context allocation and setup */
193 c = talloc_zero(mem_ctx, struct composite_context);
194 if (c == NULL) return NULL;
196 s = talloc_zero(c, struct rpc_connect_dc_state);
197 if (composite_nomem(s, c)) return c;
199 c->state = COMPOSITE_STATE_IN_PROGRESS;
201 c->event_ctx = ctx->event_ctx;
205 ZERO_STRUCT(s->r.out);
208 case LIBNET_RPC_CONNECT_PDC:
209 s->f.in.name_type = NBT_NAME_PDC;
212 case LIBNET_RPC_CONNECT_DC:
213 s->f.in.name_type = NBT_NAME_LOGON;
219 s->f.in.domain_name = r->in.name;
220 s->f.out.num_dcs = 0;
223 /* find the domain pdc first */
224 lookup_dc_req = libnet_LookupDCs_send(ctx, c, &s->f);
225 if (composite_nomem(lookup_dc_req, c)) return c;
227 composite_continue(c, lookup_dc_req, continue_lookup_dc, c);
233 Step 2 of RpcConnectDC: get domain controller name/address and
234 initiate RpcConnect to it
236 static void continue_lookup_dc(struct composite_context *ctx)
238 struct composite_context *c;
239 struct rpc_connect_dc_state *s;
240 struct composite_context *rpc_connect_req;
242 c = talloc_get_type(ctx->async.private_data, struct composite_context);
243 s = talloc_get_type(c->private_data, struct rpc_connect_dc_state);
245 /* receive result of domain controller lookup */
246 c->status = libnet_LookupDCs_recv(ctx, c, &s->f);
247 if (!composite_is_ok(c)) return;
249 /* we might not have got back a name. Fall back to the IP */
250 if (s->f.out.dcs[0].name) {
251 s->connect_name = s->f.out.dcs[0].name;
253 s->connect_name = s->f.out.dcs[0].address;
256 /* ok, pdc has been found so do attempt to rpc connect */
257 s->r2.level = LIBNET_RPC_CONNECT_SERVER;
259 /* this will cause yet another name resolution, but at least
260 * we pass the right name down the stack now */
261 s->r2.in.name = talloc_strdup(c, s->connect_name);
262 s->r2.in.dcerpc_iface = s->r.in.dcerpc_iface;
264 /* send rpc connect request to the server */
265 rpc_connect_req = libnet_RpcConnect_send(s->ctx, c, &s->r2);
266 if (composite_nomem(rpc_connect_req, c)) return;
268 composite_continue(c, rpc_connect_req, continue_rpc_connect, c);
273 Step 3 of RpcConnectDC: get rpc connection to the server
275 static void continue_rpc_connect(struct composite_context *ctx)
277 struct composite_context *c;
278 struct rpc_connect_dc_state *s;
280 c = talloc_get_type(ctx->async.private_data, struct composite_context);
281 s = talloc_get_type(c->private_data, struct rpc_connect_dc_state);
283 c->status = libnet_RpcConnect_recv(ctx, s->ctx, c, &s->r2);
285 /* error string is to be passed anyway */
286 s->r.out.error_string = s->r2.out.error_string;
287 if (!composite_is_ok(c)) return;
289 s->r.out.dcerpc_pipe = s->r2.out.dcerpc_pipe;
296 * Receives result of connection to rpc pipe on domain pdc
298 * @param c composite context
299 * @param ctx initialised libnet context
300 * @param mem_ctx memory context of this call
301 * @param r data structure containing necessary parameters and return values
302 * @return nt status of rpc connection
305 static NTSTATUS libnet_RpcConnectDC_recv(struct composite_context *c,
306 struct libnet_context *ctx,
308 struct libnet_RpcConnect *r)
311 struct rpc_connect_dc_state *s = talloc_get_type(c->private_data,
312 struct rpc_connect_dc_state);
314 status = composite_wait(c);
315 if (NT_STATUS_IS_OK(status)) {
316 /* move connected rpc pipe between memory contexts */
317 r->out.dcerpc_pipe = talloc_steal(mem_ctx, s->r.out.dcerpc_pipe);
319 /* reference created pipe structure to long-term libnet_context
320 so that it can be used by other api functions even after short-term
322 if (r->in.dcerpc_iface == &dcerpc_table_samr) {
323 ctx->samr_pipe = talloc_reference(ctx, r->out.dcerpc_pipe);
325 ctx->pipe = talloc_reference(ctx, r->out.dcerpc_pipe);
328 r->out.error_string = talloc_steal(mem_ctx, s->r.out.error_string);
337 struct rpc_connect_dci_state {
338 struct libnet_context *ctx;
339 struct libnet_RpcConnect r;
340 struct libnet_RpcConnect rpc_conn;
341 struct policy_handle lsa_handle;
342 struct lsa_QosInfo qos;
343 struct lsa_ObjectAttribute attr;
344 struct lsa_OpenPolicy2 lsa_open_policy;
345 struct dcerpc_pipe *lsa_pipe;
346 struct lsa_QueryInfoPolicy2 lsa_query_info2;
347 struct lsa_QueryInfoPolicy lsa_query_info;
348 struct dcerpc_binding *final_binding;
349 struct dcerpc_pipe *final_pipe;
353 static void continue_dci_rpc_connect(struct composite_context *ctx);
354 static void continue_lsa_policy(struct rpc_request *req);
355 static void continue_lsa_query_info(struct rpc_request *req);
356 static void continue_lsa_query_info2(struct rpc_request *req);
357 static void continue_epm_map_binding(struct composite_context *ctx);
358 static void continue_secondary_conn(struct composite_context *ctx);
362 * Initiates connection to rpc pipe on remote server or pdc. Received result
363 * contains info on the domain name, domain sid and realm.
365 * @param ctx initialised libnet context
366 * @param mem_ctx memory context of this call
367 * @param r data structure containing necessary parameters and return values. Must be a talloc context
368 * @return composite context of this call
371 static struct composite_context* libnet_RpcConnectDCInfo_send(struct libnet_context *ctx,
373 struct libnet_RpcConnect *r)
375 struct composite_context *c, *conn_req;
376 struct rpc_connect_dci_state *s;
378 /* composite context allocation and setup */
379 c = talloc_zero(mem_ctx, struct composite_context);
380 if (c == NULL) return NULL;
382 s = talloc_zero(c, struct rpc_connect_dci_state);
383 if (composite_nomem(s, c)) return c;
385 c->state = COMPOSITE_STATE_IN_PROGRESS;
387 c->event_ctx = ctx->event_ctx;
391 ZERO_STRUCT(s->r.out);
393 /* proceed to pure rpc connection if the binding string is provided,
394 otherwise try to connect domain controller */
395 if (r->in.binding == NULL) {
396 s->rpc_conn.in.name = r->in.name;
397 s->rpc_conn.level = LIBNET_RPC_CONNECT_DC;
399 s->rpc_conn.in.binding = r->in.binding;
400 s->rpc_conn.level = LIBNET_RPC_CONNECT_BINDING;
403 /* we need to query information on lsarpc interface first */
404 s->rpc_conn.in.dcerpc_iface = &dcerpc_table_lsarpc;
406 /* request connection to the lsa pipe on the pdc */
407 conn_req = libnet_RpcConnect_send(ctx, c, &s->rpc_conn);
408 if (composite_nomem(c, conn_req)) return c;
410 composite_continue(c, conn_req, continue_dci_rpc_connect, c);
416 Step 2 of RpcConnectDCInfo: receive opened rpc pipe and open
419 static void continue_dci_rpc_connect(struct composite_context *ctx)
421 struct composite_context *c;
422 struct rpc_connect_dci_state *s;
423 struct rpc_request *open_pol_req;
425 c = talloc_get_type(ctx->async.private_data, struct composite_context);
426 s = talloc_get_type(c->private_data, struct rpc_connect_dci_state);
428 c->status = libnet_RpcConnect_recv(ctx, s->ctx, c, &s->rpc_conn);
429 if (!NT_STATUS_IS_OK(c->status)) {
430 composite_error(c, c->status);
434 /* prepare to open a policy handle on lsa pipe */
435 s->lsa_pipe = s->ctx->pipe;
438 s->qos.impersonation_level = 2;
439 s->qos.context_mode = 1;
440 s->qos.effective_only = 0;
442 s->attr.sec_qos = &s->qos;
444 s->lsa_open_policy.in.attr = &s->attr;
445 s->lsa_open_policy.in.system_name = talloc_asprintf(c, "\\");
446 if (composite_nomem(s->lsa_open_policy.in.system_name, c)) return;
448 s->lsa_open_policy.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
449 s->lsa_open_policy.out.handle = &s->lsa_handle;
451 open_pol_req = dcerpc_lsa_OpenPolicy2_send(s->lsa_pipe, c, &s->lsa_open_policy);
452 if (composite_nomem(open_pol_req, c)) return;
454 composite_continue_rpc(c, open_pol_req, continue_lsa_policy, c);
459 Step 3 of RpcConnectDCInfo: Get policy handle and query lsa info
460 for kerberos realm (dns name) and guid. The query may fail.
462 static void continue_lsa_policy(struct rpc_request *req)
464 struct composite_context *c;
465 struct rpc_connect_dci_state *s;
466 struct rpc_request *query_info_req;
468 c = talloc_get_type(req->async.private, struct composite_context);
469 s = talloc_get_type(c->private_data, struct rpc_connect_dci_state);
471 c->status = dcerpc_ndr_request_recv(req);
472 if (!NT_STATUS_IS_OK(c->status)) {
473 composite_error(c, c->status);
477 /* query lsa info for dns domain name and guid */
478 s->lsa_query_info2.in.handle = &s->lsa_handle;
479 s->lsa_query_info2.in.level = LSA_POLICY_INFO_DNS;
481 query_info_req = dcerpc_lsa_QueryInfoPolicy2_send(s->lsa_pipe, c, &s->lsa_query_info2);
482 if (composite_nomem(query_info_req, c)) return;
484 composite_continue_rpc(c, query_info_req, continue_lsa_query_info2, c);
489 Step 4 of RpcConnectDCInfo: Get realm and guid if provided (rpc call
490 may result in failure) and query lsa info for domain name and sid.
492 static void continue_lsa_query_info2(struct rpc_request *req)
494 struct composite_context *c;
495 struct rpc_connect_dci_state *s;
496 struct rpc_request *query_info_req;
498 c = talloc_get_type(req->async.private, struct composite_context);
499 s = talloc_get_type(c->private_data, struct rpc_connect_dci_state);
501 c->status = dcerpc_ndr_request_recv(req);
503 /* In case of error just null the realm and guid and proceed
504 to the next step. After all, it doesn't have to be AD domain
505 controller we talking to - NT-style PDC also counts */
507 if (NT_STATUS_EQUAL(c->status, NT_STATUS_NET_WRITE_FAULT)) {
508 s->r.out.realm = NULL;
509 s->r.out.guid = NULL;
512 if (!NT_STATUS_IS_OK(c->status)) {
513 s->r.out.error_string = talloc_asprintf(c,
514 "lsa_QueryInfoPolicy2 failed: %s",
515 nt_errstr(c->status));
516 composite_error(c, c->status);
520 /* Copy the dns domain name and guid from the query result */
522 /* this should actually be a conversion from lsa_StringLarge */
523 s->r.out.realm = s->lsa_query_info2.out.info->dns.dns_domain.string;
524 s->r.out.guid = talloc(c, struct GUID);
525 if (composite_nomem(s->r.out.guid, c)) {
526 s->r.out.error_string = NULL;
529 *s->r.out.guid = s->lsa_query_info2.out.info->dns.domain_guid;
532 /* query lsa info for domain name and sid */
533 s->lsa_query_info.in.handle = &s->lsa_handle;
534 s->lsa_query_info.in.level = LSA_POLICY_INFO_DOMAIN;
536 query_info_req = dcerpc_lsa_QueryInfoPolicy_send(s->lsa_pipe, c, &s->lsa_query_info);
537 if (composite_nomem(query_info_req, c)) return;
539 composite_continue_rpc(c, query_info_req, continue_lsa_query_info, c);
544 Step 5 of RpcConnectDCInfo: Get domain name and sid and request endpoint
547 static void continue_lsa_query_info(struct rpc_request *req)
549 struct composite_context *c, *epm_map_req;
550 struct rpc_connect_dci_state *s;
552 c = talloc_get_type(req->async.private, struct composite_context);
553 s = talloc_get_type(c->private_data, struct rpc_connect_dci_state);
555 c->status = dcerpc_ndr_request_recv(req);
556 if (!NT_STATUS_IS_OK(c->status)) {
557 s->r.out.error_string = talloc_asprintf(c,
558 "lsa_QueryInfoPolicy failed: %s",
559 nt_errstr(c->status));
560 composite_error(c, c->status);
564 /* Copy the domain name and sid from the query result */
565 s->r.out.domain_sid = s->lsa_query_info.out.info->domain.sid;
566 s->r.out.domain_name = s->lsa_query_info.out.info->domain.name.string;
569 /* prepare to get endpoint mapping for the requested interface */
570 s->final_binding = talloc(s, struct dcerpc_binding);
571 if (composite_nomem(s->final_binding, c)) return;
573 *s->final_binding = *s->lsa_pipe->binding;
574 /* Ensure we keep hold of the member elements */
575 talloc_reference(s->final_binding, s->lsa_pipe->binding);
577 epm_map_req = dcerpc_epm_map_binding_send(c, s->final_binding, s->r.in.dcerpc_iface,
578 s->lsa_pipe->conn->event_ctx);
579 if (composite_nomem(epm_map_req, c)) return;
581 composite_continue(c, epm_map_req, continue_epm_map_binding, c);
586 Step 6 of RpcConnectDCInfo: Receive endpoint mapping and create secondary
587 rpc connection derived from already used pipe but connected to the requested
588 one (as specified in libnet_RpcConnect structure)
590 static void continue_epm_map_binding(struct composite_context *ctx)
592 struct composite_context *c, *sec_conn_req;
593 struct rpc_connect_dci_state *s;
595 c = talloc_get_type(ctx->async.private_data, struct composite_context);
596 s = talloc_get_type(c->private_data, struct rpc_connect_dci_state);
598 c->status = dcerpc_epm_map_binding_recv(ctx);
599 if (!NT_STATUS_IS_OK(c->status)) {
600 s->r.out.error_string = talloc_asprintf(c,
601 "failed to map pipe with endpoint mapper - %s",
602 nt_errstr(c->status));
603 composite_error(c, c->status);
607 /* create secondary connection derived from lsa pipe */
608 sec_conn_req = dcerpc_secondary_connection_send(s->lsa_pipe, s->final_binding);
609 if (composite_nomem(sec_conn_req, c)) return;
611 composite_continue(c, sec_conn_req, continue_secondary_conn, c);
616 Step 7 of RpcConnectDCInfo: Get actual lsa pipe to be returned
617 and complete this composite call
619 static void continue_secondary_conn(struct composite_context *ctx)
621 struct composite_context *c;
622 struct rpc_connect_dci_state *s;
624 c = talloc_get_type(ctx->async.private_data, struct composite_context);
625 s = talloc_get_type(c->private_data, struct rpc_connect_dci_state);
627 c->status = dcerpc_secondary_connection_recv(ctx, &s->final_pipe);
628 if (!NT_STATUS_IS_OK(c->status)) {
629 s->r.out.error_string = talloc_asprintf(c,
630 "secondary connection failed: %s",
631 nt_errstr(c->status));
633 composite_error(c, c->status);
637 s->r.out.dcerpc_pipe = s->final_pipe;
643 * Receives result of connection to rpc pipe and gets basic
644 * domain info (name, sid, realm, guid)
646 * @param c composite context
647 * @param ctx initialised libnet context
648 * @param mem_ctx memory context of this call
649 * @param r data structure containing return values
650 * @return nt status of rpc connection
653 static NTSTATUS libnet_RpcConnectDCInfo_recv(struct composite_context *c, struct libnet_context *ctx,
654 TALLOC_CTX *mem_ctx, struct libnet_RpcConnect *r)
657 struct rpc_connect_dci_state *s = talloc_get_type(c->private_data,
658 struct rpc_connect_dci_state);
660 status = composite_wait(c);
661 if (NT_STATUS_IS_OK(status)) {
662 r->out.realm = talloc_steal(mem_ctx, s->r.out.realm);
663 r->out.guid = talloc_steal(mem_ctx, s->r.out.guid);
664 r->out.domain_name = talloc_steal(mem_ctx, s->r.out.domain_name);
665 r->out.domain_sid = talloc_steal(mem_ctx, s->r.out.domain_sid);
667 r->out.dcerpc_pipe = talloc_steal(mem_ctx, s->r.out.dcerpc_pipe);
669 /* reference created pipe structure to long-term libnet_context
670 so that it can be used by other api functions even after short-term
672 if (r->in.dcerpc_iface == &dcerpc_table_samr) {
673 ctx->samr_pipe = talloc_reference(ctx, r->out.dcerpc_pipe);
675 ctx->pipe = talloc_reference(ctx, r->out.dcerpc_pipe);
678 r->out.error_string = talloc_steal(mem_ctx, s->r.out.error_string);
687 * Initiates connection to rpc pipe on remote server or pdc, optionally
688 * providing domain info
690 * @param ctx initialised libnet context
691 * @param mem_ctx memory context of this call
692 * @param r data structure containing necessary parameters and return values
693 * @return composite context of this call
696 struct composite_context* libnet_RpcConnect_send(struct libnet_context *ctx,
698 struct libnet_RpcConnect *r)
700 struct composite_context *c;
703 case LIBNET_RPC_CONNECT_SERVER:
704 case LIBNET_RPC_CONNECT_BINDING:
705 c = libnet_RpcConnectSrv_send(ctx, mem_ctx, r);
708 case LIBNET_RPC_CONNECT_PDC:
709 case LIBNET_RPC_CONNECT_DC:
710 c = libnet_RpcConnectDC_send(ctx, mem_ctx, r);
713 case LIBNET_RPC_CONNECT_DC_INFO:
714 c = libnet_RpcConnectDCInfo_send(ctx, mem_ctx, r);
718 c = talloc_zero(mem_ctx, struct composite_context);
719 composite_error(c, NT_STATUS_INVALID_LEVEL);
727 * Receives result of connection to rpc pipe on remote server or pdc
729 * @param c composite context
730 * @param ctx initialised libnet context
731 * @param mem_ctx memory context of this call
732 * @param r data structure containing necessary parameters and return values
733 * @return nt status of rpc connection
736 NTSTATUS libnet_RpcConnect_recv(struct composite_context *c, struct libnet_context *ctx,
737 TALLOC_CTX *mem_ctx, struct libnet_RpcConnect *r)
740 case LIBNET_RPC_CONNECT_SERVER:
741 case LIBNET_RPC_CONNECT_BINDING:
742 return libnet_RpcConnectSrv_recv(c, ctx, mem_ctx, r);
744 case LIBNET_RPC_CONNECT_PDC:
745 case LIBNET_RPC_CONNECT_DC:
746 return libnet_RpcConnectDC_recv(c, ctx, mem_ctx, r);
748 case LIBNET_RPC_CONNECT_DC_INFO:
749 return libnet_RpcConnectDCInfo_recv(c, ctx, mem_ctx, r);
753 return NT_STATUS_INVALID_LEVEL;
759 * Connect to a rpc pipe on a remote server - sync version
761 * @param ctx initialised libnet context
762 * @param mem_ctx memory context of this call
763 * @param r data structure containing necessary parameters and return values
764 * @return nt status of rpc connection
767 NTSTATUS libnet_RpcConnect(struct libnet_context *ctx, TALLOC_CTX *mem_ctx,
768 struct libnet_RpcConnect *r)
770 struct composite_context *c;
772 c = libnet_RpcConnect_send(ctx, mem_ctx, r);
773 return libnet_RpcConnect_recv(c, ctx, mem_ctx, r);