Skip to content

Commit e86684e

Browse files
committed
Fix bug in SMB2 rename implementation which fails to rename directory
1 parent 537c8e8 commit e86684e

File tree

6 files changed

+23
-17
lines changed

6 files changed

+23
-17
lines changed

CHANGELOG

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11

2+
pysmb-1.1.13, 18 Oct 2014
3+
=========================
4+
5+
- Add missing methods and improve compatibility with python3
6+
- Fix bug in SMB2 rename implementation which fails to rename directory
7+
28
pysmb-1.1.12, 21 Sep 2014
39
=========================
410

python2/smb/SMBConnection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ def eb(failure):
302302
return results[0]
303303

304304
def storeFile(self, service_name, path, file_obj, timeout = 30):
305-
self.storeFileFromOffset(service_name, path, file_obj, 0L, timeout)
305+
return self.storeFileFromOffset(service_name, path, file_obj, 0L, timeout)
306306

307307
def storeFileFromOffset(self, service_name, path, file_obj, offset = 0L, timeout = 30):
308308
"""

python2/smb/base.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,15 +1225,15 @@ def _rename_SMB2(self, service_name, old_path, new_path, callback, errback, time
12251225
old_path = old_path[1:]
12261226
if old_path.endswith('\\'):
12271227
old_path = old_path[:-1]
1228-
1228+
12291229
def sendCreate(tid):
12301230
create_context_data = binascii.unhexlify("""
1231-
20 00 00 00 10 00 04 00 00 00 18 00 08 00 00 00
1232-
4d 78 41 63 00 00 00 00 00 00 00 00 ff 01 1f 00
1233-
00 00 00 00 10 00 04 00 00 00 18 00 20 00 00 00
1234-
51 46 69 64 00 00 00 00 14 e7 01 00 00 00 50 00
1235-
30 e0 4c 0b 80 fa ff ff 00 00 00 00 00 00 00 00
1236-
00 00 00 00 00 00 00 00
1231+
28 00 00 00 10 00 04 00 00 00 18 00 10 00 00 00
1232+
44 48 6e 51 00 00 00 00 00 00 00 00 00 00 00 00
1233+
00 00 00 00 00 00 00 00 18 00 00 00 10 00 04 00
1234+
00 00 18 00 00 00 00 00 4d 78 41 63 00 00 00 00
1235+
00 00 00 00 10 00 04 00 00 00 18 00 00 00 00 00
1236+
51 46 69 64 00 00 00 00
12371237
""".replace(' ', '').replace('\n', ''))
12381238
m = SMB2Message(SMB2CreateRequest(old_path,
12391239
file_attributes = 0,

python3/smb/SMBConnection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ def eb(failure):
302302
return results[0]
303303

304304
def storeFile(self, service_name, path, file_obj, timeout = 30):
305-
self.storeFileFromOffset(service_name, path, file_obj, 0, timeout)
305+
return self.storeFileFromOffset(service_name, path, file_obj, 0, timeout)
306306

307307
def storeFileFromOffset(self, service_name, path, file_obj, offset = 0, timeout = 30):
308308
"""

python3/smb/base.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,12 +1222,12 @@ def _rename_SMB2(self, service_name, old_path, new_path, callback, errback, time
12221222

12231223
def sendCreate(tid):
12241224
create_context_data = binascii.unhexlify(b"""
1225-
20 00 00 00 10 00 04 00 00 00 18 00 08 00 00 00
1226-
4d 78 41 63 00 00 00 00 00 00 00 00 ff 01 1f 00
1227-
00 00 00 00 10 00 04 00 00 00 18 00 20 00 00 00
1228-
51 46 69 64 00 00 00 00 14 e7 01 00 00 00 50 00
1229-
30 e0 4c 0b 80 fa ff ff 00 00 00 00 00 00 00 00
1230-
00 00 00 00 00 00 00 00
1225+
28 00 00 00 10 00 04 00 00 00 18 00 10 00 00 00
1226+
44 48 6e 51 00 00 00 00 00 00 00 00 00 00 00 00
1227+
00 00 00 00 00 00 00 00 18 00 00 00 10 00 04 00
1228+
00 00 18 00 00 00 00 00 4d 78 41 63 00 00 00 00
1229+
00 00 00 00 10 00 04 00 00 00 18 00 00 00 00 00
1230+
51 46 69 64 00 00 00 00
12311231
""".replace(b' ', b'').replace(b'\n', b''))
12321232
m = SMB2Message(SMB2CreateRequest(old_path,
12331233
file_attributes = 0,

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88

99
setup(
1010
name = "pysmb",
11-
version = "1.1.12",
11+
version = "1.1.13",
1212
author = "Michael Teo",
1313
author_email = "[email protected]",
1414
license = "zlib/libpng",
1515
description = "pysmb is an experimental SMB/CIFS library written in Python to support file sharing between Windows and Linux machines",
1616
keywords = "windows samba cifs sharing ftp smb linux",
17-
url = "http://miketeo.net/projects/pysmb",
17+
url = "https://miketeo.net/projects/pysmb",
1818
package_dir = pkgdir,
1919
packages = [ 'smb', 'smb.utils', 'nmb' ],
2020
install_requires = [ 'pyasn1' ],

0 commit comments

Comments
 (0)