ASSERT_EQ(0, ceph_create(&admin, NULL));
ASSERT_EQ(0, ceph_conf_read_file(admin, NULL));
ASSERT_EQ(0, ceph_conf_parse_env(admin, NULL));
+ ASSERT_EQ(0, ceph_conf_set(admin, "client_permissions", "0"));
ASSERT_EQ(0, ceph_mount(admin, "/"));
ASSERT_EQ(0, ceph_mkdir(admin, dir.c_str(), 0755));
ASSERT_EQ(-EACCES, ceph_mount(cmount, "/"));
ASSERT_EQ(0, ceph_conf_set(cmount, "client_mount_uid", "123"));
ASSERT_EQ(0, ceph_conf_set(cmount, "client_mount_gid", "456"));
+ ASSERT_EQ(0, ceph_conf_set(cmount, "client_permissions", "0"));
ASSERT_EQ(0, ceph_mount(cmount, "/"));
// user bits
ceph_shutdown(admin);
}
+static int update_root_mode()
+{
+ struct ceph_mount_info *admin;
+ int r = ceph_create(&admin, NULL);
+ if (r < 0)
+ return r;
+ ceph_conf_read_file(admin, NULL);
+ ceph_conf_parse_env(admin, NULL);
+ ceph_conf_set(admin, "client_permissions", "false");
+ r = ceph_mount(admin, "/");
+ if (r < 0)
+ goto out;
+ r = ceph_chmod(admin, "/", 0777);
+out:
+ ceph_shutdown(admin);
+ return r;
+}
+
+
int main(int argc, char **argv)
{
+ int r = update_root_mode();
+ if (r < 0)
+ exit(1);
+
::testing::InitGoogleTest(&argc, argv);
srand(getpid());
rados_create(&cluster, NULL);
rados_conf_read_file(cluster, NULL);
rados_conf_parse_env(cluster, NULL);
- int r = rados_connect(cluster);
+ r = rados_connect(cluster);
if (r < 0)
exit(1);
ASSERT_EQ(0, ceph_conf_read_file(cmount, NULL));
ASSERT_EQ(0, ceph_mount(cmount, "/"));
ASSERT_EQ(0, ceph_conf_set(cmount, "client_acl_type", "posix_acl"));
+ ASSERT_EQ(0, ceph_conf_set(cmount, "client_permissions", "0"));
char test_file[256];
sprintf(test_file, "file1_setacl_%d", getpid());
// change ownership to nobody -- we assume nobody exists and id is always 65534
ASSERT_EQ(ceph_fchown(cmount, fd, 65534, 65534), 0);
+ ASSERT_EQ(0, ceph_conf_set(cmount, "client_permissions", "1"));
ASSERT_EQ(ceph_open(cmount, test_file, O_RDWR, 0), -EACCES);
+ ASSERT_EQ(0, ceph_conf_set(cmount, "client_permissions", "0"));
size_t acl_buf_size = acl_ea_size(5);
void *acl_buf = malloc(acl_buf_size);
ASSERT_EQ(ceph_fchmod(cmount, fd, 0600), 0);
// change ownership to nobody -- we assume nobody exists and id is always 65534
+ ASSERT_EQ(ceph_conf_set(cmount, "client_permissions", "0"), 0);
ASSERT_EQ(ceph_fchown(cmount, fd, 65534, 65534), 0);
+ ASSERT_EQ(ceph_conf_set(cmount, "client_permissions", "1"), 0);
ceph_close(cmount, fd);