patch: fix FUSE permission

1. fuse flag check made wrong, fix it
2. but still mount will RO flag

Signed-off-by: ClSlaid <cailue@bupt.edu.cn>
This commit is contained in:
ClSlaid 2023-10-20 19:21:40 +08:00
parent fc3187a781
commit c529f8099d
No known key found for this signature in database
GPG Key ID: E0A5F564C51C056E
2 changed files with 3 additions and 18 deletions

View File

@ -300,11 +300,6 @@ impl fuser::Filesystem for FuseServer {
reply.error(libc::EBUSY);
return;
}
if flags & libc::O_RDONLY == 0 {
log::error!("fuse: entry is read only");
reply.error(libc::EACCES);
return;
}
let fh = self.alloc_fd();
entry.add_handler(fh);
@ -409,12 +404,7 @@ impl fuser::Filesystem for FuseServer {
log::error!("fuse: open: entry is not a file");
return;
}
// check flags
if flags & libc::O_RDONLY == 0 {
reply.error(libc::EACCES);
log::error!("fuse: open: entry is read only");
return;
}
// check gc
if entry.marked() {
reply.error(libc::EBUSY);
@ -435,7 +425,7 @@ impl fuser::Filesystem for FuseServer {
fh: u64,
offset: i64,
size: u32,
flags: i32,
_flags: i32,
_lock_owner: Option<u64>,
reply: fuser::ReplyData,
) {
@ -455,12 +445,6 @@ impl fuser::Filesystem for FuseServer {
log::error!("fuse: read: entry is not a file");
return;
}
// check flags
if flags & libc::O_RDONLY == 0 {
reply.error(libc::EACCES);
log::error!("fuse: read: entry is read only");
return;
}
if entry.marked() {
reply.error(libc::EBUSY);

View File

@ -132,6 +132,7 @@ impl ClipboardContext {
let mnt_opts = [
MountOption::FSName("rustdesk-cliprdr-fs".to_string()),
MountOption::NoAtime,
MountOption::RO,
];
log::info!(
"mounting clipboard FUSE to {}",