summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2004-02-08 12:04:23 +0000
committerAndrew Bartlett <abartlet@samba.org>2004-02-08 12:04:23 +0000
commit37ef59d4c323a068b978b6beecef367f736b4a86 (patch)
tree84c004987bff575559025db8f8fa1a3c7946072e
parent880f3b2952592133fb8da640aab73449e13f2ff6 (diff)
downloadsamba-37ef59d4c323a068b978b6beecef367f736b4a86.tar.gz
samba-37ef59d4c323a068b978b6beecef367f736b4a86.tar.bz2
samba-37ef59d4c323a068b978b6beecef367f736b4a86.zip
(merge from 3.0)
When we set a domain sid, force get_global_sam_sid() to do it's work again. This should ensure that the value it returns is always consistant. Andrew Bartlett (This used to be commit fb13c61d4eee943e44632a0d1ba57b19602d67a4)
-rw-r--r--source3/Makefile.in4
-rw-r--r--source3/passdb/machine_sid.c7
-rw-r--r--source3/passdb/secrets.c8
3 files changed, 16 insertions, 3 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 7fa0c14bd0..77ae8a0bdd 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -211,7 +211,7 @@ LIBADS_OBJ = libads/ldap.o libads/ldap_printer.o libads/sasl.o \
LIBADS_SERVER_OBJ = libads/util.o libads/kerberos_verify.o
-SECRETS_OBJ = passdb/secrets.o
+SECRETS_OBJ = passdb/secrets.o passdb/machine_sid.o
LIBNMB_OBJ = libsmb/unexpected.o libsmb/namecache.o libsmb/nmblib.o \
libsmb/namequery.o libsmb/conncache.o
@@ -293,7 +293,7 @@ GUMS_OBJ = sam/gums.o sam/gums_api.o sam/gums_helper.o @GUMS_STATIC@
PASSDB_GET_SET_OBJ = passdb/pdb_get_set.o
PASSDB_OBJ = $(PASSDB_GET_SET_OBJ) passdb/passdb.o passdb/pdb_interface.o \
- passdb/machine_sid.o passdb/util_sam_sid.o passdb/pdb_compat.o \
+ passdb/util_sam_sid.o passdb/pdb_compat.o \
passdb/privileges.o passdb/lookup_sid.o @PDB_STATIC@ passdb/pdb_sql.o
XML_OBJ = passdb/pdb_xml.o
diff --git a/source3/passdb/machine_sid.c b/source3/passdb/machine_sid.c
index 4e7476781c..1fb3569f76 100644
--- a/source3/passdb/machine_sid.c
+++ b/source3/passdb/machine_sid.c
@@ -198,3 +198,10 @@ DOM_SID *get_global_sam_sid(void)
return global_sam_sid;
}
+/**
+ * Force get_global_sam_sid to requery the backends
+ */
+void reset_global_sam_sid()
+{
+ SAFE_FREE(global_sam_sid);
+}
diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c
index 7317a4cf06..7531435e84 100644
--- a/source3/passdb/secrets.c
+++ b/source3/passdb/secrets.c
@@ -99,10 +99,16 @@ BOOL secrets_delete(const char *key)
BOOL secrets_store_domain_sid(const char *domain, const DOM_SID *sid)
{
fstring key;
+ BOOL ret;
slprintf(key, sizeof(key)-1, "%s/%s", SECRETS_DOMAIN_SID, domain);
strupper_m(key);
- return secrets_store(key, sid, sizeof(DOM_SID));
+ ret = secrets_store(key, sid, sizeof(DOM_SID));
+
+ /* Force a re-query, in case we modified our domain */
+ if (ret)
+ reset_global_sam_sid();
+ return ret;
}
BOOL secrets_fetch_domain_sid(const char *domain, DOM_SID *sid)