summaryrefslogtreecommitdiff
path: root/source3/smbd/globals.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2009-07-17 17:57:48 -0700
committerJeremy Allison <jra@samba.org>2009-07-17 17:57:48 -0700
commit55b4231c773ef17b8e628f33d6c3c9d5335df9da (patch)
treedaf5cff48bd26d782c7e9c06ff0a2f3678e13dfa /source3/smbd/globals.c
parent6a9e0039100b57f9626e87defec6720c476b9789 (diff)
downloadsamba-55b4231c773ef17b8e628f33d6c3c9d5335df9da.tar.gz
samba-55b4231c773ef17b8e628f33d6c3c9d5335df9da.tar.bz2
samba-55b4231c773ef17b8e628f33d6c3c9d5335df9da.zip
Move the initialization of smbd_server_conn from smbd/process,
after the accept and fork, to smbd_init_globals(), so it's done immediately on server startup. This is needed as some messages are sent to all active smbd processes (including the master listening daemon). If it gets a message that forces it to scan it's current connections (ie. conn_find()) then it discovers that sconn->smb1.tcons.Connections dereferences null (as sconn == NULL in the parent) and crashes. Yes, I could fix all cases where sconn is used and explicitly check for NULL but this fix is easier. It means that the smbd_event_context() is initialized in the master daemon and then re-initialized after fork, but that should be being done correctly in every fork call anyway. Without this change the previous fix 6a9e0039100b57f9626e87defec6720c476b9789 still panics in the reproducible test case for bug 6564, as this is one case where such a message (MSG_SMB_CONF_UPDATED) is sent to the parent. Metze please check. This change passes valgrind. Jeremy.
Diffstat (limited to 'source3/smbd/globals.c')
-rw-r--r--source3/smbd/globals.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/source3/smbd/globals.c b/source3/smbd/globals.c
index 15550ed455..317304a86d 100644
--- a/source3/smbd/globals.c
+++ b/source3/smbd/globals.c
@@ -153,4 +153,9 @@ void smbd_init_globals(void)
ZERO_STRUCT(conn_ctx_stack);
ZERO_STRUCT(sec_ctx_stack);
+
+ smbd_server_conn = talloc_zero(smbd_event_context(), struct smbd_server_connection);
+ if (!smbd_server_conn) {
+ exit_server("failed to create smbd_server_connection");
+ }
}