rapid7 / ruby_smb

A native Ruby implementation of the SMB Protocol Family
Other
79 stars 82 forks source link

Fix TreeConnectResponse Packet for Old Samba Versions #133

Closed n00tmeg closed 6 years ago

n00tmeg commented 6 years ago

Description

Old versions of Samba does not respect the SMB extension protocol for TreeConnectResponse packets (https://msdn.microsoft.com/en-us/library/cc246331.aspx). Comparing to CIFS (https://msdn.microsoft.com/en-us/library/ee441613.aspx), SMB specifies two new fields in the SMBParameter block: MaximalShareAccessRights and GuestMaximalShareAccessRights. However, old versions of Samba are not sending these fields, which breaks RubySMB (tested with Samba 3.0.22). Newer versions correctly include these two fields (tested with Samba 3.4.7).

This PR adds conditional statements for these fields to avoid breaking when these packets are parsed.

Verification Steps

rake spec

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 95.023% when pulling 0165c063a8f63b7a0836a0181e5bc244d7849454 on chrisdlf:fix_tree_connect_response_for_old_samba into 0804cbf298ede3eea2702b33807572de8a111ec0 on rapid7:master.