File descriptor leak in pam_winbind.so

Steve Langasek vorlon at netexpress.net
Thu Aug 29 12:45:01 GMT 2002


On Thu, Aug 29, 2002 at 09:14:20PM +0100, Paul flinders wrote:
> > On Thu, Aug 29, 2002 at 07:49:22AM -0400, jra at dp.samba.org wrote:
> >> On Thu, Aug 29, 2002 at 05:44:51PM +0100, Paul Flinders wrote:
> >> >   	return retval;
> >> > + }
> >> > +
> >> > + void __attribute__ ((destructor))  unload ()
> >> > + {
> >> > + 	/* Make sure socket is closed on unload of dll, some apps use PAM
> >> in + 	   a manner which leaks FDs otherwise */
> >> > + 	close_sock();

> >> This is *horribly* non-portable I'm afraid. If you need this
> >> can you provide an autoconf test that will determine if this
> >> hideous construct (__attribute__ ((destructor))  unload ()) is
> >> supported on the current platform/compiler.

> > The portable solution in PAM is to register a module cleanup function
> > using pam_data(), to ensure that the socket is closed when pam_end() is
> > called.

> OK, I'll have a look at that.

Hmm, you might have an easier time of it if I gave you the correct
function name -- pam_set_data().  In this case, 'data' should be a
pointer to a data blob containing all the information you need to know
about the open socket, and 'cleanup' is the callback function used to
close the socket (and do any other housekeeping chores that might come
up).

Steve Langasek
postmodern programmer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20020829/de8757ea/attachment.bin


More information about the samba-technical mailing list