summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/libsmb/trustdom_cache.c5
-rw-r--r--source3/libsmb/trusts_util.c4
2 files changed, 5 insertions, 4 deletions
diff --git a/source3/libsmb/trustdom_cache.c b/source3/libsmb/trustdom_cache.c
index cddbb2daa6..61b024da43 100644
--- a/source3/libsmb/trustdom_cache.c
+++ b/source3/libsmb/trustdom_cache.c
@@ -89,7 +89,7 @@ BOOL trustdom_cache_shutdown(void)
static char* trustdom_cache_key(const char* name)
{
- char* keystr;
+ char* keystr = NULL;
asprintf(&keystr, TDOMKEY_FMT, strupper_static(name));
return keystr;
@@ -165,11 +165,14 @@ BOOL trustdom_cache_fetch(const char* name, DOM_SID* sid)
/* prepare a key and get the value */
key = trustdom_cache_key(name);
+ if (!key) return False;
if (!gencache_get(key, &value, &timeout)) {
DEBUG(5, ("no entry for trusted domain %s found.\n", name));
+ SAFE_FREE(key);
return False;
} else {
+ SAFE_FREE(key);
DEBUG(5, ("trusted domain %s found (%s)\n", name, value));
}
diff --git a/source3/libsmb/trusts_util.c b/source3/libsmb/trusts_util.c
index 6244c844f2..e0c5e79595 100644
--- a/source3/libsmb/trusts_util.c
+++ b/source3/libsmb/trusts_util.c
@@ -154,9 +154,7 @@ BOOL is_trusted_domain(const char* dom_name)
* Query the trustdom_cache updated periodically. The only
* way for domain member server.
*/
- if (trustdom_cache_enable() &&
- trustdom_cache_fetch(dom_name, &trustdom_sid)) {
- trustdom_cache_shutdown();
+ if (trustdom_cache_fetch(dom_name, &trustdom_sid)) {
return True;
}