smb: fix file rename

This commit is contained in:
ed 2022-10-24 16:08:02 +02:00
parent fb21bfd6d6
commit 4b2b4ed52d
4 changed files with 8 additions and 2 deletions

2
.vscode/launch.py vendored Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env python3
# takes arguments from launch.json
# is used by no_dbg in tasks.json
# launches 10x faster than mspython debugpy

View file

@ -760,6 +760,7 @@ and some minor issues,
* listens on the first `-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

View file

@ -198,7 +198,10 @@ class SMB(object):
vp2 = vp2.lstrip("/")
ap2 = self._v2a("rename", vp2, vp1)[1]
self.hub.up2k.handle_mv(LEELOO_DALLAS, vp1, vp2)
bos.makedirs(ap2, exist_ok=True)
try:
bos.makedirs(ap2)
except:
pass
def _mkdir(self, vpath: str) -> None:
return bos.mkdir(self._v2a("mkdir", vpath)[1])

View file

@ -1923,8 +1923,8 @@ def sendfile_kern(
n = os.sendfile(out_fd, in_fd, ofs, req)
stuck = 0
except OSError as ex:
# client stopped reading; do another select
d = time.time() - stuck
log("sendfile stuck for {:.3f} sec: {!r}".format(d, ex), "90")
if d < 3600 and ex.errno == errno.EWOULDBLOCK:
continue