diff options
author | Andrew Bartlett <abartlet@samba.org> | 2004-02-25 22:09:46 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2004-02-25 22:09:46 +0000 |
commit | ebd86253c6bfb8ccb01e23c7e0446802e9009825 (patch) | |
tree | bfa51bf45beb253d0c4828cd05cd724438e83e5d /source3/passdb/pdb_ldap.c | |
parent | 3f67bb3a69f7a1631e2e158f4d58095c88f6bbb2 (diff) | |
download | samba-ebd86253c6bfb8ccb01e23c7e0446802e9009825.tar.gz samba-ebd86253c6bfb8ccb01e23c7e0446802e9009825.tar.bz2 samba-ebd86253c6bfb8ccb01e23c7e0446802e9009825.zip |
(merge from 3.0)
I *hate* global variables...
OK, what was happening here was that we would invalidate global_sam_sid
when we set the sid into secrets.tdb, to force a re-read.
The problem was, we would do *two* writes into the TDB, and the second one
(in the PDC/BDC case) would be of a NULL pointer. This caused smbd startups
to fail, on a blank TDB.
By using a local variable in the pdb_generate_sam_sid() code, we avoid this
particular trap.
I've also added better debugging for the case where this all matters, which
is particularly for LDAP, where it finds out a domain SID from the sambaDomain
object.
Andrew Bartlett
(This used to be commit f3ecdea56d9ea6d562ace84f0e653a641eb96f6e)
Diffstat (limited to 'source3/passdb/pdb_ldap.c')
-rw-r--r-- | source3/passdb/pdb_ldap.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index 3db0702c92..eefd302d42 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -2353,7 +2353,7 @@ static NTSTATUS pdb_init_ldapsam(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_met /* Try to setup the Domain Name, Domain SID, algorithmic rid base */ nt_status = smbldap_search_domain_info(ldap_state->smbldap_state, &result, - ldap_state->domain_name, True); + ldap_state->domain_name, True); if ( !NT_STATUS_IS_OK(nt_status) ) { DEBUG(2, ("pdb_init_ldapsam: WARNING: Could not get domain info, nor add one to the domain\n")); @@ -2382,8 +2382,15 @@ and will risk BDCs having inconsistant SIDs\n")); } found_sid = secrets_fetch_domain_sid(ldap_state->domain_name, &secrets_domain_sid); if (!found_sid || !sid_equal(&secrets_domain_sid, &ldap_domain_sid)) { + fstring new_sid_str, old_sid_str; + DEBUG(1, ("pdb_init_ldapsam: Resetting SID for domain %s based on pdb_ldap results %s -> %s\n", + ldap_state->domain_name, + sid_to_string(old_sid_str, &secrets_domain_sid), + sid_to_string(new_sid_str, &ldap_domain_sid))); + /* reset secrets.tdb sid */ secrets_store_domain_sid(ldap_state->domain_name, &ldap_domain_sid); + DEBUG(1, ("New global sam SID: %s\n", sid_to_string(new_sid_str, get_global_sam_sid()))); } sid_copy(&ldap_state->domain_sid, &ldap_domain_sid); } |