diff --git a/README.md b/README.md index 35e317d0..07cbb2f0 100644 --- a/README.md +++ b/README.md @@ -1115,12 +1115,12 @@ some **BIG WARNINGS** specific to SMB/CIFS, in decreasing importance: * [shadowing](#shadowing) probably works as expected but no guarantees and some minor issues, -* clients only see the first ~400 files in big folders; [impacket#1433](https://github.com/SecureAuthCorp/impacket/issues/1433) +* clients only see the first ~400 files in big folders; + * this was originally due to [impacket#1433](https://github.com/SecureAuthCorp/impacket/issues/1433) which was fixed in impacket-0.12, so you can disable the workaround with `--smb-nwa-1` but then you get unacceptably poor performance instead * hot-reload of server config (`/?reload=cfg`) does not include the `[global]` section (commandline args) * listens on the first IPv4 `-i` interface only (default = :: = 0.0.0.0 = all) * login doesn't work on winxp, but anonymous access is ok -- remove all accounts from copyparty config for that to work * win10 onwards does not allow connecting anonymously / without accounts -* on windows, creating a new file through rightclick --> new --> textfile throws an error due to impacket limitations -- hit OK and F5 to get your file * python3 only * slow (the builtin webdav support in windows is 5x faster, and rclone-webdav is 30x faster) @@ -2168,7 +2168,7 @@ enable [thumbnails](#thumbnails) of... * **JPEG XL pictures:** `pyvips` or `ffmpeg` enable [smb](#smb-server) support (**not** recommended): -* `impacket==0.11.0` +* `impacket==0.12.0` `pyvips` gives higher quality thumbnails than `Pillow` and is 320% faster, using 270% more ram: `sudo apt install libvips42 && python3 -m pip install --user -U pyvips` diff --git a/copyparty/__main__.py b/copyparty/__main__.py index 60b94d51..4d61450d 100644 --- a/copyparty/__main__.py +++ b/copyparty/__main__.py @@ -1181,7 +1181,7 @@ def add_smb(ap): ap2.add_argument("--smbw", action="store_true", help="enable write support (please dont)") ap2.add_argument("--smb1", action="store_true", help="disable SMBv2, only enable SMBv1 (CIFS)") ap2.add_argument("--smb-port", metavar="PORT", type=int, default=445, help="port to listen on -- if you change this value, you must NAT from TCP:445 to this port using iptables or similar") - ap2.add_argument("--smb-nwa-1", action="store_true", help="disable impacket#1433 workaround (truncate directory listings to 64kB)") + ap2.add_argument("--smb-nwa-1", action="store_true", help="truncate directory listings to 64kB (~400 files); avoids impacket-0.11 bug, fixes impacket-0.12 performance") ap2.add_argument("--smb-nwa-2", action="store_true", help="disable impacket workaround for filecopy globs") ap2.add_argument("--smba", action="store_true", help="small performance boost: disable per-account permissions, enables account coalescing instead (if one user has write/delete-access, then everyone does)") ap2.add_argument("--smbv", action="store_true", help="verbose") diff --git a/copyparty/smbd.py b/copyparty/smbd.py index 25873a7e..d165f10f 100644 --- a/copyparty/smbd.py +++ b/copyparty/smbd.py @@ -12,7 +12,7 @@ from types import SimpleNamespace from .__init__ import ANYWIN, EXE, TYPE_CHECKING from .authsrv import LEELOO_DALLAS, VFS from .bos import bos -from .util import Daemon, min_ex, pybin, runhook +from .util import Daemon, absreal, min_ex, pybin, runhook, vjoin if True: # pylint: disable=using-constant-test from typing import Any, Union @@ -151,6 +151,8 @@ class SMB(object): def _uname(self) -> str: if self.noacc: return LEELOO_DALLAS + if not self.asrv.acct: + return "*" try: # you found it! my single worst bit of code so far @@ -189,7 +191,7 @@ class SMB(object): vfs, rem = self.asrv.vfs.get(vpath, uname, *perms) if not vfs.realpath: raise Exception("unmapped vfs") - return vfs, vfs.canonical(rem) + return vfs, vjoin(vfs.realpath, rem) def _listdir(self, vpath: str, *a: Any, **ka: Any) -> list[str]: vpath = vpath.replace("\\", "/").lstrip("/") @@ -213,7 +215,7 @@ class SMB(object): sz = 112 * 2 # ['.', '..'] for n, fn in enumerate(ls): if sz >= 64000: - t = "listing only %d of %d files (%d byte) in /%s; see impacket#1433" + t = "listing only %d of %d files (%d byte) in /%s for performance; see --smb-nwa-1" warning(t, n, len(ls), sz, vpath) break @@ -242,6 +244,7 @@ class SMB(object): t = "blocked write (no-write-acc %s): /%s @%s" yeet(t % (vfs.axs.uwrite, vpath, uname)) + ap = absreal(ap) xbu = vfs.flags.get("xbu") if xbu and not runhook( self.nlog, diff --git a/copyparty/web/svcs.html b/copyparty/web/svcs.html index 6f8f386e..ef8847e9 100644 --- a/copyparty/web/svcs.html +++ b/copyparty/web/svcs.html @@ -208,7 +208,6 @@ {% if args.smb %}

SMB / CIFS

- bug: max ~300 files in each folder