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/utils | |
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/utils')
-rw-r--r-- | source3/utils/net.c | 10 | ||||
-rw-r--r-- | source3/utils/smbpasswd.c | 6 |
2 files changed, 16 insertions, 0 deletions
diff --git a/source3/utils/net.c b/source3/utils/net.c index b9081c3e31..9026900e81 100644 --- a/source3/utils/net.c +++ b/source3/utils/net.c @@ -418,6 +418,11 @@ static int net_getlocalsid(int argc, const char **argv) name = global_myname(); } + if(!initialize_password_db(False)) { + DEBUG(0, ("WARNING: Could not open passdb - local sid may not reflect passdb\n" + "backend knowlege (such as the sid stored in LDAP)\n")); + } + if (!secrets_fetch_domain_sid(name, &sid)) { DEBUG(0, ("Can't fetch domain SID for name: %s\n", name)); return 1; @@ -452,6 +457,11 @@ static int net_getdomainsid(int argc, const char **argv) DOM_SID domain_sid; fstring sid_str; + if(!initialize_password_db(False)) { + DEBUG(0, ("WARNING: Could not open passdb - domain sid may not reflect passdb\n" + "backend knowlege (such as the sid stored in LDAP)\n")); + } + if (!secrets_fetch_domain_sid(global_myname(), &domain_sid)) { d_printf("Could not fetch local SID\n"); return 1; diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c index ea8bf7a472..5507727498 100644 --- a/source3/utils/smbpasswd.c +++ b/source3/utils/smbpasswd.c @@ -348,6 +348,12 @@ static int process_root(int local_flags) goto done; } + /* Ensure passdb startup(). */ + if(!initialize_password_db(False)) { + DEBUG(0, ("Failed to open passdb!\n")); + exit(1); + } + /* Ensure we have a SAM sid. */ get_global_sam_sid(); |