[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Problems with Hurd's unlink in visudo



Hi,

Thanks for the responses.

On Sat, 14 Jan 2012 20:28:40 +0100
Pino Toscano <pino@debian.org> wrote:

> I did a bit of debug, and it seems sudo needs a fix, but a different 
> one.
> Basically, when parsing the specified sudoers file (or the default one), 
> the "sudoerslist" list is populated with the file being edit and, 
> recursively, all the files in included directories (see 
> /etc/sudoers.d/README explaining the #includedir directive).
> In that list, all the elements are structs "sudoersfile"; only the 
> actual file being edit has the "doedit" member set to 1, and all the 
> included files 0. If you see the foreach at line 234 in the main() of 
> plugins/sudoers/visudo.c, all the !doedit files are skipped, and for the 
> other ones edit_sudoers() is called, which initialize the "tpath" member 
> if NULL. This means that later in main(), at the foreach at line 249, we 
> can just skip the !doedit files as done in the foreach above. And 
> actually, the crash happened in that foreach, while trying to unlink() 
> the "tpath" of the "sudoersfile" representing... /etc/sudoers.d/README.
> Most probably the other archs don't mind, as their unlink() returns (at 
> least on Linux and kFreeBSD) EFAULT (which is ignored anyway).

Ah, I see that now. Thanks, I should have dug a little deeper there
myself.

> +1 on the patch already sent (you can usually avoid sending changes of 
> autogenerated files like configure).

I included configure in the diff because it doesn't seem to get
generated during package build, so the changes to it need to be applied
by the patch in order to take effect.

> If you can give my fix a try, we could send this too.

I've tested it, and it seems to work without any problems. I'll be
sending this patch with a bug report on sudo shortly.

Thanks again,
Steven.

Attachment: signature.asc
Description: PGP signature


Reply to: