[26195] in CVS-changelog-for-Kerberos-V5
svn rev #25535: trunk/src/lib/krb5/krb/
daemon@ATHENA.MIT.EDU (ghudson@mit.edu)
Fri Dec 9 16:09:03 2011
Date: Fri, 9 Dec 2011 12:57:47 -0500
From: ghudson@mit.edu
Message-Id: <201112091757.pB9HvlO1026451@drugstore.mit.edu>
To: cvs-krb5@mit.edu
Reply-To: krbdev@mit.edu
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu
http://src.mit.edu/fisheye/changelog/krb5/?cs=25535
Commit By: ghudson
Log Message:
ticket: 7026
Fix memory leaks in FAST TGS support
krb5int_fast_prep_req remove tgs from request->padata and needs to
free it. get_creds.c needs to use a fresh FAST state for each TGS
request to avoid leaking armor keys.
Changed Files:
U trunk/src/lib/krb5/krb/fast.c
U trunk/src/lib/krb5/krb/get_creds.c
Modified: trunk/src/lib/krb5/krb/fast.c
===================================================================
--- trunk/src/lib/krb5/krb/fast.c 2011-12-08 04:21:23 UTC (rev 25534)
+++ trunk/src/lib/krb5/krb/fast.c 2011-12-09 17:57:47 UTC (rev 25535)
@@ -320,6 +320,10 @@
krb5_free_data(context, encoded_fast_req);
if (local_encoded_result)
krb5_free_data(context, local_encoded_result);
+ if (tgs) {
+ free(tgs->contents);
+ free(tgs);
+ }
state->fast_outer_request.padata = NULL;
return retval;
}
Modified: trunk/src/lib/krb5/krb/get_creds.c
===================================================================
--- trunk/src/lib/krb5/krb/get_creds.c 2011-12-08 04:21:23 UTC (rev 25534)
+++ trunk/src/lib/krb5/krb/get_creds.c 2011-12-09 17:57:47 UTC (rev 25535)
@@ -152,7 +152,6 @@
krb5_flags req_options; /* Caller-requested KRB5_GC_* options */
krb5_flags req_kdcopt; /* Caller-requested options as KDC options */
krb5_authdata **authdata; /* Caller-requested authdata */
- struct krb5int_fast_request_state *fast_state;
/* The following fields are used in multiple steps. */
krb5_creds *cur_tgt; /* TGT to be used for next query */
@@ -168,6 +167,7 @@
int kdcopt; /* KDC options of request */
krb5_keyblock *subkey; /* subkey of request */
krb5_data previous_request; /* Encoded request (for TCP retransmission) */
+ struct krb5int_fast_request_state *fast_state;
/* The following fields are used when acquiring foreign TGTs. */
krb5_data *realm_path; /* Path from client to server realm */
@@ -268,6 +268,13 @@
if (!krb5_c_valid_enctype(ctx->cur_tgt->keyblock.enctype))
return KRB5_PROG_ETYPE_NOSUPP;
+ /* Create a new FAST state structure to store this request's armor key. */
+ krb5int_fast_free_state(context, ctx->fast_state);
+ ctx->fast_state = NULL;
+ code = krb5int_fast_make_state(context, &ctx->fast_state);
+ if (code)
+ return code;
+
code = krb5int_make_tgs_request(context, ctx->fast_state,
ctx->cur_tgt, ctx->kdcopt,
ctx->cur_tgt->addresses, NULL,
@@ -1047,9 +1054,6 @@
ctx = k5alloc(sizeof(*ctx), &code);
if (ctx == NULL)
goto cleanup;
- code = krb5int_fast_make_state(context, &ctx->fast_state);
- if (code)
- goto cleanup;
ctx->req_options = options;
ctx->req_kdcopt = 0;
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5