mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
safer vfs defaults
This commit is contained in:
parent
7cb3887996
commit
a0ccd2b68f
|
@ -238,8 +238,12 @@ class AuthSrv(object):
|
||||||
with open(cfg_fn, "rb") as f:
|
with open(cfg_fn, "rb") as f:
|
||||||
self._parse_config_file(f, user, mread, mwrite, mount)
|
self._parse_config_file(f, user, mread, mwrite, mount)
|
||||||
|
|
||||||
# -h says our defaults are CWD at root and read/write for everyone
|
if not mount:
|
||||||
vfs = VFS(os.path.abspath("."), "", ["*"], ["*"])
|
# -h says our defaults are CWD at root and read/write for everyone
|
||||||
|
vfs = VFS(os.path.abspath("."), "", ["*"], ["*"])
|
||||||
|
elif not "" in mount:
|
||||||
|
# there's volumes but no root; make root inaccessible
|
||||||
|
vfs = VFS(os.path.abspath("."), "", [], [])
|
||||||
|
|
||||||
maxdepth = 0
|
maxdepth = 0
|
||||||
for dst in sorted(mount.keys(), key=lambda x: (x.count("/"), len(x))):
|
for dst in sorted(mount.keys(), key=lambda x: (x.count("/"), len(x))):
|
||||||
|
|
|
@ -225,11 +225,11 @@ class TestVFS(unittest.TestCase):
|
||||||
self.assertEqual(au.user["a"], "123")
|
self.assertEqual(au.user["a"], "123")
|
||||||
self.assertEqual(au.user["asd"], "fgh:jkl")
|
self.assertEqual(au.user["asd"], "fgh:jkl")
|
||||||
n = au.vfs
|
n = au.vfs
|
||||||
# root was not defined, so PWD with everyone r/w
|
# root was not defined, so PWD with no access to anyone
|
||||||
self.assertEqual(n.vpath, "")
|
self.assertEqual(n.vpath, "")
|
||||||
self.assertEqual(n.realpath, td)
|
self.assertEqual(n.realpath, td)
|
||||||
self.assertEqual(n.uread, ["*"])
|
self.assertEqual(n.uread, [])
|
||||||
self.assertEqual(n.uwrite, ["*"])
|
self.assertEqual(n.uwrite, [])
|
||||||
self.assertEqual(len(n.nodes), 1)
|
self.assertEqual(len(n.nodes), 1)
|
||||||
n = n.nodes["dst"]
|
n = n.nodes["dst"]
|
||||||
self.assertEqual(n.vpath, "dst")
|
self.assertEqual(n.vpath, "dst")
|
||||||
|
|
Loading…
Reference in a new issue