summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-04-29 12:53:13 +0200
committerVolker Lendecke <vl@samba.org>2011-04-29 16:57:37 +0200
commitaa5abcaf7e2844e3bd3d8e8fe26488673ad3c00e (patch)
tree7e2d9a8220b9677bf4a6a0f6b6324dc8524f8c05
parent0757688eb34ec1a22bf8c28f72416d6684756647 (diff)
downloadsamba-aa5abcaf7e2844e3bd3d8e8fe26488673ad3c00e.tar.gz
samba-aa5abcaf7e2844e3bd3d8e8fe26488673ad3c00e.tar.bz2
samba-aa5abcaf7e2844e3bd3d8e8fe26488673ad3c00e.zip
s3: Make winbindd_reinit_after_fork return NTSTATUS
-rw-r--r--source3/winbindd/winbindd.c6
-rw-r--r--source3/winbindd/winbindd_cm.c6
-rw-r--r--source3/winbindd/winbindd_dual.c19
-rw-r--r--source3/winbindd/winbindd_proto.h4
4 files changed, 23 insertions, 12 deletions
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index 232f9b4c60..071b3ccdc9 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -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);
}
diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c
index f065d83995..d9fca5f5dc 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 47ab6c17b7..8df6708778 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 725bf6f8a7..d0619f6e09 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 */