[PATCH] s3: Free principal if smb_krb5_principal_get_realm() fails

swen swen at linux.ibm.com
Wed Nov 21 11:20:29 UTC 2018


Please review and push if happy.

Thanks for your support in advance.

Cheers Swen
-------------- next part --------------
From 354f8a3ff339a1026801b67dfaa48fc53fd7387e Mon Sep 17 00:00:00 2001
From: Swen Schillig <swen at linux.ibm.com>
Date: Wed, 21 Nov 2018 12:05:24 +0100
Subject: [PATCH] s3: Free principal if smb_krb5_principal_get_realm() fails

If smb_krb5_principal_get_realm() fails, procesing is aborted and
resources have to be free'd. In this context free'ing the principal
was missing.

Signed-off-by: Swen Schillig <swen at linux.ibm.com>
---
 source3/libads/krb5_setpw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/source3/libads/krb5_setpw.c b/source3/libads/krb5_setpw.c
index 3862f221317..d863391ffb2 100644
--- a/source3/libads/krb5_setpw.c
+++ b/source3/libads/krb5_setpw.c
@@ -225,6 +225,7 @@ static ADS_STATUS ads_krb5_chg_password(const char *kdc_host,
 
     /* We have to obtain an INITIAL changepw ticket for changing password */
     if (asprintf(&chpw_princ, "kadmin/changepw@%s", realm) == -1) {
+	krb5_free_principal(context, princ);
 	krb5_get_init_creds_opt_free(context, opts);
 	smb_krb5_free_addresses(context, addr);
 	krb5_free_context(context);
-- 
2.17.2



More information about the samba-technical mailing list