From e096440b746219cfcba20a881d64180d08045eef Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 9 Mar 2006 19:03:31 +0000 Subject: r14088: Fix Coverity bug #20. Don't deref possible null. Jeremy. (This used to be commit 7f3ace5481e55ef845da28b9c0613a2ea0de0de4) --- source3/passdb/secrets.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'source3') diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c index bb4aad9fac..927337d947 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)) { -- cgit