2 Unix SMB/CIFS implementation.
4 smbd-specific dcerpc server code
6 Copyright (C) Andrew Tridgell 2003-2005
7 Copyright (C) Stefan (metze) Metzmacher 2004-2005
8 Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2004,2007
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 3 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
25 #include "librpc/gen_ndr/ndr_dcerpc.h"
26 #include "auth/auth.h"
27 #include "auth/gensec/gensec.h"
28 #include "../lib/util/dlinklist.h"
29 #include "rpc_server/dcerpc_server.h"
30 #include "rpc_server/dcerpc_server_proto.h"
31 #include "rpc_server/service_rpc.h"
32 #include "lib/events/events.h"
33 #include "smbd/service_task.h"
34 #include "smbd/service_stream.h"
35 #include "smbd/service.h"
36 #include "system/filesys.h"
37 #include "libcli/security/security.h"
38 #include "lib/socket/socket.h"
39 #include "lib/messaging/irpc.h"
40 #include "system/network.h"
41 #include "lib/socket/netif.h"
42 #include "param/param.h"
43 #include "../lib/tsocket/tsocket.h"
44 #include "librpc/rpc/dcerpc_proto.h"
45 #include "../lib/util/tevent_ntstatus.h"
46 #include "libcli/raw/smb.h"
47 #include "../libcli/named_pipe_auth/npa_tstream.h"
49 struct dcesrv_socket_context
{
50 const struct dcesrv_endpoint
*endpoint
;
51 struct dcesrv_context
*dcesrv_ctx
;
54 static void dcesrv_terminate_connection(struct dcesrv_connection
*dce_conn
, const char *reason
)
56 struct stream_connection
*srv_conn
;
57 srv_conn
= talloc_get_type(dce_conn
->transport
.private_data
,
58 struct stream_connection
);
60 stream_terminate_connection(srv_conn
, reason
);
63 static void dcesrv_sock_reply_done(struct tevent_req
*subreq
);
65 struct dcesrv_sock_reply_state
{
66 struct dcesrv_connection
*dce_conn
;
67 struct dcesrv_call_state
*call
;
71 static void dcesrv_sock_report_output_data(struct dcesrv_connection
*dce_conn
)
73 struct dcesrv_call_state
*call
;
75 call
= dce_conn
->call_list
;
76 if (!call
|| !call
->replies
) {
80 while (call
->replies
) {
81 struct data_blob_list_item
*rep
= call
->replies
;
82 struct dcesrv_sock_reply_state
*substate
;
83 struct tevent_req
*subreq
;
85 substate
= talloc(call
, struct dcesrv_sock_reply_state
);
87 dcesrv_terminate_connection(dce_conn
, "no memory");
91 substate
->dce_conn
= dce_conn
;
92 substate
->call
= NULL
;
94 DLIST_REMOVE(call
->replies
, rep
);
96 if (call
->replies
== NULL
) {
97 substate
->call
= call
;
100 substate
->iov
.iov_base
= rep
->blob
.data
;
101 substate
->iov
.iov_len
= rep
->blob
.length
;
103 subreq
= tstream_writev_queue_send(substate
,
106 dce_conn
->send_queue
,
109 dcesrv_terminate_connection(dce_conn
, "no memory");
112 tevent_req_set_callback(subreq
, dcesrv_sock_reply_done
,
116 DLIST_REMOVE(call
->conn
->call_list
, call
);
117 call
->list
= DCESRV_LIST_NONE
;
120 static void dcesrv_sock_reply_done(struct tevent_req
*subreq
)
122 struct dcesrv_sock_reply_state
*substate
= tevent_req_callback_data(subreq
,
123 struct dcesrv_sock_reply_state
);
127 struct dcesrv_call_state
*call
= substate
->call
;
129 ret
= tstream_writev_queue_recv(subreq
, &sys_errno
);
132 status
= map_nt_error_from_unix(sys_errno
);
133 dcesrv_terminate_connection(substate
->dce_conn
, nt_errstr(status
));
137 talloc_free(substate
);
143 static struct socket_address
*dcesrv_sock_get_my_addr(struct dcesrv_connection
*dcesrv_conn
, TALLOC_CTX
*mem_ctx
)
145 struct stream_connection
*srv_conn
;
146 srv_conn
= talloc_get_type(dcesrv_conn
->transport
.private_data
,
147 struct stream_connection
);
149 return socket_get_my_addr(srv_conn
->socket
, mem_ctx
);
152 static struct socket_address
*dcesrv_sock_get_peer_addr(struct dcesrv_connection
*dcesrv_conn
, TALLOC_CTX
*mem_ctx
)
154 struct stream_connection
*srv_conn
;
155 srv_conn
= talloc_get_type(dcesrv_conn
->transport
.private_data
,
156 struct stream_connection
);
158 return socket_get_peer_addr(srv_conn
->socket
, mem_ctx
);
161 struct dcerpc_read_ncacn_packet_state
{
163 struct smb_iconv_convenience
*smb_iconv_c
;
166 struct ncacn_packet
*pkt
;
169 static int dcerpc_read_ncacn_packet_next_vector(struct tstream_context
*stream
,
172 struct iovec
**_vector
,
174 static void dcerpc_read_ncacn_packet_done(struct tevent_req
*subreq
);
176 static struct tevent_req
*dcerpc_read_ncacn_packet_send(TALLOC_CTX
*mem_ctx
,
177 struct tevent_context
*ev
,
178 struct tstream_context
*stream
,
179 struct smb_iconv_convenience
*ic
)
181 struct tevent_req
*req
;
182 struct dcerpc_read_ncacn_packet_state
*state
;
183 struct tevent_req
*subreq
;
185 req
= tevent_req_create(mem_ctx
, &state
,
186 struct dcerpc_read_ncacn_packet_state
);
191 state
->caller
.smb_iconv_c
= ic
;
192 state
->buffer
= data_blob_const(NULL
, 0);
193 state
->pkt
= talloc(state
, struct ncacn_packet
);
194 if (tevent_req_nomem(state
->pkt
, req
)) {
198 subreq
= tstream_readv_pdu_send(state
, ev
,
200 dcerpc_read_ncacn_packet_next_vector
,
202 if (tevent_req_nomem(subreq
, req
)) {
205 tevent_req_set_callback(subreq
, dcerpc_read_ncacn_packet_done
, req
);
209 tevent_req_post(req
, ev
);
213 static int dcerpc_read_ncacn_packet_next_vector(struct tstream_context
*stream
,
216 struct iovec
**_vector
,
219 struct dcerpc_read_ncacn_packet_state
*state
=
220 talloc_get_type_abort(private_data
,
221 struct dcerpc_read_ncacn_packet_state
);
222 struct iovec
*vector
;
225 if (state
->buffer
.length
== 0) {
226 /* first get enough to read the fragment length */
228 state
->buffer
.length
= DCERPC_FRAG_LEN_OFFSET
+ 2;
229 state
->buffer
.data
= talloc_array(state
, uint8_t,
230 state
->buffer
.length
);
231 if (!state
->buffer
.data
) {
234 } else if (state
->buffer
.length
== (DCERPC_FRAG_LEN_OFFSET
+ 2)) {
235 /* now read the fragment length and allocate the full buffer */
236 size_t frag_len
= dcerpc_get_frag_length(&state
->buffer
);
238 ofs
= state
->buffer
.length
;
240 state
->buffer
.data
= talloc_realloc(state
,
243 if (!state
->buffer
.data
) {
246 state
->buffer
.length
= frag_len
;
248 /* if we reach this we have a full fragment */
254 /* now create the vector that we want to be filled */
255 vector
= talloc_array(mem_ctx
, struct iovec
, 1);
260 vector
[0].iov_base
= state
->buffer
.data
+ ofs
;
261 vector
[0].iov_len
= state
->buffer
.length
- ofs
;
268 static void dcerpc_read_ncacn_packet_done(struct tevent_req
*subreq
)
270 struct tevent_req
*req
= tevent_req_callback_data(subreq
,
272 struct dcerpc_read_ncacn_packet_state
*state
= tevent_req_data(req
,
273 struct dcerpc_read_ncacn_packet_state
);
276 struct ndr_pull
*ndr
;
277 enum ndr_err_code ndr_err
;
280 ret
= tstream_readv_pdu_recv(subreq
, &sys_errno
);
283 status
= map_nt_error_from_unix(sys_errno
);
284 tevent_req_nterror(req
, status
);
288 ndr
= ndr_pull_init_blob(&state
->buffer
,
290 state
->caller
.smb_iconv_c
);
291 if (tevent_req_nomem(ndr
, req
)) {
295 if (!(CVAL(ndr
->data
, DCERPC_DREP_OFFSET
) & DCERPC_DREP_LE
)) {
296 ndr
->flags
|= LIBNDR_FLAG_BIGENDIAN
;
299 if (CVAL(ndr
->data
, DCERPC_PFC_OFFSET
) & DCERPC_PFC_FLAG_OBJECT_UUID
) {
300 ndr
->flags
|= LIBNDR_FLAG_OBJECT_PRESENT
;
303 ndr_err
= ndr_pull_ncacn_packet(ndr
, NDR_SCALARS
|NDR_BUFFERS
, state
->pkt
);
305 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err
)) {
306 status
= ndr_map_error2ntstatus(ndr_err
);
307 tevent_req_nterror(req
, status
);
311 tevent_req_done(req
);
314 static NTSTATUS
dcerpc_read_ncacn_packet_recv(struct tevent_req
*req
,
316 struct ncacn_packet
**pkt
,
319 struct dcerpc_read_ncacn_packet_state
*state
= tevent_req_data(req
,
320 struct dcerpc_read_ncacn_packet_state
);
323 if (tevent_req_is_nterror(req
, &status
)) {
324 tevent_req_received(req
);
328 *pkt
= talloc_move(mem_ctx
, &state
->pkt
);
330 buffer
->data
= talloc_move(mem_ctx
, &state
->buffer
.data
);
331 buffer
->length
= state
->buffer
.length
;
334 tevent_req_received(req
);
338 static void dcesrv_read_fragment_done(struct tevent_req
*subreq
);
340 static void dcesrv_sock_accept(struct stream_connection
*srv_conn
)
343 struct dcesrv_socket_context
*dcesrv_sock
=
344 talloc_get_type(srv_conn
->private_data
, struct dcesrv_socket_context
);
345 struct dcesrv_connection
*dcesrv_conn
= NULL
;
347 struct tevent_req
*subreq
;
348 struct loadparm_context
*lp_ctx
= dcesrv_sock
->dcesrv_ctx
->lp_ctx
;
350 if (!srv_conn
->session_info
) {
351 status
= auth_anonymous_session_info(srv_conn
,
354 &srv_conn
->session_info
);
355 if (!NT_STATUS_IS_OK(status
)) {
356 DEBUG(0,("dcesrv_sock_accept: auth_anonymous_session_info failed: %s\n",
358 stream_terminate_connection(srv_conn
, nt_errstr(status
));
363 status
= dcesrv_endpoint_connect(dcesrv_sock
->dcesrv_ctx
,
365 dcesrv_sock
->endpoint
,
366 srv_conn
->session_info
,
370 DCESRV_CALL_STATE_FLAG_MAY_ASYNC
,
372 if (!NT_STATUS_IS_OK(status
)) {
373 DEBUG(0,("dcesrv_sock_accept: dcesrv_endpoint_connect failed: %s\n",
375 stream_terminate_connection(srv_conn
, nt_errstr(status
));
379 dcesrv_conn
->transport
.private_data
= srv_conn
;
380 dcesrv_conn
->transport
.report_output_data
= dcesrv_sock_report_output_data
;
381 dcesrv_conn
->transport
.get_my_addr
= dcesrv_sock_get_my_addr
;
382 dcesrv_conn
->transport
.get_peer_addr
= dcesrv_sock_get_peer_addr
;
384 TALLOC_FREE(srv_conn
->event
.fde
);
386 dcesrv_conn
->send_queue
= tevent_queue_create(dcesrv_conn
, "dcesrv send queue");
387 if (!dcesrv_conn
->send_queue
) {
388 status
= NT_STATUS_NO_MEMORY
;
389 DEBUG(0,("dcesrv_sock_accept: tevent_queue_create(%s)\n",
391 stream_terminate_connection(srv_conn
, nt_errstr(status
));
395 if (dcesrv_sock
->endpoint
->ep_description
->transport
== NCACN_NP
) {
396 dcesrv_conn
->auth_state
.session_key
= dcesrv_inherited_session_key
;
397 ret
= tstream_npa_existing_socket(dcesrv_conn
,
398 socket_get_fd(srv_conn
->socket
),
399 FILE_TYPE_MESSAGE_MODE_PIPE
,
400 &dcesrv_conn
->stream
);
402 ret
= tstream_bsd_existing_socket(dcesrv_conn
,
403 socket_get_fd(srv_conn
->socket
),
404 &dcesrv_conn
->stream
);
407 status
= map_nt_error_from_unix(errno
);
408 DEBUG(0,("dcesrv_sock_accept: failed to setup tstream: %s\n",
410 stream_terminate_connection(srv_conn
, nt_errstr(status
));
414 srv_conn
->private_data
= dcesrv_conn
;
416 irpc_add_name(srv_conn
->msg_ctx
, "rpc_server");
418 subreq
= dcerpc_read_ncacn_packet_send(dcesrv_conn
,
419 dcesrv_conn
->event_ctx
,
421 lp_iconv_convenience(lp_ctx
));
423 status
= NT_STATUS_NO_MEMORY
;
424 DEBUG(0,("dcesrv_sock_accept: dcerpc_read_fragment_buffer_send(%s)\n",
426 stream_terminate_connection(srv_conn
, nt_errstr(status
));
429 tevent_req_set_callback(subreq
, dcesrv_read_fragment_done
, dcesrv_conn
);
434 static void dcesrv_read_fragment_done(struct tevent_req
*subreq
)
436 struct dcesrv_connection
*dce_conn
= tevent_req_callback_data(subreq
,
437 struct dcesrv_connection
);
438 struct ncacn_packet
*pkt
;
441 struct loadparm_context
*lp_ctx
= dce_conn
->dce_ctx
->lp_ctx
;
443 status
= dcerpc_read_ncacn_packet_recv(subreq
, dce_conn
,
446 if (!NT_STATUS_IS_OK(status
)) {
447 dcesrv_terminate_connection(dce_conn
, nt_errstr(status
));
451 status
= dcesrv_process_ncacn_packet(dce_conn
, pkt
, buffer
);
452 if (!NT_STATUS_IS_OK(status
)) {
453 dcesrv_terminate_connection(dce_conn
, nt_errstr(status
));
457 subreq
= dcerpc_read_ncacn_packet_send(dce_conn
,
460 lp_iconv_convenience(lp_ctx
));
462 status
= NT_STATUS_NO_MEMORY
;
463 dcesrv_terminate_connection(dce_conn
, nt_errstr(status
));
466 tevent_req_set_callback(subreq
, dcesrv_read_fragment_done
, dce_conn
);
469 static void dcesrv_sock_recv(struct stream_connection
*conn
, uint16_t flags
)
471 struct dcesrv_connection
*dce_conn
= talloc_get_type(conn
->private_data
,
472 struct dcesrv_connection
);
473 dcesrv_terminate_connection(dce_conn
, "dcesrv_sock_recv triggered");
476 static void dcesrv_sock_send(struct stream_connection
*conn
, uint16_t flags
)
478 struct dcesrv_connection
*dce_conn
= talloc_get_type(conn
->private_data
,
479 struct dcesrv_connection
);
480 dcesrv_terminate_connection(dce_conn
, "dcesrv_sock_send triggered");
484 static const struct stream_server_ops dcesrv_stream_ops
= {
486 .accept_connection
= dcesrv_sock_accept
,
487 .recv_handler
= dcesrv_sock_recv
,
488 .send_handler
= dcesrv_sock_send
,
493 static NTSTATUS
dcesrv_add_ep_unix(struct dcesrv_context
*dce_ctx
,
494 struct loadparm_context
*lp_ctx
,
495 struct dcesrv_endpoint
*e
,
496 struct tevent_context
*event_ctx
, const struct model_ops
*model_ops
)
498 struct dcesrv_socket_context
*dcesrv_sock
;
502 dcesrv_sock
= talloc(event_ctx
, struct dcesrv_socket_context
);
503 NT_STATUS_HAVE_NO_MEMORY(dcesrv_sock
);
505 /* remember the endpoint of this socket */
506 dcesrv_sock
->endpoint
= e
;
507 dcesrv_sock
->dcesrv_ctx
= talloc_reference(dcesrv_sock
, dce_ctx
);
509 status
= stream_setup_socket(event_ctx
, lp_ctx
,
510 model_ops
, &dcesrv_stream_ops
,
511 "unix", e
->ep_description
->endpoint
, &port
,
512 lp_socket_options(lp_ctx
),
514 if (!NT_STATUS_IS_OK(status
)) {
515 DEBUG(0,("service_setup_stream_socket(path=%s) failed - %s\n",
516 e
->ep_description
->endpoint
, nt_errstr(status
)));
522 static NTSTATUS
dcesrv_add_ep_ncalrpc(struct dcesrv_context
*dce_ctx
,
523 struct loadparm_context
*lp_ctx
,
524 struct dcesrv_endpoint
*e
,
525 struct tevent_context
*event_ctx
, const struct model_ops
*model_ops
)
527 struct dcesrv_socket_context
*dcesrv_sock
;
532 if (!e
->ep_description
->endpoint
) {
533 /* No identifier specified: use DEFAULT.
534 * DO NOT hardcode this value anywhere else. Rather, specify
535 * no endpoint and let the epmapper worry about it. */
536 e
->ep_description
->endpoint
= talloc_strdup(dce_ctx
, "DEFAULT");
539 full_path
= talloc_asprintf(dce_ctx
, "%s/%s", lp_ncalrpc_dir(lp_ctx
),
540 e
->ep_description
->endpoint
);
542 dcesrv_sock
= talloc(event_ctx
, struct dcesrv_socket_context
);
543 NT_STATUS_HAVE_NO_MEMORY(dcesrv_sock
);
545 /* remember the endpoint of this socket */
546 dcesrv_sock
->endpoint
= e
;
547 dcesrv_sock
->dcesrv_ctx
= talloc_reference(dcesrv_sock
, dce_ctx
);
549 status
= stream_setup_socket(event_ctx
, lp_ctx
,
550 model_ops
, &dcesrv_stream_ops
,
551 "unix", full_path
, &port
,
552 lp_socket_options(lp_ctx
),
554 if (!NT_STATUS_IS_OK(status
)) {
555 DEBUG(0,("service_setup_stream_socket(identifier=%s,path=%s) failed - %s\n",
556 e
->ep_description
->endpoint
, full_path
, nt_errstr(status
)));
561 static NTSTATUS
dcesrv_add_ep_np(struct dcesrv_context
*dce_ctx
,
562 struct loadparm_context
*lp_ctx
,
563 struct dcesrv_endpoint
*e
,
564 struct tevent_context
*event_ctx
, const struct model_ops
*model_ops
)
566 struct dcesrv_socket_context
*dcesrv_sock
;
569 if (e
->ep_description
->endpoint
== NULL
) {
570 DEBUG(0, ("Endpoint mandatory for named pipes\n"));
571 return NT_STATUS_INVALID_PARAMETER
;
574 dcesrv_sock
= talloc(event_ctx
, struct dcesrv_socket_context
);
575 NT_STATUS_HAVE_NO_MEMORY(dcesrv_sock
);
577 /* remember the endpoint of this socket */
578 dcesrv_sock
->endpoint
= e
;
579 dcesrv_sock
->dcesrv_ctx
= talloc_reference(dcesrv_sock
, dce_ctx
);
581 status
= stream_setup_named_pipe(event_ctx
, lp_ctx
,
582 model_ops
, &dcesrv_stream_ops
,
583 e
->ep_description
->endpoint
, dcesrv_sock
);
584 if (!NT_STATUS_IS_OK(status
)) {
585 DEBUG(0,("stream_setup_named_pipe(pipe=%s) failed - %s\n",
586 e
->ep_description
->endpoint
, nt_errstr(status
)));
594 add a socket address to the list of events, one event per dcerpc endpoint
596 static NTSTATUS
add_socket_rpc_tcp_iface(struct dcesrv_context
*dce_ctx
, struct dcesrv_endpoint
*e
,
597 struct tevent_context
*event_ctx
, const struct model_ops
*model_ops
,
600 struct dcesrv_socket_context
*dcesrv_sock
;
604 if (e
->ep_description
->endpoint
) {
605 port
= atoi(e
->ep_description
->endpoint
);
608 dcesrv_sock
= talloc(event_ctx
, struct dcesrv_socket_context
);
609 NT_STATUS_HAVE_NO_MEMORY(dcesrv_sock
);
611 /* remember the endpoint of this socket */
612 dcesrv_sock
->endpoint
= e
;
613 dcesrv_sock
->dcesrv_ctx
= talloc_reference(dcesrv_sock
, dce_ctx
);
615 status
= stream_setup_socket(event_ctx
, dce_ctx
->lp_ctx
,
616 model_ops
, &dcesrv_stream_ops
,
617 "ipv4", address
, &port
,
618 lp_socket_options(dce_ctx
->lp_ctx
),
620 if (!NT_STATUS_IS_OK(status
)) {
621 DEBUG(0,("service_setup_stream_socket(address=%s,port=%u) failed - %s\n",
622 address
, port
, nt_errstr(status
)));
625 if (e
->ep_description
->endpoint
== NULL
) {
626 e
->ep_description
->endpoint
= talloc_asprintf(dce_ctx
, "%d", port
);
632 static NTSTATUS
dcesrv_add_ep_tcp(struct dcesrv_context
*dce_ctx
,
633 struct loadparm_context
*lp_ctx
,
634 struct dcesrv_endpoint
*e
,
635 struct tevent_context
*event_ctx
, const struct model_ops
*model_ops
)
639 /* Add TCP/IP sockets */
640 if (lp_interfaces(lp_ctx
) && lp_bind_interfaces_only(lp_ctx
)) {
643 struct interface
*ifaces
;
645 load_interfaces(dce_ctx
, lp_interfaces(lp_ctx
), &ifaces
);
647 num_interfaces
= iface_count(ifaces
);
648 for(i
= 0; i
< num_interfaces
; i
++) {
649 const char *address
= iface_n_ip(ifaces
, i
);
650 status
= add_socket_rpc_tcp_iface(dce_ctx
, e
, event_ctx
, model_ops
, address
);
651 NT_STATUS_NOT_OK_RETURN(status
);
654 status
= add_socket_rpc_tcp_iface(dce_ctx
, e
, event_ctx
, model_ops
,
655 lp_socket_address(lp_ctx
));
656 NT_STATUS_NOT_OK_RETURN(status
);
662 NTSTATUS
dcesrv_add_ep(struct dcesrv_context
*dce_ctx
,
663 struct loadparm_context
*lp_ctx
,
664 struct dcesrv_endpoint
*e
,
665 struct tevent_context
*event_ctx
,
666 const struct model_ops
*model_ops
)
668 switch (e
->ep_description
->transport
) {
669 case NCACN_UNIX_STREAM
:
670 return dcesrv_add_ep_unix(dce_ctx
, lp_ctx
, e
, event_ctx
, model_ops
);
673 return dcesrv_add_ep_ncalrpc(dce_ctx
, lp_ctx
, e
, event_ctx
, model_ops
);
676 return dcesrv_add_ep_tcp(dce_ctx
, lp_ctx
, e
, event_ctx
, model_ops
);
679 return dcesrv_add_ep_np(dce_ctx
, lp_ctx
, e
, event_ctx
, model_ops
);
682 return NT_STATUS_NOT_SUPPORTED
;
687 open the dcerpc server sockets
689 static void dcesrv_task_init(struct task_server
*task
)
692 struct dcesrv_context
*dce_ctx
;
693 struct dcesrv_endpoint
*e
;
695 dcerpc_server_init(task
->lp_ctx
);
697 task_server_set_title(task
, "task[dcesrv]");
699 status
= dcesrv_init_context(task
->event_ctx
,
701 lp_dcerpc_endpoint_servers(task
->lp_ctx
),
703 if (!NT_STATUS_IS_OK(status
)) goto failed
;
705 /* Make sure the directory for NCALRPC exists */
706 if (!directory_exist(lp_ncalrpc_dir(task
->lp_ctx
))) {
707 mkdir(lp_ncalrpc_dir(task
->lp_ctx
), 0755);
710 for (e
=dce_ctx
->endpoint_list
;e
;e
=e
->next
) {
711 status
= dcesrv_add_ep(dce_ctx
, task
->lp_ctx
, e
, task
->event_ctx
, task
->model_ops
);
712 if (!NT_STATUS_IS_OK(status
)) goto failed
;
717 task_server_terminate(task
, "Failed to startup dcerpc server task", true);
720 NTSTATUS
server_service_rpc_init(void)
723 return register_server_service("rpc", dcesrv_task_init
);