From e224e622971853bddbe24df717ea5dcddef71b89 Mon Sep 17 00:00:00 2001 From: Uri Simchoni Date: Wed, 23 Sep 2015 14:45:47 +0300 Subject: [PATCH] net: fix a crash with net ads keytab create Fix a crash that happens when executing "net ads keytab create" and the machine account in AD does not have setvice principal names attached to it. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11528 Signed-off-by: Uri Simchoni Reviewed-by: Jeremy Allison Reviewed-by: Stefan Metzmacher --- source3/libads/ldap.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index e8ccfa9c3d4..15385005e9a 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -2076,6 +2076,13 @@ ADS_STATUS ads_get_service_principal_names(TALLOC_CTX *mem_ctx, res, "servicePrincipalName", num_spns); + if (*spn_array == NULL) { + DEBUG(1, ("Host account for %s does not have service principal " + "names.\n", + machine_name)); + status = ADS_ERROR(LDAP_NO_SUCH_OBJECT); + goto done; + } done: ads_msgfree(ads, res); -- 2.11.4.GIT