summaryrefslogtreecommitdiff
path: root/source3/passdb
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2002-08-12 13:55:31 +0000
committerJim McDonough <jmcd@samba.org>2002-08-12 13:55:31 +0000
commit3e5939ccd5bb3347af8166c452e7540504691c92 (patch)
tree9abf42e267512ced51c0462dbcdf88730565dc9f /source3/passdb
parenta40116204d0adc45ed5295cc3a1c5761466e1aa7 (diff)
downloadsamba-3e5939ccd5bb3347af8166c452e7540504691c92.tar.gz
samba-3e5939ccd5bb3347af8166c452e7540504691c92.tar.bz2
samba-3e5939ccd5bb3347af8166c452e7540504691c92.zip
Update secrets_fetch_domain_guid to generate and store it if it doesn't exist.
Only does it for PDCs. (This used to be commit 3543f92c39a80c8b6eb7ca3188b87f0f15896f33)
Diffstat (limited to 'source3/passdb')
-rw-r--r--source3/passdb/secrets.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c
index 943fa4713b..ec67b74390 100644
--- a/source3/passdb/secrets.c
+++ b/source3/passdb/secrets.c
@@ -142,13 +142,22 @@ BOOL secrets_fetch_domain_guid(char *domain, GUID *guid)
GUID *dyn_guid;
fstring key;
size_t size;
+ GUID new_guid;
slprintf(key, sizeof(key)-1, "%s/%s", SECRETS_DOMAIN_GUID, domain);
strupper(key);
dyn_guid = (GUID *)secrets_fetch(key, &size);
- if (dyn_guid == NULL)
- return False;
+ DEBUG(6,("key is %s, guid is at %x, size is %d\n", key, dyn_guid, size));
+
+ if ((NULL == dyn_guid) && (ROLE_DOMAIN_PDC == lp_server_role())) {
+ uuid_generate_random(&new_guid);
+ if (!secrets_store_domain_guid(domain, &new_guid))
+ return False;
+ dyn_guid = (GUID *)secrets_fetch(key, &size);
+ if (dyn_guid == NULL)
+ return False;
+ }
if (size != sizeof(GUID))
{