summaryrefslogtreecommitdiff
path: root/source3/passdb/secrets.c
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2002-12-12 23:35:55 +0000
committerGerald Carter <jerry@samba.org>2002-12-12 23:35:55 +0000
commitf6c4f25e4319b47ac6c8dbf67a4b1c513148384c (patch)
tree16b4d539f4a6bc3b1f39240ab70b7e3c4ec514c3 /source3/passdb/secrets.c
parent482f77e63520c16993e12ba4030c30b0e8417a8d (diff)
downloadsamba-f6c4f25e4319b47ac6c8dbf67a4b1c513148384c.tar.gz
samba-f6c4f25e4319b47ac6c8dbf67a4b1c513148384c.tar.bz2
samba-f6c4f25e4319b47ac6c8dbf67a4b1c513148384c.zip
merge of get_dc_name()-like code from APP_HEAD; better support password server = DC1 *
(This used to be commit 6b18ca9511ddcf1718f222af3f61491d1e5f3b60)
Diffstat (limited to 'source3/passdb/secrets.c')
-rw-r--r--source3/passdb/secrets.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c
index 29afaddea3..b93ea74d8b 100644
--- a/source3/passdb/secrets.c
+++ b/source3/passdb/secrets.c
@@ -610,3 +610,33 @@ void secrets_named_mutex_release(const char *name)
tdb_unlock_bystring(tdb, name);
DEBUG(10,("secrets_named_mutex: released mutex for %s\n", name ));
}
+
+/*********************************************************
+ Check to see if we must talk to the PDC to avoid sam
+ sync delays
+ ********************************************************/
+
+BOOL must_use_pdc( const char *domain )
+{
+ time_t now = time(NULL);
+ time_t last_change_time;
+ unsigned char passwd[16];
+
+ if ( !secrets_fetch_trust_account_password(domain, passwd, &last_change_time) )
+ return False;
+
+ /*
+ * If the time the machine password has changed
+ * was less than about 15 minutes then we need to contact
+ * the PDC only, as we cannot be sure domain replication
+ * has yet taken place. Bug found by Gerald (way to go
+ * Gerald !). JRA.
+ */
+
+ if ( now - last_change_time < SAM_SYNC_WINDOW )
+ return True;
+
+ return False;
+
+}
+