mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
s3:rpc_server: Return NTSTATUS for dcesrv_create_ncalrpc_socket
Signed-off-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
parent
c0b1884c99
commit
3153814db4
@ -655,8 +655,8 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx,
|
||||
listen_fd[*listen_fd_size] = fd;
|
||||
(*listen_fd_size)++;
|
||||
|
||||
fd = dcesrv_create_ncalrpc_socket("lsarpc");
|
||||
if (fd < 0) {
|
||||
status = dcesrv_create_ncalrpc_socket("lsarpc", &fd);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -710,8 +710,8 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx,
|
||||
listen_fd[*listen_fd_size] = fd;
|
||||
(*listen_fd_size)++;
|
||||
|
||||
fd = dcesrv_create_ncalrpc_socket("samr");
|
||||
if (fd < 0) {
|
||||
status = dcesrv_create_ncalrpc_socket("samr", &fd);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -765,8 +765,8 @@ static bool lsasd_create_sockets(struct tevent_context *ev_ctx,
|
||||
listen_fd[*listen_fd_size] = fd;
|
||||
(*listen_fd_size)++;
|
||||
|
||||
fd = dcesrv_create_ncalrpc_socket("netlogon");
|
||||
if (fd < 0) {
|
||||
status = dcesrv_create_ncalrpc_socket("netlogon", &fd);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@ -561,8 +561,8 @@ static bool mdssd_create_sockets(struct tevent_context *ev_ctx,
|
||||
listen_fd[*listen_fd_size] = fd;
|
||||
(*listen_fd_size)++;
|
||||
|
||||
fd = dcesrv_create_ncalrpc_socket("mdssvc");
|
||||
if (fd < 0) {
|
||||
status = dcesrv_create_ncalrpc_socket("mdssvc", &fd);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@ -765,30 +765,38 @@ static void dcerpc_ncalrpc_listener(struct tevent_context *ev,
|
||||
uint16_t flags,
|
||||
void *private_data);
|
||||
|
||||
int dcesrv_create_ncalrpc_socket(const char *name)
|
||||
NTSTATUS dcesrv_create_ncalrpc_socket(const char *name, int *out_fd)
|
||||
{
|
||||
int fd = -1;
|
||||
NTSTATUS status;
|
||||
|
||||
if (name == NULL) {
|
||||
name = "DEFAULT";
|
||||
}
|
||||
|
||||
if (!directory_create_or_exist(lp_ncalrpc_dir(), 0755)) {
|
||||
status = map_nt_error_from_unix_common(errno);
|
||||
DEBUG(0, ("Failed to create ncalrpc directory %s - %s\n",
|
||||
lp_ncalrpc_dir(), strerror(errno)));
|
||||
return -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
fd = create_pipe_sock(lp_ncalrpc_dir(), name, 0755);
|
||||
if (fd == -1) {
|
||||
status = map_nt_error_from_unix_common(errno);
|
||||
DEBUG(0, ("Failed to create ncalrpc socket! [%s/%s]\n",
|
||||
lp_ncalrpc_dir(), name));
|
||||
return -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
DEBUG(10, ("Opened ncalrpc socket fd %d for %s\n", fd, name));
|
||||
|
||||
return fd;
|
||||
*out_fd = fd;
|
||||
|
||||
return NT_STATUS_OK;
|
||||
|
||||
out:
|
||||
return status;
|
||||
}
|
||||
|
||||
bool setup_dcerpc_ncalrpc_socket(struct tevent_context *ev_ctx,
|
||||
@ -799,6 +807,7 @@ bool setup_dcerpc_ncalrpc_socket(struct tevent_context *ev_ctx,
|
||||
struct dcerpc_ncacn_listen_state *state;
|
||||
struct tevent_fd *fde;
|
||||
int rc;
|
||||
NTSTATUS status;
|
||||
|
||||
state = talloc(ev_ctx, struct dcerpc_ncacn_listen_state);
|
||||
if (state == NULL) {
|
||||
@ -820,8 +829,8 @@ bool setup_dcerpc_ncalrpc_socket(struct tevent_context *ev_ctx,
|
||||
return false;
|
||||
}
|
||||
|
||||
state->fd = dcesrv_create_ncalrpc_socket(name);
|
||||
if (state->fd == -1) {
|
||||
status = dcesrv_create_ncalrpc_socket(name, &state->fd);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ uint16_t setup_dcerpc_ncacn_tcpip_socket(struct tevent_context *ev_ctx,
|
||||
const struct sockaddr_storage *ifss,
|
||||
uint16_t port);
|
||||
|
||||
int dcesrv_create_ncalrpc_socket(const char *name);
|
||||
NTSTATUS dcesrv_create_ncalrpc_socket(const char *name, int *out_fd);
|
||||
bool setup_dcerpc_ncalrpc_socket(struct tevent_context *ev_ctx,
|
||||
struct messaging_context *msg_ctx,
|
||||
const char *name,
|
||||
|
Loading…
Reference in New Issue
Block a user