[2181] in Kerberos_V5_Development
Re: Comments on Krb5-nt-alpha1 - DLL / Application Problems
daemon@ATHENA.MIT.EDU (Doug Engert)
Sat Jan 25 20:47:20 1997
Date: Sat, 25 Jan 1997 19:45:42 -0600
From: Doug Engert <deengert@anl.gov>
Reply-To: deengert@anl.gov
To: Andrew Gray <agray@opengroup.org>
Cc: krbdev@MIT.EDU, sanfilip@osf.org, deengert@anl.gov
Andrew Gray wrote:
>
> Doug -
>
> >The second problem is similier. The fwd_tgt.c routines allocates
> >a buffer from the heap of the DLL, for the forwarded ticket, and
> >returns it to the caller, which may be the application. (In my
> >case it is a modified version of kcmd.c The wintel\auth.c also
> >has this problem, and it is fixed with a "#if 0 /* XXX */")
> >The application can not free this memory when it is done.
> >This two can be solved by having a routine in the DLL to free
> >memory obtained by the DLL.
>
> I have been looking through the win32 snapshot for the last several
> days, and I'm a bit confused by your statement. Under Win32, dlls do
> not have their own heap, rather uses the default process heap.I cannot
> locate any point in the kerberos sources that the free function has been
> redefined to use anything but the default process heap.
>
That is what I heard too.
But this code does work. It is based on
code I had to add to the 16-bit versions start in Beta 6 or so. Since
you are having a similiar problem, and the wintel\auth.c also has the
free
for the forwarded ticket commented out, I believe that there is some
problem
here. (I must admit, I did not try my application without it.)
The krb5_32.def does have:
DATA PRELOAD MOVEABLE SINGLE
HEAPSIZE 8192
These imply to me that the DLL has its own storage for allocate.
> Doesn't your function here just end up invoking free?
> !> KRB5_DLLIMP void KRB5_CALLCONV
> !> krb5_dll_xfree(val)
> !> void FAR * val;
> !> {
> !> krb5_xfree(val);
> !> }
>
Yes, but the free is done from the DLL not the application.
The idea is that the application use the krb5_dll_xfree to
get the free to be done in the DLL. I only use it in one place
to free forwarded ticket returned by fwd_tgt.c I use the
krb5_dll_alloc in a modified kcmd.c to get a krb5_creds structure
which is then passed to some routines in the DLL which might free it as
well.
> the reason that I have this question, is that I've run into a similiar
> problem. Following the krb_mk_rep call, when I try to free the returned
> data using krb5_xfree it fails.
Give this a try and see if it fixes the problem.
>
> Regards,
> Andrew Gray
>
> The Open Group Research Institute (we used to be OSF, but they made us
> change)
--
Douglas E. Engert <DEEngert@anl.gov>
Argonne National Laboratory
9700 South Cass Avenue
Argonne, Illinois 60439
(630) 252-5444