Author: jra Date: 2006-09-14 09:11:30 +0000 (Thu, 14 Sep 2006) New Revision: 18506
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=18506 Log: Fix online requests to cause an immediate DC connection. Jeremy. Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c Changeset: Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c =================================================================== --- branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c 2006-09-14 08:26:41 UTC (rev 18505) +++ branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c 2006-09-14 09:11:30 UTC (rev 18506) @@ -144,7 +144,7 @@ Set domain online - if allowed. ****************************************************************/ -void set_domain_online(struct winbindd_domain *domain) +static void set_domain_online(struct winbindd_domain *domain) { struct timeval now; @@ -160,11 +160,36 @@ /* If we are waiting to get a krb5 ticket, trigger immediately. */ GetTimeOfDay(&now); set_event_dispatch_time("krb5_ticket_gain_handler", now); - domain->online = True; } /**************************************************************** + Request init_dc_connection to set a domain online. +****************************************************************/ + +void set_domain_online_request(struct winbindd_domain *domain) +{ + DEBUG(10,("set_domain_online_request: called for domain %s\n", + domain->name )); + + if (get_global_winbindd_state_offline()) { + DEBUG(10,("set_domain_online_request: domain %s remaining globally offline\n", + domain->name )); + return; + } + + /* If we were called from a message request, initiate + a DC connection immediately. */ + + init_dc_connection(domain); + + if (domain->online == False) { + DEBUG(10,("set_domain_online_request: failed to init connection to DC. " + "Domain %s staying offline.\n", domain->name )); + } +} + +/**************************************************************** Add -ve connection cache entries for domain and realm. ****************************************************************/ @@ -1083,24 +1108,29 @@ static BOOL connection_ok(struct winbindd_domain *domain) { if (domain->conn.cli == NULL) { - DEBUG(8, ("Connection to %s for domain %s has NULL " + DEBUG(8, ("connection_ok: Connection to %s for domain %s has NULL " "cli!\n", domain->dcname, domain->name)); return False; } if (!domain->conn.cli->initialised) { - DEBUG(3, ("Connection to %s for domain %s was never " + DEBUG(3, ("connection_ok: Connection to %s for domain %s was never " "initialised!\n", domain->dcname, domain->name)); return False; } if (domain->conn.cli->fd == -1) { - DEBUG(3, ("Connection to %s for domain %s has died or was " + DEBUG(3, ("connection_ok: Connection to %s for domain %s has died or was " "never started (fd == -1)\n", domain->dcname, domain->name)); return False; } + if (domain->online == False) { + DEBUG(3, ("connection_ok: Domain %s is offline\n", domain->name)); + return False; + } + return True; } Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c =================================================================== --- branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c 2006-09-14 08:26:41 UTC (rev 18505) +++ branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c 2006-09-14 09:11:30 UTC (rev 18506) @@ -608,13 +608,13 @@ winbindd_flush_nscd_cache(); - /* Mark everything online - delete any negative cache entries - to force a reconnect on the next query from the parent to this child. */ + /* Try and mark everything online - delete any negative cache entries + to force a reconnect now. */ for (domain = domain_list(); domain; domain = domain->next) { DEBUG(5,("child_msg_online: marking %s online.\n", domain->name)); - set_domain_online(domain); winbindd_flush_negative_conn_cache(domain); + set_domain_online_request(domain); } }