diff options
Diffstat (limited to 'source3/libads')
-rw-r--r-- | source3/libads/ldap.c | 15 | ||||
-rw-r--r-- | source3/libads/sitename_cache.c | 8 | ||||
-rw-r--r-- | source3/libads/sitename_cache.h | 2 |
3 files changed, 11 insertions, 14 deletions
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index c8ef5b5774..12aacd4662 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -414,7 +414,7 @@ static NTSTATUS ads_find_dc(ADS_STRUCT *ads) return NT_STATUS_NO_LOGON_SERVERS; } - sitename = sitename_fetch(realm); + sitename = sitename_fetch(talloc_tos(), realm); again: @@ -429,7 +429,7 @@ static NTSTATUS ads_find_dc(ADS_STRUCT *ads) goto again; } - SAFE_FREE(sitename); + TALLOC_FREE(sitename); return status; } @@ -464,7 +464,7 @@ static NTSTATUS ads_find_dc(ADS_STRUCT *ads) if ( ads_try_connect(ads, server, false) ) { SAFE_FREE(ip_list); - SAFE_FREE(sitename); + TALLOC_FREE(sitename); return NT_STATUS_OK; } @@ -481,7 +481,7 @@ static NTSTATUS ads_find_dc(ADS_STRUCT *ads) if (sitename) { DEBUG(1,("ads_find_dc: failed to find a valid DC on our site (%s), " "trying to find another DC\n", sitename)); - SAFE_FREE(sitename); + TALLOC_FREE(sitename); namecache_delete(realm, 0x1C); goto again; } @@ -563,9 +563,9 @@ ADS_STATUS ads_connect_gc(ADS_STRUCT *ads) if (!realm) realm = lp_realm(); - if ((sitename = sitename_fetch(realm)) == NULL) { + if ((sitename = sitename_fetch(frame, realm)) == NULL) { ads_lookup_site(); - sitename = sitename_fetch(realm); + sitename = sitename_fetch(frame, realm); } dns_hosts_file = lp_parm_const_string(-1, "resolv", "host file", NULL); @@ -581,8 +581,6 @@ ADS_STATUS ads_connect_gc(ADS_STRUCT *ads) realm, sitename, &gcs_list, &num_gcs); - SAFE_FREE(sitename); - if (!NT_STATUS_IS_OK(nt_status)) { ads_status = ADS_ERROR_NT(nt_status); goto done; @@ -618,7 +616,6 @@ ADS_STATUS ads_connect_gc(ADS_STRUCT *ads) } while (!done); done: - SAFE_FREE(sitename); talloc_destroy(frame); return ads_status; diff --git a/source3/libads/sitename_cache.c b/source3/libads/sitename_cache.c index b0c4423106..b064aea139 100644 --- a/source3/libads/sitename_cache.c +++ b/source3/libads/sitename_cache.c @@ -79,7 +79,7 @@ bool sitename_store(const char *realm, const char *sitename) Caller must free. ****************************************************************************/ -char *sitename_fetch(const char *realm) +char *sitename_fetch(TALLOC_CTX *mem_ctx, const char *realm) { char *sitename = NULL; time_t timeout; @@ -95,7 +95,7 @@ char *sitename_fetch(const char *realm) key = sitename_key(query_realm); - ret = gencache_get( key, NULL, &sitename, &timeout ); + ret = gencache_get( key, mem_ctx, &sitename, &timeout ); SAFE_FREE(key); if ( !ret ) { DEBUG(5,("sitename_fetch: No stored sitename for %s\n", @@ -122,7 +122,7 @@ bool stored_sitename_changed(const char *realm, const char *sitename) return False; } - new_sitename = sitename_fetch(realm); + new_sitename = sitename_fetch(talloc_tos(), realm); if (sitename && new_sitename && !strequal(sitename, new_sitename)) { ret = True; @@ -130,7 +130,7 @@ bool stored_sitename_changed(const char *realm, const char *sitename) (!sitename && new_sitename)) { ret = True; } - SAFE_FREE(new_sitename); + TALLOC_FREE(new_sitename); return ret; } diff --git a/source3/libads/sitename_cache.h b/source3/libads/sitename_cache.h index 4e62f00a61..90449643a1 100644 --- a/source3/libads/sitename_cache.h +++ b/source3/libads/sitename_cache.h @@ -22,7 +22,7 @@ #define _LIBADS_SITENAME_CACHE_H_ bool sitename_store(const char *realm, const char *sitename); -char *sitename_fetch(const char *realm); +char *sitename_fetch(TALLOC_CTX *mem_ctx, const char *realm); bool stored_sitename_changed(const char *realm, const char *sitename); #endif /* _LIBADS_SITENAME_CACHE_H_ */ |