diff options
author | Tom Yu <tlyu@mit.edu> | 2009-09-29 01:39:08 +0000 |
---|---|---|
committer | Tom Yu <tlyu@mit.edu> | 2009-09-29 01:39:08 +0000 |
commit | ff8ddf6d1009e66062cea1a59c420e29303b7518 (patch) | |
tree | b191d2950a296380f936605a348267f55bca346e | |
parent | abc8b7500aa4938b7ebd98468a72c2c6bbe3ac54 (diff) | |
download | krb5-ff8ddf6d1009e66062cea1a59c420e29303b7518.zip krb5-ff8ddf6d1009e66062cea1a59c420e29303b7518.tar.gz krb5-ff8ddf6d1009e66062cea1a59c420e29303b7518.tar.bz2 |
pull up r22636 from trunk
------------------------------------------------------------------------
r22636 | ghudson | 2009-08-27 09:40:50 -0400 (Thu, 27 Aug 2009) | 17 lines
ticket: 6551
subject: Memory leak in spnego accept_sec_context error path
tags: pullup
target_version: 1.7
If the underlying mechanism's accept_sec_context returns an error, the
spnego accept_sec_context was leaving allocated data in
*context_handle, which is incorrect for the first call according to
RFC 2744.
Fix this by mirroring some code from the spnego init_sec_context,
which always cleans up the half-constructed context in case of error.
This is allowed (though not encouraged) by RFC 2744 for second and
subsequent calls; since we were already doing it in init_sec_context,
it seems simpler to do that than keep track of whether this is a first
call or not.
ticket: 6551
version_fixed: 1.7.1
status: resolved
git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-7@22813 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r-- | src/lib/gssapi/spnego/spnego_mech.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lib/gssapi/spnego/spnego_mech.c b/src/lib/gssapi/spnego/spnego_mech.c index 45f567f..4fa8ef2 100644 --- a/src/lib/gssapi/spnego/spnego_mech.c +++ b/src/lib/gssapi/spnego/spnego_mech.c @@ -1681,6 +1681,13 @@ cleanup: *src_name = sc->internal_name; } release_spnego_ctx(&sc); + } else if (ret != GSS_S_CONTINUE_NEEDED) { + if (sc != NULL) { + gss_delete_sec_context(&tmpmin, &sc->ctx_handle, + GSS_C_NO_BUFFER); + release_spnego_ctx(&sc); + } + *context_handle = GSS_C_NO_CONTEXT; } gss_release_buffer(&tmpmin, &mechtok_out); if (mechtok_in != GSS_C_NO_BUFFER) { |