bug-gnulib
[Top][All Lists]
Advanced

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

Re: gnu tar 1.19 requires open() with O_DIRECTORY?


From: John E. Malmberg
Subject: Re: gnu tar 1.19 requires open() with O_DIRECTORY?
Date: Wed, 20 Feb 2008 19:23:01 -0600
User-agent: Thunderbird 2.0.0.9 (Windows/20071031)

Eric Blake wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to John E. Malmberg on 2/18/2008 8:46 PM:
| I have run into a problem: GNU TAR now requires that the open() call
| support O_DIRECTORY.

Tar is using O_DIRECTORY to close a security hole, and not to directly
read the directory contents.  And POSIX requires that a directory be
openable read-only, even though reads on such a fd are allowed to fail.

I could not find that Posix specification on the web, not even a draft.
The X/Open standard which was what was used as a guideline for the VMS DECC RTL, does not explicitly make state that open() has that requirement, but the description from the error codes implies that opening a directory for read should be allowed.

So I can submit a bug report, but I doubt that a fix would show up anytime soon, or in older versions.

Gnulib's replacemente <fcntl.h> should detect platforms that lack
O_DIRECTORY, and define it to 0 on those platforms.

It did detect it and make the definition.

The trick now is figuring out why gnulib's <fcntl.h> didn't work for VMS;
it may also be necessary to provide a replacement open() that can
> 'support' opening directories by using opendir under the hood.

The open() would have to open or dup a file descriptor to the /dev/null device to reserve a unique file descriptor, and then something needs to map that file descriptor back to the pointer to the *DIR structure.

Now how to implement this in a way that will work with the rest of the wrappers?

Regards,
-John
address@hidden
Personal Opinion Only





reply via email to

[Prev in Thread] Current Thread [Next in Thread]