1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-23 09:57:40 +03:00

s3: utils: net_lookup. Convert to use get_kdc_list_talloc().

No more users of get_kdc_list().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
This commit is contained in:
Jeremy Allison 2020-08-26 11:38:31 -07:00 committed by Noel Power
parent 5307b0e319
commit 11226af33e

View File

@ -280,11 +280,11 @@ static int net_lookup_kdc(struct net_context *c, int argc, const char **argv)
#ifdef HAVE_KRB5 #ifdef HAVE_KRB5
krb5_error_code rc; krb5_error_code rc;
krb5_context ctx; krb5_context ctx;
struct ip_service *kdcs; struct ip_service *kdcs = NULL;
const char *realm; const char *realm;
char **get_host_realms = NULL; char **get_host_realms = NULL;
int num_kdcs = 0; size_t num_kdcs = 0;
int i; size_t i;
NTSTATUS status; NTSTATUS status;
rc = smb_krb5_init_context_common(&ctx); 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; 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)) { 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_host_realm(ctx, get_host_realms);
krb5_free_context(ctx); krb5_free_context(ctx);
return -1; 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_host_realm(ctx, get_host_realms);
krb5_free_context(ctx); krb5_free_context(ctx);
TALLOC_FREE(kdcs);
return 0; return 0;
#endif #endif
DEBUG(1, ("No kerberos support\n")); DEBUG(1, ("No kerberos support\n"));