[2939] in Kerberos

home help back first fref pref prev next nref lref last post

Re: Memory leaks and problem areas....

daemon@ATHENA.MIT.EDU (Jim Miller)
Tue Dec 21 20:27:42 1993

From: jim@bilbo.suite.com (Jim Miller)
Date: Tue, 21 Dec 93 19:05:59 -0600
To: gmachin@somnet.sandia.gov
Cc: kerberos@MIT.EDU
Reply-To: Jim_Miller@bilbo.suite.com


I was looking over your suggested change to "krb5_get_cred_via_tgt" and  
think there is a problem with your suggestion.  (Actually, the problem is  
with some the Krb 5 implementation.)  It is not safe to free  
"cred->server" before doing the "copy_principal" operation.

Take a look at how "krb5_get_cred_from_kdc" uses "krb5_get_cred_via_tgt".   
Note how it uses "final_server" in the inner-most "for" loop.  If you free  
"cred->server" inside of "krb5_get_cred_via_tgt", then you will break  
"krb5_get_cred_from_kdc".

It appears that "krb5_get_cred_from_kdc" was written with the assumption  
that "cred->server" gets replaced without the previous value being freed  
<arg!>.


The question now becomes:

Do all other routines that call "krb5_get_cred_from_kdc" (directly or  
indirectly) operate under this assumption?

Well, the only routine that calls "krb5_get_cred_from_kdc" directly is  
"krb5_get_credentials", but a couple of routines call  
"krb5_get_credentials".  So now we need to backtrack to see which routines  
call these routines, and so on.

Perhaps the real question is:

Should "krb5_get_cred_via_tgt" replace "creds->server", or is it correct  
to leave it as it is?

I don't know.  Maybe somebody at MIT knows the answer...<hint>

Jim_Miller@suite.com


home help back first fref pref prev next nref lref last post