summaryrefslogtreecommitdiff
path: root/source3/libads/sasl.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-03-15 22:11:13 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:18:38 -0500
commitb74cb6740f78b9b2c02eb3bc0afb1b7378ac0bc2 (patch)
tree302c2b08e89aba026560fe9087b039adfd7622b4 /source3/libads/sasl.c
parentc042d06490cc02ec17376c7c057be9f809ca1c6e (diff)
downloadsamba-b74cb6740f78b9b2c02eb3bc0afb1b7378ac0bc2.tar.gz
samba-b74cb6740f78b9b2c02eb3bc0afb1b7378ac0bc2.tar.bz2
samba-b74cb6740f78b9b2c02eb3bc0afb1b7378ac0bc2.zip
r21850: After Jerry explained to me the HORRIBLE way in which
the MIT gss libraries *SUCK*, move the frees to the end of the function so MIT doesn't segfault..... Add a comment so that another engineer knows why I did this. Jeremy. (This used to be commit 1a2be06d4a1131952a97f94b05ae69b1dce4c300)
Diffstat (limited to 'source3/libads/sasl.c')
-rw-r--r--source3/libads/sasl.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/source3/libads/sasl.c b/source3/libads/sasl.c
index bdc4f2e276..013985a121 100644
--- a/source3/libads/sasl.c
+++ b/source3/libads/sasl.c
@@ -352,12 +352,19 @@ static ADS_STATUS ads_sasl_gssapi_bind(ADS_STRUCT *ads)
gss_rc = gss_import_name(&minor_status, &input_name, &nt_principal, &serv_name);
- /* We've finished with principal and sname now. */
+ /*
+ * The MIT libraries have a *HORRIBLE* bug - input_value.value needs
+ * to point to the *address* of the krb5_principal, and the gss libraries
+ * to a shallow copy of the krb5_principal pointer - so we need to keep
+ * the krb5_principal around until we do the gss_release_name. MIT *SUCKS* !
+ * Just one more way in which MIT engineers screwed me over.... JRA.
+ */
+
SAFE_FREE(sname);
- krb5_free_principal(ctx, principal);
- krb5_free_context(ctx);
if (gss_rc) {
+ krb5_free_principal(ctx, principal);
+ krb5_free_context(ctx);
return ADS_ERROR_GSS(gss_rc, minor_status);
}
@@ -415,8 +422,6 @@ static ADS_STATUS ads_sasl_gssapi_bind(ADS_STRUCT *ads)
if (gss_rc == 0) break;
}
- gss_release_name(&minor_status, &serv_name);
-
gss_rc = gss_unwrap(&minor_status,context_handle,&input_token,&output_token,
(int *)&conf_state,NULL);
if (gss_rc) {
@@ -471,6 +476,11 @@ static ADS_STATUS ads_sasl_gssapi_bind(ADS_STRUCT *ads)
gss_release_buffer(&minor_status, &input_token);
failed:
+
+ gss_release_name(&minor_status, &serv_name);
+ krb5_free_principal(ctx, principal);
+ krb5_free_context(ctx);
+
if(scred)
ber_bvfree(scred);
return status;