Comments (5)
Patch has been merged and released under pysmb 1.1.23.
from pysmb.
I have also stumbled on this issue. It happens when the whole list of shares cannot be returned in a single response, and a second one has to be issued. The code that handles the response is in smb\base.py
. The second response is parsed by readCB(read_message, **kwargs)
and oddly enough the data returned in the response is trimmed by 24 bytes before and after: kwargs['data_bytes'] + data_bytes[24:data_len-24]
.
I've been looking for an explanation to these 24 bytes, but I haven't found an easy answer. The only thing that seems to be linked is that the ComReadAndxResponse
header is also 24 bytes. (introduced in commit f6ebcd4)
I changed kwargs['data_bytes'] + data_bytes[24:data_len-24]
to kwargs['data_bytes'] + data_bytes[24:data_len]
and it seems to work for me, but I'm not sure if this is correct.
from pysmb.
I'm also having this issue and removing the 24-byte trim allows it to work. At first glance, it looks like the first 24 bytes are being dropped and the data_len-24
is just making sure the buffer doesn't overflow but, of course, that's not how byte slices work. I wonder if all those data_bytes[24:data_len-24]
shouldn't all be just data_bytes[24:]
...
Traceback (most recent call last):
File "./pysmb-test.py", line 74, in <module>
main()
File "./pysmb-test.py", line 66, in main
for entry in conn.listShares():
File "/home/vagrant/bpstat-venv/lib64/python3.6/site-packages/smb/SMBConnection.py", line 149, in listShares
self._pollForNetBIOSPacket(timeout)
File "/home/vagrant/bpstat-venv/lib64/python3.6/site-packages/smb/SMBConnection.py", line 614, in _pollForNetBIOSPacket
self.feedData(data)
File "/home/vagrant/bpstat-venv/lib64/python3.6/site-packages/nmb/base.py", line 54, in feedData
self._processNMBSessionPacket(self.data_nmb)
File "/home/vagrant/bpstat-venv/lib64/python3.6/site-packages/nmb/base.py", line 75, in _processNMBSessionPacket
self.onNMBSessionMessage(packet.flags, packet.data)
File "/home/vagrant/bpstat-venv/lib64/python3.6/site-packages/smb/base.py", line 138, in onNMBSessionMessage
if self._updateState(self.smb_message):
File "/home/vagrant/bpstat-venv/lib64/python3.6/site-packages/smb/base.py", line 279, in _updateState_SMB2
req.callback(message, **req.kwargs)
File "/home/vagrant/bpstat-venv/lib64/python3.6/site-packages/smb/base.py", line 506, in readCB
decodeResults(read_message.tid, kwargs['fid'], kwargs['data_bytes'] + data_bytes[24:data_len-24])
File "/home/vagrant/bpstat-venv/lib64/python3.6/site-packages/smb/base.py", line 476, in decodeResults
max_length, _, length = struct.unpack('<III', data_bytes[offset:offset+12])
struct.error: unpack requires a buffer of 12 bytes
from pysmb.
@carlosefr : Can you provide more information about your remote SMB server and OS? Thank you.
from pysmb.
I'm seeing this with OS=[Windows Server 2016 Standard 14393] Server=[Windows Server 2016 Standard 6.3]
where the number of shares is around 120.
I don't see this problem in another server with OS=[Windows Server 2012 R2 Standard 9600] Server=[Windows Server 2012 R2 Standard 6.3]
where there are "only" around 50 shares.
from pysmb.
Related Issues (20)
- Cant connect w/ smb on mac os, python 3.8 HOT 6
- Can't get file list on DFS shared folder HOT 6
- listPath fails with "STATUS_ACCESS_DENIED" due to too broad access mask HOT 2
- pysmb-provided MD4 implementation for Python3 is broken HOT 6
- ThreadPoolExecutor storeFile HOT 1
- Using same code in Windows and Linux to access remote paths HOT 2
- Problem performing listPath using SMB1 with version 1.2.8 (similar to issue #195)
- Server does not support any of the pysmb dialects HOT 2
- When are compressed transfers supported?
- Unable to install the latest version of pysmb(1.2.9) HOT 7
- TypeError: can't concat str to bytes HOT 2
- How to improve transfer speed
- Server does not support any of the pysmb dialects. Please email pysmb to add in support for your OS HOT 1
- Copy a file using pysmb from windows to linux HOT 8
- Don't connect to SMBv2 server HOT 5
- Provide wheel distributions
- Using Chunk? HOT 5
- Request to Update Documentation for SMBConnection Class HOT 4
- storeFile raise SMBTimeout exception on files > 1k HOT 2
- Compatibility Issue with Unraid SMB Server: Unable to Negotiate Supported SMB Dialect
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pysmb.