From: Jeremy Allison Date: Wed, 26 Aug 2020 18:38:31 +0000 (-0700) Subject: s3: utils: net_lookup. Convert to use get_kdc_list_talloc(). X-Git-Tag: talloc-2.3.2~624 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=11226af33e1570bc4a54a951981bba29c8a912a4;p=thirdparty%2Fsamba.git s3: utils: net_lookup. Convert to use get_kdc_list_talloc(). No more users of get_kdc_list(). Signed-off-by: Jeremy Allison Reviewed-by: Noel Power --- diff --git a/source3/utils/net_lookup.c b/source3/utils/net_lookup.c index 82dbdc45267..706f41f689b 100644 --- a/source3/utils/net_lookup.c +++ b/source3/utils/net_lookup.c @@ -280,11 +280,11 @@ static int net_lookup_kdc(struct net_context *c, int argc, const char **argv) #ifdef HAVE_KRB5 krb5_error_code rc; krb5_context ctx; - struct ip_service *kdcs; + struct ip_service *kdcs = NULL; const char *realm; char **get_host_realms = NULL; - int num_kdcs = 0; - int i; + size_t num_kdcs = 0; + size_t i; NTSTATUS status; rc = smb_krb5_init_context_common(&ctx); @@ -309,9 +309,14 @@ static int net_lookup_kdc(struct net_context *c, int argc, const char **argv) realm = (const char *) *get_host_realms; } - status = get_kdc_list(realm, NULL, &kdcs, &num_kdcs); + status = get_kdc_list_talloc(talloc_tos(), + realm, + NULL, + &kdcs, + &num_kdcs); if (!NT_STATUS_IS_OK(status)) { - DEBUG(1,("get_kdc_list failed (%s)\n", nt_errstr(status))); + DBG_WARNING("get_kdc_list_talloc failed (%s)\n", + nt_errstr(status)); krb5_free_host_realm(ctx, get_host_realms); krb5_free_context(ctx); return -1; @@ -327,6 +332,7 @@ static int net_lookup_kdc(struct net_context *c, int argc, const char **argv) krb5_free_host_realm(ctx, get_host_realms); krb5_free_context(ctx); + TALLOC_FREE(kdcs); return 0; #endif DEBUG(1, ("No kerberos support\n"));