From 31b9258c40365f97fdd707c9756764bc94392726 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 29 Apr 2011 12:53:13 +0200 Subject: [PATCH] s3: Make winbindd_reinit_after_fork return NTSTATUS (cherry picked from commit aa5abcaf7e2844e3bd3d8e8fe26488673ad3c00e) --- source3/winbindd/winbindd.c | 6 +++++- source3/winbindd/winbindd_cm.c | 6 +++++- source3/winbindd/winbindd_dual.c | 19 +++++++++++-------- source3/winbindd/winbindd_proto.h | 4 ++-- 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index 01fd2ddf5c8..f9742f29d82 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -387,6 +387,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")); @@ -413,7 +414,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); } diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c index f065d839950..d9fca5f5dce 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -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, diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c index 47ab6c17b70..8df6708778b 100644 --- a/source3/winbindd/winbindd_dual.c +++ b/source3/winbindd/winbindd_dual.c @@ -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); diff --git a/source3/winbindd/winbindd_proto.h b/source3/winbindd/winbindd_proto.h index 725bf6f8a70..d0619f6e094 100644 --- a/source3/winbindd/winbindd_proto.h +++ b/source3/winbindd/winbindd_proto.h @@ -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 */ -- 2.11.4.GIT