003 File Manager
Current Path:
/usr/src/contrib/capsicum-test
usr
/
src
/
contrib
/
capsicum-test
/
📁
..
📄
.gitignore
(235 B)
📄
CONTRIBUTING.md
(880 B)
📄
GNUmakefile
(2.22 KB)
📄
LICENSE
(1.4 KB)
📄
README.md
(2.7 KB)
📄
capability-fd-pair.cc
(5.52 KB)
📄
capability-fd.cc
(42.15 KB)
📄
capmode.cc
(19.24 KB)
📄
capsicum-freebsd.h
(1.97 KB)
📄
capsicum-linux.h
(1.17 KB)
📄
capsicum-rights.h
(2.86 KB)
📄
capsicum-test-main.cc
(4.23 KB)
📄
capsicum-test.cc
(2.63 KB)
📄
capsicum-test.h
(9.9 KB)
📄
capsicum.h
(4.49 KB)
📄
fcntl.cc
(14.48 KB)
📄
fexecve.cc
(6.08 KB)
📄
ioctl.cc
(6.93 KB)
📄
linux.cc
(48.75 KB)
📄
makefile
(1.59 KB)
📄
mini-me.c
(1.04 KB)
📄
mqueue.cc
(3.24 KB)
📄
openat.cc
(14.52 KB)
📄
overhead.cc
(1.28 KB)
📄
procdesc.cc
(26.95 KB)
📄
rename.cc
(1.59 KB)
📄
sctp.cc
(7.14 KB)
📄
select.cc
(4 KB)
📄
showrights
(4.81 KB)
📄
smoketest.c
(4.86 KB)
📄
socket.cc
(10.56 KB)
📄
syscalls.h
(8.36 KB)
📄
sysctl.cc
(403 B)
📄
waittest.c
(1 KB)
Editing: rename.cc
#include <fcntl.h> #include <sys/stat.h> #include "./capsicum-test.h" // There was a Capsicum-related regression in FreeBSD renameat, // which affects certain cases independent of Capsicum or capability mode // // added to test the renameat syscall for the case that // - the "to" file already exists // - the "to" file is specified by an absolute path // - the "to" file descriptor is used // (this descriptor should be ignored if absolute path is provided) // // details at: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=222258 const char * create_tmp_src(const char* filename) { const char *src_path = TmpFile(filename); int src_fd = open(src_path, O_CREAT|O_RDWR, 0644); close(src_fd); return src_path; } TEST(Rename, AbsDesignationSame) { const char *src_path = create_tmp_src("rename_test"); EXPECT_OK(rename(src_path, src_path)); unlink(src_path); } TEST(RenameAt, AbsDesignationSame) { const char *src_path = create_tmp_src("renameat_test"); const char *dir_path = TmpFile("renameat_test_dir"); EXPECT_OK(mkdir(dir_path, 0755)); // random temporary directory descriptor int dfd = open(dir_path, O_DIRECTORY); // Various rename from/to the same absolute path; in each case the source // and dest directory FDs should be irrelevant. EXPECT_OK(renameat(AT_FDCWD, src_path, AT_FDCWD, src_path)); EXPECT_OK(renameat(AT_FDCWD, src_path, dfd, src_path)); EXPECT_OK(renameat(dfd, src_path, AT_FDCWD, src_path)); EXPECT_OK(renameat(dfd, src_path, dfd, src_path)); close(dfd); rmdir(dir_path); unlink(src_path); }
Upload File
Create Folder