summaryrefslogtreecommitdiffstats
path: root/source3/passdb/secrets.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-03-09 19:03:31 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:11:11 -0500
commite096440b746219cfcba20a881d64180d08045eef (patch)
treefcabaab357df8c726bd279a8e003c98fcd0f3587 /source3/passdb/secrets.c
parent485714ac6ba2f3c6dcacd116e055d4beb648492d (diff)
downloadsamba-e096440b746219cfcba20a881d64180d08045eef.tar.gz
samba-e096440b746219cfcba20a881d64180d08045eef.tar.xz
samba-e096440b746219cfcba20a881d64180d08045eef.zip
r14088: Fix Coverity bug #20. Don't deref possible null.
Jeremy. (This used to be commit 7f3ace5481e55ef845da28b9c0613a2ea0de0de4)
Diffstat (limited to 'source3/passdb/secrets.c')
-rw-r--r--source3/passdb/secrets.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c
index bb4aad9fac6..927337d947a 100644
--- a/source3/passdb/secrets.c
+++ b/source3/passdb/secrets.c
@@ -177,13 +177,16 @@ BOOL secrets_fetch_domain_guid(const char *domain, struct uuid *guid)
strupper_m(key);
dyn_guid = (struct uuid *)secrets_fetch(key, &size);
- if ((!dyn_guid) && (lp_server_role() == ROLE_DOMAIN_PDC)) {
- smb_uuid_generate_random(&new_guid);
- if (!secrets_store_domain_guid(domain, &new_guid))
- return False;
- dyn_guid = (struct uuid *)secrets_fetch(key, &size);
- if (dyn_guid == NULL)
+ if (!dyn_guid) {
+ if (lp_server_role() == ROLE_DOMAIN_PDC) {
+ smb_uuid_generate_random(&new_guid);
+ if (!secrets_store_domain_guid(domain, &new_guid))
+ return False;
+ dyn_guid = (struct uuid *)secrets_fetch(key, &size);
+ }
+ if (dyn_guid == NULL) {
return False;
+ }
}
if (size != sizeof(struct uuid)) {