[SSSD] [PATCH] File descriptor leak in nss responder.

Simo Sorce simo at redhat.com
Thu Mar 7 14:18:47 UTC 2013


On Thu, 2013-03-07 at 15:02 +0100, Michal Židek wrote:
> On 03/07/2013 02:42 PM, Simo Sorce wrote:
> > On Thu, 2013-03-07 at 13:44 +0100, Michal Židek wrote:
> >> Ok :)
> >> So I removed the unlink() from destructor (and the sss_mc_set_recycled
> >> with it). I added new dret variable to catch return value from
> >> unlink()
> >> in the done: part of sss_mc_create_file(), so that we do not overwrite
> >> the original error code.
> >>
> >> Also the mc_ctx->fd should be set to -1 if the file construction in
> >> sss_mc_create_file (so that we do not try to close garbage file
> >> descriptor in the destructor). So I added this too.
> >>
> >> New patches are attached.
> >
> > I still see the unlink in the destructor ...
> >
> > Simo.
> >>
> 
> Sorry, I had uncommited change in git.
> 
> Here is the correct patch.

Uhmm I just realized you moved the unlink() operation in
sss_mc_create_file(), but I am not sure why you did that.

We need to unconditionally remove the file, even if the open() fails,
otherwise if the file is left around the next open with O_CREATE will
fail.

Simo.

-- 
Simo Sorce * Red Hat, Inc * New York




More information about the sssd-devel mailing list