mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 22:03:31 +01:00
Make test_glob() pass even when run as root.
Previously the test relied on not being able to look inside 000 directories, which is a thing root _can_ do. Bug not in any released Tor version.
This commit is contained in:
parent
effc9739bf
commit
7b4716a762
@ -4622,11 +4622,14 @@ test_util_glob(void *ptr)
|
||||
TEST("\\*");
|
||||
EXPECT_EMPTY();
|
||||
|
||||
// test forbidden directory
|
||||
tor_asprintf(&pattern, "%s"PATH_SEPARATOR"*"PATH_SEPARATOR"*", dirname);
|
||||
results = tor_glob(pattern);
|
||||
tor_free(pattern);
|
||||
tt_assert(!results);
|
||||
if (getuid() != 0) {
|
||||
// test forbidden directory, if we're not root.
|
||||
// (Root will be able to see this directory anyway.)
|
||||
tor_asprintf(&pattern, "%s"PATH_SEPARATOR"*"PATH_SEPARATOR"*", dirname);
|
||||
results = tor_glob(pattern);
|
||||
tor_free(pattern);
|
||||
tt_assert(!results);
|
||||
}
|
||||
#endif
|
||||
|
||||
#undef TEST
|
||||
|
Loading…
Reference in New Issue
Block a user