summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/nsswitch/winbindd_cm.c40
-rw-r--r--source3/nsswitch/winbindd_dual.c6
2 files changed, 38 insertions, 8 deletions
diff --git a/source3/nsswitch/winbindd_cm.c b/source3/nsswitch/winbindd_cm.c
index a0d97f2ff6..d1556198f3 100644
--- a/source3/nsswitch/winbindd_cm.c
+++ b/source3/nsswitch/winbindd_cm.c
@@ -144,7 +144,7 @@ void set_domain_offline(struct winbindd_domain *domain)
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 @@ void set_domain_online(struct winbindd_domain *domain)
/* 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 @@ void close_conns_after_fork(void)
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;
}
diff --git a/source3/nsswitch/winbindd_dual.c b/source3/nsswitch/winbindd_dual.c
index 94f7c49c95..db21132a80 100644
--- a/source3/nsswitch/winbindd_dual.c
+++ b/source3/nsswitch/winbindd_dual.c
@@ -608,13 +608,13 @@ static void child_msg_online(int msg_type, struct process_id src, void *buf, siz
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);
}
}