miketeo/pysmb

Unable to retrieveFile() - 'FileStreamInformation' not supported by SMB server

viralmutant opened this issue · 5 comments

I was trying file create/retrieve/delete against an SMB server, over SMB2.

Though storeFile and deleteFiles are working fine, the retrieveFile fails at infoCB
Wireshark analysis shows that FileStreamInformation is not supported by the SMB server.
Since windows client works fine against the server so I would assume that it's OK that the server may not support this operation.

How to fix this and get it working? I certainly can't change SMB server code

May I know what is your SMB server?

Another method is to disable SMB2 in pysmb and use SMB1 for communication.

from smb import smb_structs
smb_structs.SUPPORT_SMB2 = False

# ... Create your pysmb object here

May I know what is your SMB server?

It's Likewise server

Unfortunately, I don't have any experience with it as Samba is a more popular choice.
I think the software has been renamed to PowerBroker some years ago.

Please let me know if switching to SMB1 works for you. Thanks.

Please let me know if switching to SMB1 works for you. Thanks.

Yes, switching to SMB1 resolved it

Thanks

For the record, I was able to fix this for SMB2 as well

Just changed the FILE_INFO_CLASS from FILE_STREAM_INFORMATION to FILE_STANDARD_INFORMATION to get the length of file, in smb/base.py file:

 936         def createCB(create_message, **kwargs):
 937             messages_history.append(create_message)
 938             if create_message.status == 0:
 939                 m = SMB2Message(SMB2QueryInfoRequest(create_message.payload.fid,
 940                                                      flags = 0,
 941                                                      additional_info = 0,
 942                                                      info_type = SMB2_INFO_FILE,
 943                 #                                     file_info_class = 0x16,  # FileStreamInformation [MS-FSCC] 2.4
 944                                                      file_info_class = 0x5,
 945                                                      input_buf = b'',
 946                                                      output_buf_len = 4096))