[PATCH] Require a "path" parameter for filesystem back ends.
Jeff Darcy
jdarcy at redhat.com
Mon Sep 27 16:22:30 UTC 2010
On 09/27/2010 12:19 PM, Jim Meyering wrote:
> Using chroot would mean that iwhd may be run only by a privileged (root) user.
What if we went with just the chdir, then, plus the prohibition on ..
escapes? Seems a bit less of a pain (and more portable) than using the
*at functions everywhere, unless there are other kinds of escapes we
should be worried about (and that don't equally affect *at).
> I suggest to instead open the base/root-to-be directory (better not to
> call it "path", since path is often used to refer to a "search path") and
> retain the resulting file descriptor. Then, any FS-relative
> operation can use the *at functions like mkdirat, openat, etc.
> that are fd-directory-relative.
>
> If you're interested, I'll be happy to work on the alternate patch.
That would be fine, too.
>
> ...
>> fs_init (void)
>> {
>> + DPRINTF("changing directory to %s\n",local_path);
>> + if (chroot(local_path) < 0) {
>> + error(0,errno,"chroot failed, unsafe to continue\n");
>> + exit(!0); /* Value doesn't matter, as long as it's not zero. */
>> + }
More information about the iwhd-devel
mailing list