Loading fs/src/fuse_ops/permission.cpp +14 −9 Original line number Diff line number Diff line Loading @@ -12,25 +12,30 @@ int chk_access(const Metadata& md, const int mode) { if (fuse_get_context()->uid == 0) return 0; // mode should be unsigned int. Init here. //check user //check user leftmost 3 bits for rwx in md->mode if (md.uid() == fuse_get_context()->uid) { ADAFS_DATA->logger->info("Metadata UID: {}, fuse context uid: {}, mode: {}", md.uid(), fuse_get_context()->uid, mode); // XXX // Because mode comes only with the first 3 bits used, the user bits have to be shifted to the right to compare if ((mode & md.mode() >> 6) == (unsigned int) mode) return 0; else return -EACCES; } //check group //check group middle 3 bits for rwx in md->mode if (md.gid() == fuse_get_context()->gid) { ADAFS_DATA->logger->info("Metadata GID: {}, fuse context gid: {}, mode: {}", md.uid(), fuse_get_context()->gid, mode); // XXX if ((mode & md.mode() >> 3) == (unsigned int) mode) return 0; else return -EACCES; } //check public ADAFS_DATA->logger->info("mode {}, mdi mode: {}, mdi & mode {}", mode, (int) md.mode(), (mode & md.mode())); if ((mode & (int) md.mode()) == mode) { //check other rightmost 3 bits for rwx in md->mode. // Because they are the rightmost bits they don't need to be shifted if ((mode & md.mode()) == (unsigned int) mode) { return 0; } Loading Loading
fs/src/fuse_ops/permission.cpp +14 −9 Original line number Diff line number Diff line Loading @@ -12,25 +12,30 @@ int chk_access(const Metadata& md, const int mode) { if (fuse_get_context()->uid == 0) return 0; // mode should be unsigned int. Init here. //check user //check user leftmost 3 bits for rwx in md->mode if (md.uid() == fuse_get_context()->uid) { ADAFS_DATA->logger->info("Metadata UID: {}, fuse context uid: {}, mode: {}", md.uid(), fuse_get_context()->uid, mode); // XXX // Because mode comes only with the first 3 bits used, the user bits have to be shifted to the right to compare if ((mode & md.mode() >> 6) == (unsigned int) mode) return 0; else return -EACCES; } //check group //check group middle 3 bits for rwx in md->mode if (md.gid() == fuse_get_context()->gid) { ADAFS_DATA->logger->info("Metadata GID: {}, fuse context gid: {}, mode: {}", md.uid(), fuse_get_context()->gid, mode); // XXX if ((mode & md.mode() >> 3) == (unsigned int) mode) return 0; else return -EACCES; } //check public ADAFS_DATA->logger->info("mode {}, mdi mode: {}, mdi & mode {}", mode, (int) md.mode(), (mode & md.mode())); if ((mode & (int) md.mode()) == mode) { //check other rightmost 3 bits for rwx in md->mode. // Because they are the rightmost bits they don't need to be shifted if ((mode & md.mode()) == (unsigned int) mode) { return 0; } Loading