From 984860f922a02acec1ef0cd080900f037dbbeada Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 15 Dec 2005 20:25:37 +0000 Subject: r12267: Try to avoid segfault in kerberos libs, because we talloc_free()'ed the old event context in the standard process modal child. Andrew Bartlett (This used to be commit 0f52a9ab071c181c7f764adc8be83e162e649931) --- source4/smbd/process_single.c | 5 +++++ source4/smbd/process_standard.c | 6 ++++++ source4/smbd/process_thread.c | 8 +++++++- source4/smbd/server.c | 6 ------ 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/source4/smbd/process_single.c b/source4/smbd/process_single.c index 8c9dd2f7fa..d46ee48718 100644 --- a/source4/smbd/process_single.c +++ b/source4/smbd/process_single.c @@ -28,12 +28,17 @@ #include "smb_server/smb_server.h" #include "system/filesys.h" +/* For sepecifiying event context to GSSAPI below */ +#include "heimdal/lib/gssapi/gssapi_locl.h" + /* called when the process model is selected */ static void single_model_init(struct event_context *ev) { + /* Hack to ensure that GSSAPI uses the right event context */ + gssapi_krb5_init_ev(ev); } /* diff --git a/source4/smbd/process_standard.c b/source4/smbd/process_standard.c index bbc0aa4c7e..5149ab55b6 100644 --- a/source4/smbd/process_standard.c +++ b/source4/smbd/process_standard.c @@ -29,6 +29,9 @@ #include "smb_server/smb_server.h" #include "system/filesys.h" +/* For sepecifiying event context to GSSAPI below */ +#include "heimdal/lib/gssapi/gssapi_locl.h" + /* called when the process model is selected */ @@ -94,6 +97,9 @@ static void standard_accept_connection(struct event_context *ev, DEBUG(0,("standard_accept_connection: tdb_reopen_all failed.\n")); } + /* Hack to ensure that GSSAPI uses the right event context */ + gssapi_krb5_init_ev(ev2); + /* Ensure that the forked children do not expose identical random streams */ set_need_random_reseed(); diff --git a/source4/smbd/process_thread.c b/source4/smbd/process_thread.c index e5ed74e939..b79c2f76b5 100644 --- a/source4/smbd/process_thread.c +++ b/source4/smbd/process_thread.c @@ -35,6 +35,9 @@ #include "smb_server/smb_server.h" #include "mutex.h" +/* For sepecifiying event context to GSSAPI below */ +#include "heimdal/lib/gssapi/gssapi_locl.h" + struct new_conn_state { struct event_context *ev; struct socket_context *sock; @@ -502,7 +505,10 @@ static void thread_model_init(struct event_context *event_context) d_ops.get_task_id = thread_get_task_id; d_ops.log_task_id = thread_log_task_id; - register_debug_handlers("thread", &d_ops); + register_debug_handlers("thread", &d_ops); + + /* Hack to ensure that GSSAPI uses the right event context */ + gssapi_krb5_init_ev(event_context); } diff --git a/source4/smbd/server.c b/source4/smbd/server.c index 3075896722..4d1e70d68e 100644 --- a/source4/smbd/server.c +++ b/source4/smbd/server.c @@ -31,9 +31,6 @@ #include "system/filesys.h" #include "system/kerberos.h" -/* For sepecifiying event context to GSSAPI below */ -#include "heimdal/lib/gssapi/gssapi_locl.h" - /* recursively delete a directory tree */ @@ -246,9 +243,6 @@ static int binary_smbd_main(const char *binary_name, int argc, const char *argv[ return 1; } - /* Hack to ensure that GSSAPI uses the right event context */ - gssapi_krb5_init_ev(event_ctx); - /* wait for events - this is where smbd sits for most of its life */ event_loop_wait(event_ctx); -- cgit