rapid7 / ruby_smb

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

Automated checks are failing with Ruby 2.7 (issue with `windows_error` library) #198

Closed cdelafuente-r7 closed 2 years ago

cdelafuente-r7 commented 2 years ago

windows_error library is used to handle NTStatus code errors. These are defined as constants in this library. It appears that the function used to retrieve a specific NTStatus code message performs a lookup using the Module.constants class method:

https://github.com/rapid7/windows_error/blob/3aa1cd06ff0ea94bc32142a7acd086df397a57ee/lib/windows_error/nt_status.rb#L14-L24

It assumes constants are always returned in the same order, which, apparently is not the case. When the status code numeric value has multiple entries (e.g. 0x00000000), this function returns an array containing all the corresponding entries. However, RubySMB::GenericPacket::status_code always takes the first one, which can be different depending on which system it is run.

I couldn't find any documentation about this, but done some testing:

This is the reason why these specs are failing on Github workers.

zeroSteiner commented 2 years ago

See https://github.com/rapid7/windows_error/pull/4