SMB shares and NFS exports may now point to any existing directory (USB disks under /mnt or /media, /srv, home folders...) instead of only ZFS dataset mountpoints. System trees (/etc, /usr, /var, /boot, /proc, /root, ...) are refused, also after resolving symlinks. The path suggestions list mounted data filesystems from /proc/self/mounts in addition to ZFS mountpoints. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -89,7 +89,18 @@ func newTestServer(t *testing.T) (*Server, *sched.Scheduler, *store.Store) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
srv := New(cfg, st, ring, sc, shs)
|
||||
srv.dirExists = func(p string) bool { return strings.HasPrefix(p, "/tank") || strings.HasPrefix(p, "/tmp_pool") }
|
||||
srv.dirExists = func(p string) bool {
|
||||
return strings.HasPrefix(p, "/tank") || strings.HasPrefix(p, "/tmp_pool") || strings.HasPrefix(p, "/srv")
|
||||
}
|
||||
srv.realPath = func(p string) (string, error) {
|
||||
if p == "/srv/evil" { // symlink into a system directory
|
||||
return "/etc", nil
|
||||
}
|
||||
return p, nil
|
||||
}
|
||||
srv.readMounts = func() string {
|
||||
return "proc /proc proc rw 0 0\n/dev/sda2 / ext4 rw 0 0\ntank/data /tank/data zfs rw 0 0\n/dev/sdc1 /mnt/usb ext4 rw 0 0\n"
|
||||
}
|
||||
return srv, sc, st
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user