Lines Matching +full:auto +full:- +full:mode

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
62 /* With -o default_permissions, FUSE_ACCESS should never be called */ in SetUp()
64 ResultOf([=](auto in) { in SetUp()
72 void expect_chmod(uint64_t ino, mode_t mode, uint64_t size = 0) in expect_chmod() argument
75 ResultOf([=](auto in) { in expect_chmod()
79 in.body.setattr.mode == mode); in expect_chmod()
82 ).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) { in expect_chmod()
85 out.body.attr.attr.mode = S_IFREG | mode; in expect_chmod()
94 ResultOf([=](auto in) { in expect_create()
101 ).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) { in expect_create()
103 out.body.create.entry.attr.mode = S_IFREG | 0644; in expect_create()
114 ResultOf([=](auto in) { in expect_copy_file_range()
123 ).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) { in expect_copy_file_range()
129 void expect_getattr(uint64_t ino, mode_t mode, uint64_t attr_valid, int times, in expect_getattr() argument
133 ResultOf([=](auto in) { in expect_getattr()
139 .WillRepeatedly(Invoke(ReturnImmediate([=](auto i __unused, auto& out) { in expect_getattr()
142 out.body.attr.attr.mode = mode; in expect_getattr()
150 void expect_lookup(const char *relpath, uint64_t ino, mode_t mode, in expect_lookup() argument
153 FuseTest::expect_lookup(relpath, ino, mode, 0, 1, attr_valid, uid, gid); in expect_lookup()
184 ResultOf([=](auto in) { in expect_removexattr()
197 ResultOf([=](auto in) { in expect_getxattr()
210 ResultOf([=](auto in) { in expect_listxattr()
214 ).WillOnce(Invoke(ReturnImmediate([](auto i __unused, auto& out) { in expect_listxattr()
230 ResultOf([=](auto in) { in expect_rename()
243 ResultOf([=](auto in) { in expect_setxattr()
329 const mode_t mode = 0755; in TEST_F() local
335 expect_lookup(RELPATH, ino, S_IFREG | mode, UINT64_MAX, uid); in TEST_F()
338 ResultOf([](auto in) { in TEST_F()
342 ).WillRepeatedly(Invoke(ReturnImmediate([=](auto in __unused, auto& out){ in TEST_F()
344 out.body.attr.attr.mode = S_IFREG | mode; in TEST_F()
348 EXPECT_EQ(0, chown(FULLPATH, uid, -1)) << strerror(errno); in TEST_F()
352 * A successful chown by a non-privileged non-owner should clear a file's SUID
368 ResultOf([=](auto in) { in TEST_F()
372 in.body.setattr.mode == newmode); in TEST_F()
375 ).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) { in TEST_F()
378 out.body.attr.attr.mode = S_IFREG | newmode; in TEST_F()
382 EXPECT_EQ(0, chown(FULLPATH, uid, -1)) << strerror(errno); in TEST_F()
392 const mode_t mode = 0755; in TEST_F() local
395 expect_lookup(RELPATH, ino, S_IFREG | mode, UINT64_MAX, geteuid()); in TEST_F()
397 ResultOf([](auto in) { in TEST_F()
403 EXPECT_NE(0, chown(FULLPATH, 0, -1)); in TEST_F()
408 * A successful chgrp by a non-privileged non-owner should clear a file's SUID
425 ResultOf([=](auto in) { in TEST_F()
429 in.body.setattr.mode == newmode); in TEST_F()
432 ).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) { in TEST_F()
435 out.body.attr.attr.mode = S_IFREG | newmode; in TEST_F()
439 EXPECT_EQ(0, chown(FULLPATH, -1, gid)) << strerror(errno); in TEST_F()
442 /* non-root users may only chgrp a file to a group they belong to */
448 const mode_t mode = 0755; in TEST_F() local
457 expect_lookup(RELPATH, ino, S_IFREG | mode, UINT64_MAX, uid, gid); in TEST_F()
459 ResultOf([](auto in) { in TEST_F()
465 EXPECT_NE(0, chown(FULLPATH, -1, newgid)); in TEST_F()
474 const mode_t mode = 0755; in TEST_F() local
483 expect_lookup(RELPATH, ino, S_IFREG | mode, UINT64_MAX, uid, gid); in TEST_F()
486 ResultOf([](auto in) { in TEST_F()
491 ).WillRepeatedly(Invoke(ReturnImmediate([=](auto in __unused, auto& out){ in TEST_F()
493 out.body.attr.attr.mode = S_IFREG | mode; in TEST_F()
498 EXPECT_EQ(0, chown(FULLPATH, -1, newgid)) << strerror(errno); in TEST_F()
501 /* A write by a non-owner should clear a file's SGID bit */
545 /* A write by a non-owner should clear a file's SUID bit */
615 ASSERT_EQ(-1, open(FULLPATH, O_CREAT | O_EXCL, 0644)); in TEST_F()
629 ASSERT_EQ(-1, extattr_delete_file(FULLPATH, ns, "foo")); in TEST_F()
659 ASSERT_EQ(-1, extattr_delete_file(FULLPATH, ns, "foo")); in TEST_F()
670 const mode_t mode = 0666; in TEST_F() local
678 expect_lookup(RELPATH, ino, S_IFREG | mode, UINT64_MAX, owner); in TEST_F()
680 ResultOf([](auto in) { in TEST_F()
687 ).WillOnce(Invoke(ReturnImmediate([](auto in __unused, auto& out) { in TEST_F()
689 out.body.attr.attr.mode = S_IFREG | mode; in TEST_F()
703 const mode_t mode = 0444; in TEST_F() local
711 expect_lookup(RELPATH, ino, S_IFREG | mode, UINT64_MAX, owner); in TEST_F()
744 ASSERT_EQ(-1, in TEST_F()
764 ReturnImmediate([&](auto in __unused, auto& out) { in TEST_F()
787 ASSERT_EQ(-1, in TEST_F()
802 ASSERT_EQ(-1, extattr_list_file(FULLPATH, ns, NULL, 0)); in TEST_F()
834 ASSERT_EQ(-1, extattr_list_file(FULLPATH, ns, NULL, 0)); in TEST_F()
838 /* A write by a non-owner should clear a file's SGID bit */
872 /* A write by a non-owner should clear a file's SUID bit */
946 EXPECT_EQ(-1, access(FULLPATH, F_OK)); in TEST_F()
959 EXPECT_EQ(-1, open(FULLPATH, O_RDWR)); in TEST_F()
979 /* A write by a non-owner should clear a file's SGID bit */
1009 /* A write by a non-owner should clear a file's SUID bit */
1079 ASSERT_EQ(-1, rename(FULLSRC, FULLDST)); in TEST_F()
1098 ASSERT_EQ(-1, rename(FULLSRC, FULLDST)); in TEST_F()
1117 ASSERT_EQ(-1, rename(FULLSRC, FULLDST)); in TEST_F()
1131 ASSERT_EQ(-1, rename(FULLSRC, FULLDST)); in TEST_F()
1154 ASSERT_EQ(-1, rename(FULLSRC, FULLDST)); in TEST_F()
1194 .WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) { in TEST_F()
1196 out.body.entry.attr.mode = S_IFREG | 0644; in TEST_F()
1203 ASSERT_EQ(-1, rename(FULLSRC, FULLDST)); in TEST_F()
1214 // The inode of the already-existing destination file in TEST_F()
1262 ResultOf([&](auto in) { in TEST_F()
1292 ResultOf([](auto in) { in TEST_F()
1295 in.body.setattr.mode == newmode); in TEST_F()
1298 ).WillOnce(Invoke(ReturnImmediate([](auto in __unused, auto& out) { in TEST_F()
1300 out.body.attr.attr.mode = S_IFREG | newmode; in TEST_F()
1317 ResultOf([](auto in) { in TEST_F()
1337 const mode_t mode = 0000; in TEST_F() local
1345 ResultOf([](auto in) { in TEST_F()
1351 ).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) { in TEST_F()
1354 out.body.attr.attr.mode = S_IFREG | mode; in TEST_F()
1381 ResultOf([](auto in) { in TEST_F()
1391 /* Only the superuser may set the sticky bit on a non-directory */
1403 ResultOf([](auto in) { in TEST_F()
1444 ASSERT_EQ(-1, extattr_set_file(FULLPATH, ns, "foo", (const void*)value, in TEST_F()
1462 ASSERT_EQ(-1, extattr_set_file(FULLPATH, ns, "foo", (const void*)value, in TEST_F()
1524 ReturnImmediate([=](auto i __unused, auto& out) { in TEST_F()
1526 out.body.entry.attr.mode = S_IFREG | 0644; in TEST_F()
1535 ASSERT_EQ(-1, unlink(FULLPATH)); in TEST_F()
1548 ASSERT_EQ(-1, unlink(FULLPATH)); in TEST_F()
1561 ASSERT_EQ(-1, unlink(FULLPATH)); in TEST_F()
1565 /* A write by a non-owner should clear a file's SUID bit */
1591 /* A write by a non-owner should clear a file's SGID bit */
1617 /* Regression test for a specific recurse-of-nonrecursive-lock panic