diff options
author | Andrew Bartlett <abartlet@samba.org> | 2003-03-11 11:28:59 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2003-03-11 11:28:59 +0000 |
commit | 3b580ff000d9f258c581efded52d5d7c55375173 (patch) | |
tree | 4a8f562527135c83a2db502747ef44e2de758231 /source3/passdb/secrets.c | |
parent | 17030fc403feb3ce5097d088ecf992e8b684d81a (diff) | |
download | samba-3b580ff000d9f258c581efded52d5d7c55375173.tar.gz samba-3b580ff000d9f258c581efded52d5d7c55375173.tar.bz2 samba-3b580ff000d9f258c581efded52d5d7c55375173.zip |
This patch attemptes to clean up winbindd's mutex locking.
The current locking scheme in winbind is a complete mess - indeed, the
next step should be to push the locking into cli_full_connection(), but
I'll leave it for now.
This patch works on the noted behaviour that 2 parts of the connection
process need protection - and independent protection. Tim Potter did
some work on this a little while back, verifying the second case.
The two cases are:
- between connect() and first session setup
- during the auth2 phase of the netlogon pipe setup.
I've removed the counter on the lock, as I fail to see what it gains us.
This patch also adds 'anonymous fallback' to our winbindd -> DC connection.
If the authenticated connection fails (wbinfo -A specifed) - say that
account isn't trusted by a trusted DC - then we try an anonymous.
Both tpot and mbp like the patch.
Andrew Bartlett
(This used to be commit 0620320002082298a15cbba72bd79aecfc607947)
Diffstat (limited to 'source3/passdb/secrets.c')
-rw-r--r-- | source3/passdb/secrets.c | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c index a58ea492ea..2b944a9941 100644 --- a/source3/passdb/secrets.c +++ b/source3/passdb/secrets.c @@ -588,24 +588,17 @@ NTSTATUS secrets_get_trusted_domains(TALLOC_CTX* ctx, int* enum_ctx, unsigned in between smbd instances. *******************************************************************************/ -BOOL secrets_named_mutex(const char *name, unsigned int timeout, size_t *p_ref_count) +BOOL secrets_named_mutex(const char *name, unsigned int timeout) { - size_t ref_count = *p_ref_count; int ret = 0; if (!message_init()) return False; - if (ref_count == 0) { - ret = tdb_lock_bystring(tdb, name, timeout); - if (ret == 0) - DEBUG(10,("secrets_named_mutex: got mutex for %s\n", name )); - } + ret = tdb_lock_bystring(tdb, name, timeout); + if (ret == 0) + DEBUG(10,("secrets_named_mutex: got mutex for %s\n", name )); - if (ret == 0) { - *p_ref_count = ++ref_count; - DEBUG(10,("secrets_named_mutex: ref_count for mutex %s = %u\n", name, (unsigned int)ref_count )); - } return (ret == 0); } @@ -613,19 +606,10 @@ BOOL secrets_named_mutex(const char *name, unsigned int timeout, size_t *p_ref_c Unlock a named mutex. *******************************************************************************/ -void secrets_named_mutex_release(const char *name, size_t *p_ref_count) +void secrets_named_mutex_release(const char *name) { - size_t ref_count = *p_ref_count; - - SMB_ASSERT(ref_count != 0); - - if (ref_count == 1) { - tdb_unlock_bystring(tdb, name); - DEBUG(10,("secrets_named_mutex: released mutex for %s\n", name )); - } - - *p_ref_count = --ref_count; - DEBUG(10,("secrets_named_mutex_release: ref_count for mutex %s = %u\n", name, (unsigned int)ref_count )); + tdb_unlock_bystring(tdb, name); + DEBUG(10,("secrets_named_mutex: released mutex for %s\n", name )); } /********************************************************* |