Only allow directory reads at the root level
This commit is contained in:
parent
6288fbbd31
commit
13238344bf
10
src/main.rs
10
src/main.rs
@ -25,7 +25,15 @@ impl fs_rpc::Server for Serv {
|
||||
Ok((Some(device_pid), fd))
|
||||
}
|
||||
|
||||
fn open_dir(&self, _path: &std::path::Path, _mount_id: u64) -> Result<(Option<u64>, u64), Errno> {
|
||||
fn open_dir(&self, path: &std::path::Path, _mount_id: u64) -> Result<(Option<u64>, u64), Errno> {
|
||||
let path = path.to_str().ok_or(Errno::EINVALDAT)?;
|
||||
if !path.is_empty() {
|
||||
if self.devices.read().contains_key(path) {
|
||||
return Err(Errno::ENOTDIR);
|
||||
} else {
|
||||
return Err(Errno::ENOENT);
|
||||
}
|
||||
}
|
||||
let entries = self.devices.read().keys().cloned().collect::<Vec<_>>();
|
||||
self.dirs
|
||||
.write()
|
||||
|
Loading…
Reference in New Issue
Block a user