summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/libads/sasl.c18
-rw-r--r--source3/smbd/sesssetup.c1
2 files changed, 14 insertions, 5 deletions
diff --git a/source3/libads/sasl.c b/source3/libads/sasl.c
index 812f3961f1..bdc4f2e276 100644
--- a/source3/libads/sasl.c
+++ b/source3/libads/sasl.c
@@ -311,9 +311,9 @@ static ADS_STATUS ads_sasl_gssapi_bind(ADS_STRUCT *ads)
int gss_rc, rc;
uint8 *p;
uint32 max_msg_size = 0;
- char *sname;
+ char *sname = NULL;
ADS_STATUS status;
- krb5_principal principal;
+ krb5_principal principal = NULL;
krb5_context ctx = NULL;
krb5_enctype enc_types[] = {
#ifdef ENCTYPE_ARCFOUR_HMAC
@@ -331,24 +331,32 @@ static ADS_STATUS ads_sasl_gssapi_bind(ADS_STRUCT *ads)
initialize_krb5_error_table();
status = ADS_ERROR_KRB5(krb5_init_context(&ctx));
if (!ADS_ERR_OK(status)) {
+ SAFE_FREE(sname);
return status;
}
status = ADS_ERROR_KRB5(krb5_set_default_tgs_ktypes(ctx, enc_types));
if (!ADS_ERR_OK(status)) {
+ SAFE_FREE(sname);
+ krb5_free_context(ctx);
return status;
}
status = ADS_ERROR_KRB5(smb_krb5_parse_name(ctx, sname, &principal));
if (!ADS_ERR_OK(status)) {
+ SAFE_FREE(sname);
+ krb5_free_context(ctx);
return status;
}
- free(sname);
- krb5_free_context(ctx);
-
input_name.value = &principal;
input_name.length = sizeof(principal);
gss_rc = gss_import_name(&minor_status, &input_name, &nt_principal, &serv_name);
+
+ /* We've finished with principal and sname now. */
+ SAFE_FREE(sname);
+ krb5_free_principal(ctx, principal);
+ krb5_free_context(ctx);
+
if (gss_rc) {
return ADS_ERROR_GSS(gss_rc, minor_status);
}
diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c
index e678d959d8..ff1b2821cc 100644
--- a/source3/smbd/sesssetup.c
+++ b/source3/smbd/sesssetup.c
@@ -176,6 +176,7 @@ static BOOL make_krb5_skew_error(DATA_BLOB *pblob_out)
*pblob_out = data_blob(NULL,0);
+ initialize_krb5_error_table();
kerr = krb5_init_context(&context);
if (kerr) {
return False;