backports from IdP branch:

* allow mounting `/` (the entire filesystem) as a volume
  * not that you should (really, you shouldn't)
* improve `-v` helptext
* change IdP group symbol to @ because % is used for file inclusion
  * not technically necessary but is less confusing in docs
This commit is contained in:
ed 2024-01-25 21:39:30 +00:00
parent 55eb692134
commit 14bccbe45f
5 changed files with 15 additions and 13 deletions

View file

@ -838,7 +838,7 @@ def add_general(ap, nc, srvname):
ap2.add_argument("-nc", metavar="NUM", type=int, default=nc, help="max num clients") ap2.add_argument("-nc", metavar="NUM", type=int, default=nc, help="max num clients")
ap2.add_argument("-j", metavar="CORES", type=int, default=1, help="max num cpu cores, 0=all") ap2.add_argument("-j", metavar="CORES", type=int, default=1, help="max num cpu cores, 0=all")
ap2.add_argument("-a", metavar="ACCT", type=u, action="append", help="add account, \033[33mUSER\033[0m:\033[33mPASS\033[0m; example [\033[32med:wark\033[0m]") ap2.add_argument("-a", metavar="ACCT", type=u, action="append", help="add account, \033[33mUSER\033[0m:\033[33mPASS\033[0m; example [\033[32med:wark\033[0m]")
ap2.add_argument("-v", metavar="VOL", type=u, action="append", help="add volume, \033[33mSRC\033[0m:\033[33mDST\033[0m:\033[33mFLAG\033[0m; examples [\033[32m.::r\033[0m], [\033[32m/mnt/nas/music:/music:r:aed\033[0m]") ap2.add_argument("-v", metavar="VOL", type=u, action="append", help="add volume, \033[33mSRC\033[0m:\033[33mDST\033[0m:\033[33mFLAG\033[0m; examples [\033[32m.::r\033[0m], [\033[32m/mnt/nas/music:/music:r:aed\033[0m], see --help-accounts")
ap2.add_argument("-ed", action="store_true", help="enable the ?dots url parameter / client option which allows clients to see dotfiles / hidden files (volflag=dots)") ap2.add_argument("-ed", action="store_true", help="enable the ?dots url parameter / client option which allows clients to see dotfiles / hidden files (volflag=dots)")
ap2.add_argument("--urlform", metavar="MODE", type=u, default="print,get", help="how to handle url-form POSTs; see \033[33m--help-urlform\033[0m") ap2.add_argument("--urlform", metavar="MODE", type=u, default="print,get", help="how to handle url-form POSTs; see \033[33m--help-urlform\033[0m")
ap2.add_argument("--wintitle", metavar="TXT", type=u, default="cpp @ $pub", help="server terminal title, for example [\033[32m$ip-10.1.2.\033[0m] or [\033[32m$ip-]") ap2.add_argument("--wintitle", metavar="TXT", type=u, default="cpp @ $pub", help="server terminal title, for example [\033[32m$ip-10.1.2.\033[0m] or [\033[32m$ip-]")

View file

@ -381,7 +381,7 @@ class VFS(object):
def add(self, src: str, dst: str) -> "VFS": def add(self, src: str, dst: str) -> "VFS":
"""get existing, or add new path to the vfs""" """get existing, or add new path to the vfs"""
assert not src.endswith("/") # nosec assert src == "/" or not src.endswith("/") # nosec
assert not dst.endswith("/") # nosec assert not dst.endswith("/") # nosec
if "/" in dst: if "/" in dst:
@ -779,7 +779,6 @@ class AuthSrv(object):
self.warn_anonwrite = warn_anonwrite self.warn_anonwrite = warn_anonwrite
self.line_ctr = 0 self.line_ctr = 0
self.indent = "" self.indent = ""
self.desc = []
self.mutex = threading.Lock() self.mutex = threading.Lock()
self.reload() self.reload()
@ -862,7 +861,6 @@ class AuthSrv(object):
mflags: dict[str, dict[str, Any]], mflags: dict[str, dict[str, Any]],
mount: dict[str, str], mount: dict[str, str],
) -> None: ) -> None:
self.desc = []
self.line_ctr = 0 self.line_ctr = 0
expand_config_file(cfg_lines, fp, "") expand_config_file(cfg_lines, fp, "")
@ -1009,6 +1007,7 @@ class AuthSrv(object):
raise Exception("invalid config value (volume or volflag): %s" % (t,)) raise Exception("invalid config value (volume or volflag): %s" % (t,))
if lvl == "c": if lvl == "c":
# here, 'uname' is not a username; it is a volflag name... sorry
cval: Union[bool, str] = True cval: Union[bool, str] = True
try: try:
# volflag with arguments, possibly with a preceding list of bools # volflag with arguments, possibly with a preceding list of bools

View file

@ -2961,9 +2961,11 @@ class HttpCli(object):
# 512 kB is optimal for huge files, use 64k # 512 kB is optimal for huge files, use 64k
open_args = [fsenc(fs_path), "rb", 64 * 1024] open_args = [fsenc(fs_path), "rb", 64 * 1024]
use_sendfile = ( use_sendfile = (
not self.tls # # fmt: off
not self.tls
and not self.args.no_sendfile and not self.args.no_sendfile
and (BITNESS > 32 or file_sz < 0x7fffFFFF) and (BITNESS > 32 or file_sz < 0x7fffFFFF)
# fmt: on
) )
# #

View file

@ -31,33 +31,33 @@
/w # share /w (the docker data volume) /w # share /w (the docker data volume)
accs: accs:
rw: * # everyone gets read-access, but rw: * # everyone gets read-access, but
rwmda: %su # the group "su" gets read-write-move-delete-admin rwmda: @su # the group "su" gets read-write-move-delete-admin
[/u/${u}] # each user gets their own home-folder at /u/username [/u/${u}] # each user gets their own home-folder at /u/username
/w/u/${u} # which will be "u/username" in the docker data volume /w/u/${u} # which will be "u/username" in the docker data volume
accs: accs:
r: * # read-access for anyone, and r: * # read-access for anyone, and
rwmda: ${u}, %su # read-write-move-delete-admin for that username + the "su" group rwmda: ${u}, @su # read-write-move-delete-admin for that username + the "su" group
[/u/${u}/priv] # each user also gets a private area at /u/username/priv [/u/${u}/priv] # each user also gets a private area at /u/username/priv
/w/u/${u}/priv # stored at DATAVOLUME/u/username/priv /w/u/${u}/priv # stored at DATAVOLUME/u/username/priv
accs: accs:
rwmda: ${u}, %su # read-write-move-delete-admin for that username + the "su" group rwmda: ${u}, @su # read-write-move-delete-admin for that username + the "su" group
[/lounge/${g}] # each group gets their own shared volume [/lounge/${g}] # each group gets their own shared volume
/w/lounge/${g} # stored at DATAVOLUME/lounge/groupname /w/lounge/${g} # stored at DATAVOLUME/lounge/groupname
accs: accs:
r: * # read-access for anyone, and r: * # read-access for anyone, and
rwmda: %${g}, %su # read-write-move-delete-admin for that group + the "su" group rwmda: @${g}, @su # read-write-move-delete-admin for that group + the "su" group
[/lounge/${g}/priv] # and a private area for each group too [/lounge/${g}/priv] # and a private area for each group too
/w/lounge/${g}/priv # stored at DATAVOLUME/lounge/groupname/priv /w/lounge/${g}/priv # stored at DATAVOLUME/lounge/groupname/priv
accs: accs:
rwmda: %${g}, %su # read-write-move-delete-admin for that group + the "su" group rwmda: @${g}, @su # read-write-move-delete-admin for that group + the "su" group
# and create some strategic volumes to prevent anyone from gaining # and create some strategic volumes to prevent anyone from gaining
@ -65,8 +65,8 @@
[/u] [/u]
/w/u /w/u
accs: accs:
rwmda: %su rwmda: @su
[/lounge] [/lounge]
/w/lounge /w/lounge
accs: accs:
rwmda: %su rwmda: @su

View file

@ -110,7 +110,7 @@ class Cfg(Namespace):
def __init__(self, a=None, v=None, c=None, **ka0): def __init__(self, a=None, v=None, c=None, **ka0):
ka = {} ka = {}
ex = "daw dav_auth dav_inf dav_mac dav_rt e2d e2ds e2dsa e2t e2ts e2tsr e2v e2vu e2vp ed emp exp force_js getmod grid hardlink ih ihead magic never_symlink nid nih no_acode no_athumb no_dav no_dedup no_del no_dupe no_lifetime no_logues no_mv no_readme no_robots no_sb_md no_sb_lg no_scandir no_tarcmp no_thumb no_vthumb no_zip nrand nw rand smb srch_dbg stats th_no_crop vague_403 vc ver xdev xlink xvol" ex = "daw dav_auth dav_inf dav_mac dav_rt e2d e2ds e2dsa e2t e2ts e2tsr e2v e2vu e2vp ed emp exp force_js getmod grid hardlink ih ihead magic never_symlink nid nih no_acode no_athumb no_dav no_dedup no_del no_dupe no_lifetime no_logues no_mv no_readme no_robots no_sb_md no_sb_lg no_scandir no_tarcmp no_thumb no_vthumb no_zip nrand nw q rand smb srch_dbg stats th_no_crop vague_403 vc ver xdev xlink xvol"
ka.update(**{k: False for k in ex.split()}) ka.update(**{k: False for k in ex.split()})
ex = "dotpart dotsrch no_dhash no_fastboot no_rescan no_sendfile no_voldump re_dhash plain_ip" ex = "dotpart dotsrch no_dhash no_fastboot no_rescan no_sendfile no_voldump re_dhash plain_ip"
@ -152,6 +152,7 @@ class Cfg(Namespace):
mte={"a": True}, mte={"a": True},
mth={}, mth={},
mtp=[], mtp=[],
rm_retry="0/0",
s_wr_sz=512 * 1024, s_wr_sz=512 * 1024,
sort="href", sort="href",
srch_hits=99999, srch_hits=99999,