]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: utils: net_lookup. Convert to use get_kdc_list_talloc().
authorJeremy Allison <jra@samba.org>
Wed, 26 Aug 2020 18:38:31 +0000 (11:38 -0700)
committerNoel Power <npower@samba.org>
Mon, 7 Sep 2020 13:23:40 +0000 (13:23 +0000)
No more users of get_kdc_list().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
source3/utils/net_lookup.c

index 82dbdc4526781c9d047dd7a84da62855aee8f2ba..706f41f689b40b0ce97330b6fae881198c0607a9 100644 (file)
@@ -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"));