svn commit: samba r18551 - in branches/SAMBA_3_0/source/nsswitch: .
jra at samba.org
jra at samba.org
Fri Sep 15 14:05:30 GMT 2006
Author: jra
Date: 2006-09-15 14:05:28 +0000 (Fri, 15 Sep 2006)
New Revision: 18551
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=18551
Log:
Implement a 30 seconds from startup, during which we
try hard to connect a DC even if we might be offline.
Jeremy.
Modified:
branches/SAMBA_3_0/source/nsswitch/winbindd.h
branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c
branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c
branches/SAMBA_3_0/source/nsswitch/winbindd_pam.c
Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/winbindd.h
===================================================================
--- branches/SAMBA_3_0/source/nsswitch/winbindd.h 2006-09-15 12:45:08 UTC (rev 18550)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd.h 2006-09-15 14:05:28 UTC (rev 18551)
@@ -169,6 +169,7 @@
BOOL primary; /* is this our primary domain ? */
BOOL internal; /* BUILTIN and member SAM */
BOOL online; /* is this domain available ? */
+ BOOL startup; /* are we in the first 30 seconds after fork ? */
/* Lookup methods for this domain (LDAP or RPC) */
struct winbindd_methods *methods;
Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c
===================================================================
--- branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c 2006-09-15 12:45:08 UTC (rev 18550)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c 2006-09-15 14:05:28 UTC (rev 18551)
@@ -912,8 +912,8 @@
{
for (i=0; i<num_dcs; i++) {
DEBUG(10, ("find_new_dc: open_any_socket_out failed for "
- "domain %s address %s\n",
- domain->name, inet_ntoa(dcs[i].ip) ));
+ "domain %s address %s. Error was %s\n",
+ domain->name, inet_ntoa(dcs[i].ip), strerror(errno) ));
winbind_add_failed_connection_entry(domain,
dcs[i].name, NT_STATUS_UNSUCCESSFUL);
}
Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c
===================================================================
--- branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c 2006-09-15 12:45:08 UTC (rev 18550)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c 2006-09-15 14:05:28 UTC (rev 18551)
@@ -582,7 +582,7 @@
/* Ensure any negative cache entries with the netbios or realm names are removed. */
-static void winbindd_flush_negative_conn_cache(struct winbindd_domain *domain)
+void winbindd_flush_negative_conn_cache(struct winbindd_domain *domain)
{
flush_negative_conn_cache_for_domain(domain->name);
if (*domain->alt_name) {
@@ -681,6 +681,7 @@
int fdpair[2];
struct winbindd_cli_state state;
extern BOOL override_logfile;
+ time_t startup_time;
if (socketpair(AF_UNIX, SOCK_STREAM, 0, fdpair) != 0) {
DEBUG(0, ("Could not open child pipe: %s\n",
@@ -764,6 +765,9 @@
message_register(MSG_WINBIND_ONLINE,child_msg_online);
message_register(MSG_WINBIND_ONLINESTATUS,child_msg_onlinestatus);
+ child->domain->startup = True;
+ startup_time = time(NULL);
+
while (1) {
int ret;
@@ -780,6 +784,13 @@
GetTimeOfDay(&now);
+ if (child->domain->startup && (now.tv_sec > startup_time + 30)) {
+ /* No longer in "startup" mode. */
+ DEBUG(10,("fork_domain_child: domain %s no longer in 'startup' mode.\n",
+ child->domain->name ));
+ child->domain->startup = False;
+ }
+
tp = get_timed_events_timeout(&t);
if (tp) {
DEBUG(11,("select will use timeout of %u.%u seconds\n",
Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_pam.c
===================================================================
--- branches/SAMBA_3_0/source/nsswitch/winbindd_pam.c 2006-09-15 12:45:08 UTC (rev 18550)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_pam.c 2006-09-15 14:05:28 UTC (rev 18551)
@@ -1208,6 +1208,18 @@
parse_domain_user(state->request.data.auth.user, name_domain, name_user);
+ if (domain->online == False && domain->startup) {
+ /* Logons are very important to users. If we're offline and
+ we get a request within the first 30 seconds of startup,
+ try very hard to find a DC and go online. */
+
+ DEBUG(10,("winbindd_dual_pam_auth: domain: %s offline and auth "
+ "request in startup mode.\n", domain->name ));
+
+ winbindd_flush_negative_conn_cache(domain);
+ set_dc_type_and_flags(domain);
+ }
+
DEBUG(10,("winbindd_dual_pam_auth: domain: %s last was %s\n", domain->name, domain->online ? "online":"offline"));
/* Check for Kerberos authentication */
More information about the samba-cvs
mailing list