summaryrefslogtreecommitdiff
path: root/source4/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2017-04-03 18:16:02 +0000
committerJeremy Allison <jra@samba.org>2017-04-17 23:10:06 +0200
commitab597b9a47102e111a426640ac3ab32aa291687b (patch)
treecaaf1b0eb158d35de8762441bebd8dc42645c827 /source4/smbd
parentf24ecb035b8719c961e1e4ad7c4948f1dbd5165b (diff)
downloadsamba-ab597b9a47102e111a426640ac3ab32aa291687b.tar.gz
s4: server: Use state as the talloc context for open_schannel_session_store.
Ensure it's freed on all error paths. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Mon Apr 17 23:10:06 CEST 2017 on sn-devel-144
Diffstat (limited to 'source4/smbd')
-rw-r--r--source4/smbd/server.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/source4/smbd/server.c b/source4/smbd/server.c
index 22b22a79fd9..fdc36dec129 100644
--- a/source4/smbd/server.c
+++ b/source4/smbd/server.c
@@ -463,8 +463,9 @@ static int binary_smbd_main(const char *binary_name,
pidfile_create(lpcfg_pid_directory(cmdline_lp_ctx), binary_name);
if (lpcfg_server_role(cmdline_lp_ctx) == ROLE_ACTIVE_DIRECTORY_DC) {
- if (!open_schannel_session_store(talloc_autofree_context(),
+ if (!open_schannel_session_store(state,
cmdline_lp_ctx)) {
+ TALLOC_FREE(state);
exit_daemon("Samba cannot open schannel store "
"for secured NETLOGON operations.", EACCES);
}
@@ -472,6 +473,7 @@ static int binary_smbd_main(const char *binary_name,
/* make sure we won't go through nss_winbind */
if (!winbind_off()) {
+ TALLOC_FREE(state);
exit_daemon("Samba failed to disable recusive "
"winbindd calls.", EACCES);
}
@@ -492,6 +494,7 @@ static int binary_smbd_main(const char *binary_name,
state->event_ctx = s4_event_context_init(state);
if (state->event_ctx == NULL) {
+ TALLOC_FREE(state);
exit_daemon("Initializing event context failed", EACCES);
}
@@ -511,6 +514,7 @@ static int binary_smbd_main(const char *binary_name,
#endif
if (fstat(0, &st) != 0) {
+ TALLOC_FREE(state);
exit_daemon("Samba failed to set standard input handler",
ENOTTY);
}
@@ -523,6 +527,7 @@ static int binary_smbd_main(const char *binary_name,
server_stdin_handler,
state);
if (fde == NULL) {
+ TALLOC_FREE(state);
exit_daemon("Initializing stdin failed", ENOMEM);
}
}
@@ -538,6 +543,7 @@ static int binary_smbd_main(const char *binary_name,
max_runtime_handler,
state);
if (te == NULL) {
+ TALLOC_FREE(state);
exit_daemon("Maxruntime handler failed", ENOMEM);
}
}
@@ -549,6 +555,7 @@ static int binary_smbd_main(const char *binary_name,
sigterm_signal_handler,
state);
if (se == NULL) {
+ TALLOC_FREE(state);
exit_daemon("Initialize SIGTERM handler failed", ENOMEM);
}
@@ -576,6 +583,7 @@ static int binary_smbd_main(const char *binary_name,
status = setup_parent_messaging(state, cmdline_lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
+ TALLOC_FREE(state);
exit_daemon("Samba failed to setup parent messaging",
NT_STATUS_V(status));
}
@@ -585,6 +593,7 @@ static int binary_smbd_main(const char *binary_name,
status = server_service_startup(state->event_ctx, cmdline_lp_ctx, model,
lpcfg_server_services(cmdline_lp_ctx));
if (!NT_STATUS_IS_OK(status)) {
+ TALLOC_FREE(state);
exit_daemon("Samba failed to start services",
NT_STATUS_V(status));
}