[OpenAFS-devel] afs_pam2 - A simplier approach to AFS integration during login

Kyle Moffett mrmacman_g4@mac.com
Fri, 15 Apr 2005 18:52:49 -0400


On Apr 15, 2005, at 14:08, Russ Allbery wrote:
> Derrick J Brashear <shadow@dementia.org> writes:
>
>> Well, I guess it boils down to "do you care that you effectively leak 
>> a
>> thread to use rx". You can avoid leaking the thread (by shutting down
>> rx), but it gets messier when the pam caller is long-running and calls
>> pam a lot (like an authentication daemon)
>
> Well, ick.
>
> Can the PAM module itself shut down rx at the end of every routine?  
> That
> might make it slower, but it should prevent the leak.  (I assume it's 
> not
> just one leaked thread, but a new thread each time the PAM caller 
> tries to
> authenticate someone else?)

Why not just shut down the thread in your PAM resource cleanup routine?
It's kinda complicated, especially if you want to support multithreaded
PAM apps, but basically each PAM handle can have resources attached to
it by name.  When the PAM handle is destroyed or the resource 
overwritten,
the resource's registered cleanup function vector is called.  If you use
that to free up memory and stop the thread if the last request just 
ended,
then everything should work properly.

Cheers,
Kyle Moffett

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCM/CS/IT/U d- s++: a18 C++++>$ UB/L/X/*++++(+)>$ P+++(++++)>$
L++++(+++) E W++(+) N+++(++) o? K? w--- O? M++ V? PS+() PE+(-) Y+
PGP+++ t+(+++) 5 X R? tv-(--) b++++(++) DI+ D+ G e->++++$ h!*()>++$ r  
!y?(-)
------END GEEK CODE BLOCK------