struct rpc_srv_callbacks fss_cb;
NTSTATUS status;
pid_t pid;
- bool ok;
int rc;
fss_cb.init = fss_init_cb;
}
/* case is normalized by smbd on connection */
- ok = dcesrv_setup_ncacn_np_socket("fssagentrpc", ev_ctx, msg_ctx);
- if (!ok) {
+ status = dcesrv_setup_ncacn_np_socket("fssagentrpc", ev_ctx, msg_ctx);
+ if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("Failed to open fssd named pipe!\n"));
exit(1);
}
return status;
}
-bool dcesrv_setup_ncacn_np_socket(const char *pipe_name,
- struct tevent_context *ev_ctx,
- struct messaging_context *msg_ctx)
+NTSTATUS dcesrv_setup_ncacn_np_socket(const char *pipe_name,
+ struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx)
{
struct dcerpc_ncacn_listen_state *state;
struct tevent_fd *fde;
state = talloc(ev_ctx, struct dcerpc_ncacn_listen_state);
if (!state) {
DEBUG(0, ("Out of memory\n"));
- return false;
+ return NT_STATUS_NO_MEMORY;
}
state->fd = -1;
state->ep.name = talloc_strdup(state, pipe_name);
if (state->ep.name == NULL) {
DEBUG(0, ("Out of memory\n"));
+ status = NT_STATUS_NO_MEMORY;
goto out;
}
status = dcesrv_create_ncacn_np_socket(pipe_name, &state->fd);
rc = listen(state->fd, 5);
if (rc < 0) {
+ status = map_nt_error_from_unix_common(errno);
DEBUG(0, ("Failed to listen on pipe socket %s: %s\n",
pipe_name, strerror(errno)));
goto out;
DEBUG(10, ("Opened pipe socket fd %d for %s\n",
state->fd, pipe_name));
+ errno = 0;
fde = tevent_add_fd(ev_ctx,
state, state->fd, TEVENT_FD_READ,
named_pipe_listener, state);
- if (!fde) {
+ if (fde == NULL) {
+ if (errno == 0) {
+ errno = ENOMEM;
+ }
+ status = map_nt_error_from_unix_common(errno);
DEBUG(0, ("Failed to add event handler!\n"));
goto out;
}
tevent_fd_set_auto_close(fde);
- return true;
+ return NT_STATUS_OK;
out:
if (state->fd != -1) {
close(state->fd);
}
TALLOC_FREE(state);
- return false;
+ return status;
}
static void named_pipe_listener(struct tevent_context *ev,
void set_incoming_fault(struct pipes_struct *p);
void process_complete_pdu(struct pipes_struct *p, struct ncacn_packet *pkt);
NTSTATUS dcesrv_create_ncacn_np_socket(const char *pipe_name, int *out_fd);
-bool dcesrv_setup_ncacn_np_socket(const char *pipe_name,
- struct tevent_context *ev_ctx,
- struct messaging_context *msg_ctx);
+NTSTATUS dcesrv_setup_ncacn_np_socket(const char *pipe_name,
+ struct tevent_context *ev_ctx,
+ struct messaging_context *msg_ctx);
void named_pipe_accept_function(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx,
const char *pipe_name, int fd,