1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-03 04:22:09 +03:00

s3: Make winbindd_reinit_after_fork return NTSTATUS

This commit is contained in:
Volker Lendecke
2011-04-29 12:53:13 +02:00
parent 0757688eb3
commit aa5abcaf7e
4 changed files with 23 additions and 12 deletions

View File

@ -378,6 +378,7 @@ static void winbind_msg_validate_cache(struct messaging_context *msg_ctx,
{
uint8 ret;
pid_t child_pid;
NTSTATUS status;
DEBUG(10, ("winbindd_msg_validate_cache: got validate-cache "
"message.\n"));
@ -404,7 +405,10 @@ static void winbind_msg_validate_cache(struct messaging_context *msg_ctx,
/* child */
if (!winbindd_reinit_after_fork(NULL, NULL)) {
status = winbindd_reinit_after_fork(NULL, NULL);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("winbindd_reinit_after_fork failed: %s\n",
nt_errstr(status)));
_exit(0);
}

View File

@ -189,6 +189,7 @@ static bool fork_child_dc_connect(struct winbindd_domain *domain)
TALLOC_CTX *mem_ctx = NULL;
pid_t parent_pid = sys_getpid();
char *lfile = NULL;
NTSTATUS status;
if (domain->dc_probe_pid != (pid_t)-1) {
/*
@ -233,7 +234,10 @@ static bool fork_child_dc_connect(struct winbindd_domain *domain)
}
}
if (!winbindd_reinit_after_fork(NULL, lfile)) {
status = winbindd_reinit_after_fork(NULL, lfile);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("winbindd_reinit_after_fork failed: %s\n",
nt_errstr(status)));
messaging_send_buf(winbind_messaging_context(),
pid_to_procid(parent_pid),
MSG_WINBIND_FAILED_TO_GO_ONLINE,

View File

@ -1167,8 +1167,8 @@ static void child_msg_dump_event_list(struct messaging_context *msg,
dump_event_list(winbind_event_context());
}
bool winbindd_reinit_after_fork(const struct winbindd_child *myself,
const char *logfilename)
NTSTATUS winbindd_reinit_after_fork(const struct winbindd_child *myself,
const char *logfilename)
{
struct winbindd_domain *domain;
struct winbindd_child *cl;
@ -1181,7 +1181,7 @@ bool winbindd_reinit_after_fork(const struct winbindd_child *myself,
true);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));
return false;
return status;
}
close_conns_after_fork();
@ -1192,10 +1192,10 @@ bool winbindd_reinit_after_fork(const struct winbindd_child *myself,
}
if (!winbindd_setup_sig_term_handler(false))
return false;
return NT_STATUS_NO_MEMORY;
if (!winbindd_setup_sig_hup_handler(override_logfile ? NULL :
logfilename))
return false;
return NT_STATUS_NO_MEMORY;
/* Stop zombies in children */
CatchChild();
@ -1271,7 +1271,7 @@ bool winbindd_reinit_after_fork(const struct winbindd_child *myself,
cl = idmap_child();
cl->pid = (pid_t)0;
return true;
return NT_STATUS_OK;
}
/*
@ -1291,6 +1291,7 @@ static bool fork_domain_child(struct winbindd_child *child)
struct winbindd_request request;
struct winbindd_response response;
struct winbindd_domain *primary_domain = NULL;
NTSTATUS status;
if (child->domain) {
DEBUG(10, ("fork_domain_child called for domain '%s'\n",
@ -1334,7 +1335,10 @@ static bool fork_domain_child(struct winbindd_child *child)
state.sock = fdpair[0];
close(fdpair[1]);
if (!winbindd_reinit_after_fork(child, child->logfilename)) {
status = winbindd_reinit_after_fork(child, child->logfilename);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("winbindd_reinit_after_fork failed: %s\n",
nt_errstr(status)));
_exit(0);
}
@ -1434,7 +1438,6 @@ static bool fork_domain_child(struct winbindd_child *child)
TALLOC_CTX *frame = talloc_stackframe();
struct iovec iov[2];
int iov_count;
NTSTATUS status;
if (run_events_poll(winbind_event_context(), 0, NULL, 0)) {
TALLOC_FREE(frame);

View File

@ -291,8 +291,8 @@ void winbind_msg_ip_dropped_parent(struct messaging_context *msg_ctx,
uint32_t msg_type,
struct server_id server_id,
DATA_BLOB *data);
bool winbindd_reinit_after_fork(const struct winbindd_child *myself,
const char *logfilename);
NTSTATUS winbindd_reinit_after_fork(const struct winbindd_child *myself,
const char *logfilename);
struct winbindd_domain *wb_child_domain(void);
/* The following definitions come from winbindd/winbindd_group.c */