mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-05 12:12:28 +00:00
Make improvements
- Introduce path module to redbean - Fix glitch with linenoise printing extra line on eof - Introduce closefrom() and close_range() system calls - Make file descriptor closing more secure in pledge.com
This commit is contained in:
parent
439ad21b12
commit
1837dc2e85
31 changed files with 806 additions and 75 deletions
|
@ -182,6 +182,18 @@ TEST(unveil, dirfdHacking_doesntWork) {
|
|||
EXITS(0);
|
||||
}
|
||||
|
||||
TEST(unveil, mostRestrictivePolicy) {
|
||||
if (IsOpenbsd()) return; // openbsd behaves oddly; see docs
|
||||
SPAWN();
|
||||
ASSERT_SYS(0, 0, mkdir("jail", 0755));
|
||||
ASSERT_SYS(0, 0, mkdir("garden", 0755));
|
||||
ASSERT_SYS(0, 0, touch("garden/secret.txt", 0644));
|
||||
ASSERT_SYS(0, 0, unveil(0, 0));
|
||||
ASSERT_SYS(EACCES_OR_ENOENT, -1, open("jail", O_RDONLY | O_DIRECTORY));
|
||||
ASSERT_SYS(EACCES_OR_ENOENT, -1, open("garden/secret.txt", O_RDONLY));
|
||||
EXITS(0);
|
||||
}
|
||||
|
||||
TEST(unveil, overlappingDirectories_inconsistentBehavior) {
|
||||
SPAWN();
|
||||
ASSERT_SYS(0, 0, makedirs("f1/f2", 0755));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue