[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: rm patch suggestion
From: |
Marcus Brinkmann |
Subject: |
Re: rm patch suggestion |
Date: |
Tue, 7 May 2002 23:13:36 +0200 |
User-agent: |
Mutt/1.3.28i |
On Tue, May 07, 2002 at 10:50:13PM +0200, Oystein Viggen wrote:
> It seems that even if you open() a directory when it is not a
> translator, and then fchdir() into it, you will still end up inside any
> translator that is placed there in the meantime. (I would expect to end
> up within the underlying directory, but no such luck.)
Oh, darn, from the source (man, read the source, man!):
int
_hurd_change_directory_port_from_fd (struct hurd_port *portcell, int fd)
{
int ret;
struct hurd_fd *d = _hurd_fd_get (fd);
if (!d)
return __hurd_fail (EBADF);
HURD_CRITICAL_BEGIN;
ret = HURD_PORT_USE (&d->port,
({
int ret;
file_t dir = __file_name_lookup_under (port, ".",
0, 0);
if (dir == MACH_PORT_NULL)
ret = -1;
else
{
_hurd_port_set (portcell, dir);
ret = 0;
}
ret;
}));
HURD_CRITICAL_END;
return ret;
}
and:
int
__fchdir (fd)
int fd;
{
return _hurd_change_directory_port_from_fd (&_hurd_ports[INIT_PORT_CWDIR],
fd);
}
So, it does indeed look up "." before it makes it the current directory.
(port cell would be CWDIR).
Just use setcwdir() from hurd.h, this should work. I didn't find it
initially, because I stopped looking when I found the above function
(without looking at the implementation).
> This means that I can think of no safe way of changing into a directory
> owned by an untrusted user involving only "Unix space". (Is this even
> desirable, or should we just accept it as a fact that traditional Unix
> features are unable to deal with Hurd specific features?)
Well, as Unix doesn't know about translators, it is not so important to find
a solution using only Unix interfaces. The setcwdir() function should work
fine, it bypasses all checks and simply makes the file port your current
directory port.
Thanks,
Marcus
--
`Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org
Marcus Brinkmann GNU http://www.gnu.org marcus@gnu.org
Marcus.Brinkmann@ruhr-uni-bochum.de
http://www.marcus-brinkmann.de
- Re: rm patch suggestion, (continued)
- Re: rm patch suggestion, Oystein Viggen, 2002/05/07
- Re: rm patch suggestion, Marcus Brinkmann, 2002/05/07
- Re: rm patch suggestion, Roland McGrath, 2002/05/07
- Re: rm patch suggestion, Marcus Brinkmann, 2002/05/07
- Re: rm patch suggestion, Oystein Viggen, 2002/05/07
- Re: rm patch suggestion, Marcus Brinkmann, 2002/05/07
- Re: rm patch suggestion, Neal H Walfield, 2002/05/07
- Re: rm patch suggestion, Roland McGrath, 2002/05/07
- Re: rm patch suggestion, Niels Möller, 2002/05/07
- Re: rm patch suggestion, Oystein Viggen, 2002/05/07
- Re: rm patch suggestion,
Marcus Brinkmann <=
- Re: rm patch suggestion, Niels Möller, 2002/05/07
- Re: rm patch suggestion, Marcus Brinkmann, 2002/05/07
- Re: rm patch suggestion, Niels Möller, 2002/05/08
- Re: rm patch suggestion, Marcus Brinkmann, 2002/05/08
- Re: rm patch suggestion, Niels Möller, 2002/05/08
- Re: rm patch suggestion, Marcus Brinkmann, 2002/05/08
- Re: rm patch suggestion, Roland McGrath, 2002/05/07
- Re: rm patch suggestion, Oystein Viggen, 2002/05/08
- Re: rm patch suggestion, Roland McGrath, 2002/05/08
- Re: rm patch suggestion, Oystein Viggen, 2002/05/08