From ef115ff3148b1590ca6128ec31975ef20e334f66 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 16 Mar 2006 11:32:01 +0000 Subject: r14468: Better fix to avoid winbind panic when we have an inproper configuration and want to just shutdown and exit. Guenther (This used to be commit 0aa6328ed6ba6d0d24169ffdff0099405c9bfb00) --- source3/nsswitch/winbindd.c | 5 ++++- source3/nsswitch/winbindd_util.c | 12 +++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c index 80cb6990a5..59437f05c2 100644 --- a/source3/nsswitch/winbindd.c +++ b/source3/nsswitch/winbindd.c @@ -1071,7 +1071,10 @@ int main(int argc, char **argv) netsamlogon_cache_init(); /* Non-critical */ - init_domain_list(); + if (!init_domain_list(True)) { + DEBUG(0,("unable to initalize domain list\n")); + exit(1); + } init_idmap_child(); diff --git a/source3/nsswitch/winbindd_util.c b/source3/nsswitch/winbindd_util.c index 7ad3318fe8..20f25a3954 100644 --- a/source3/nsswitch/winbindd_util.c +++ b/source3/nsswitch/winbindd_util.c @@ -62,7 +62,7 @@ struct winbindd_domain *domain_list(void) /* Initialise list */ if (!_domain_list) - init_domain_list(); + init_domain_list(False); return _domain_list; } @@ -498,7 +498,7 @@ enum winbindd_result winbindd_dual_init_connection(struct winbindd_domain *domai } /* Look up global info for the winbind daemon */ -void init_domain_list(void) +BOOL init_domain_list(BOOL initial_start) { extern struct winbindd_methods cache_methods; extern struct winbindd_methods passdb_methods; @@ -518,7 +518,11 @@ void init_domain_list(void) DOM_SID our_sid; if (!secrets_fetch_domain_sid(lp_workgroup(), &our_sid)) { - smb_panic("Could not fetch our SID - did we join?\n"); + if (initial_start) { + return False; + } else { + smb_panic("Could not fetch our SID - did we join?\n"); + } } domain = add_trusted_domain( lp_workgroup(), lp_realm(), @@ -540,6 +544,8 @@ void init_domain_list(void) get_global_sam_sid()); setup_domain_child(domain, &domain->child, NULL); } + + return True; } /** -- cgit