summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2011-08-18 19:05:10 +0200
committerSimo Sorce <idra@samba.org>2011-08-21 09:05:07 -0400
commitb501f6f75823b98ac349affe8e6e1bd7ba76cd3e (patch)
tree80661613bb4ef7df7ab3f57bc9027bcf52a20ff1 /source3/rpc_server
parent8a1572fe1bd1a7a3bb8985a12a738d49cb7d274b (diff)
downloadsamba-b501f6f75823b98ac349affe8e6e1bd7ba76cd3e.tar.gz
samba-b501f6f75823b98ac349affe8e6e1bd7ba76cd3e.tar.bz2
samba-b501f6f75823b98ac349affe8e6e1bd7ba76cd3e.zip
s3-rpc_server: Add create_dcerpc_ncalrpc_socket().
Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Simo Sorce <idra@samba.org>
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/rpc_server.c40
-rw-r--r--source3/rpc_server/rpc_server.h1
2 files changed, 29 insertions, 12 deletions
diff --git a/source3/rpc_server/rpc_server.c b/source3/rpc_server/rpc_server.c
index 43f1b3d605..c995e22ea0 100644
--- a/source3/rpc_server/rpc_server.c
+++ b/source3/rpc_server/rpc_server.c
@@ -819,6 +819,32 @@ static void dcerpc_ncalrpc_listener(struct tevent_context *ev,
uint16_t flags,
void *private_data);
+int create_dcerpc_ncalrpc_socket(const char *name)
+{
+ int fd = -1;
+
+ if (name == NULL) {
+ name = "DEFAULT";
+ }
+
+ if (!directory_create_or_exist(lp_ncalrpc_dir(), geteuid(), 0755)) {
+ DEBUG(0, ("Failed to create ncalrpc directory %s - %s\n",
+ lp_ncalrpc_dir(), strerror(errno)));
+ return -1;
+ }
+
+ fd = create_pipe_sock(lp_ncalrpc_dir(), name, 0755);
+ if (fd == -1) {
+ DEBUG(0, ("Failed to create ncalrpc socket! [%s/%s]\n",
+ lp_ncalrpc_dir(), name));
+ return -1;
+ }
+
+ DEBUG(10, ("Openened ncalrpc socket fd %d for %s\n", fd, name));
+
+ return fd;
+}
+
bool setup_dcerpc_ncalrpc_socket(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx,
const char *name,
@@ -839,29 +865,19 @@ bool setup_dcerpc_ncalrpc_socket(struct tevent_context *ev_ctx,
if (name == NULL) {
name = "DEFAULT";
}
- state->ep.name = talloc_strdup(state, name);
+ state->ep.name = talloc_strdup(state, name);
if (state->ep.name == NULL) {
DEBUG(0, ("Out of memory\n"));
talloc_free(state);
return false;
}
- if (!directory_create_or_exist(lp_ncalrpc_dir(), geteuid(), 0755)) {
- DEBUG(0, ("Failed to create pipe directory %s - %s\n",
- lp_ncalrpc_dir(), strerror(errno)));
- goto out;
- }
-
- state->fd = create_pipe_sock(lp_ncalrpc_dir(), name, 0755);
+ state->fd = create_dcerpc_ncalrpc_socket(name);
if (state->fd == -1) {
- DEBUG(0, ("Failed to create pipe socket! [%s/%s]\n",
- lp_ncalrpc_dir(), name));
goto out;
}
- DEBUG(10, ("Openened pipe socket fd %d for %s\n", state->fd, name));
-
state->ev_ctx = ev_ctx;
state->msg_ctx = msg_ctx;
diff --git a/source3/rpc_server/rpc_server.h b/source3/rpc_server/rpc_server.h
index d29ae1599e..5d8ee6a816 100644
--- a/source3/rpc_server/rpc_server.h
+++ b/source3/rpc_server/rpc_server.h
@@ -43,6 +43,7 @@ uint16_t setup_dcerpc_ncacn_tcpip_socket(struct tevent_context *ev_ctx,
const struct sockaddr_storage *ifss,
uint16_t port);
+int create_dcerpc_ncalrpc_socket(const char *name);
bool setup_dcerpc_ncalrpc_socket(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx,
const char *name,