Skip to content

Commit

Permalink
minor changes in NetrWkstaUserEnum
Browse files Browse the repository at this point in the history
  • Loading branch information
NtAlexio2 committed Sep 8, 2024
1 parent 686fbcb commit 563542e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 22 deletions.
30 changes: 12 additions & 18 deletions lib/ruby_smb/dcerpc/wkssvc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,18 @@ module Wkssvc
WKSTA_USER_INFO_1 = 0x00000001

# [2.2.2.1 WKSSVC_IDENTIFY_HANDLE](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-wkst/9ef94a11-0e5c-49d7-9ac7-68d6f03565de)
class WkssvcIdentifyHandle < Ndr::NdrWideStringPtr; end
class WkssvcIdentifyHandle < Ndr::NdrWideStringzPtr; end

# [2.2.5.9 WKSTA_USER_INFO_0](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-wkst/b7c53c6f-8b92-4e5d-9a2e-6462cb4ef1ac)
class UserInfo0 < Ndr::NdrStruct
class WkstaUserInfo0 < Ndr::NdrStruct
default_parameter byte_align: 4
endian :little

ndr_wide_stringz_ptr :wkui0_username
end

class WkstaUserInfo0 < Ndr::NdrConfArray
default_parameter type: :user_info0
end

class PwkstaUserInfo0 < WkstaUserInfo0
class WkstaUserInfo0ArrayPtr < Ndr::NdrConfArray
default_parameter type: :wksta_user_info0
extend Ndr::PointerClassPlugin
end

Expand All @@ -52,16 +49,16 @@ class WkstaUserInfo0Container < Ndr::NdrStruct
default_parameter byte_align: 4
endian :little

ndr_uint32 :wkui0_entries_read
pwksta_user_info0 :wkui0_buffer
ndr_uint32 :wkui0_entries_read
wksta_user_info0_array_ptr :wkui0_buffer
end

class PwkstaUserInfo0Container < WkstaUserInfo0Container
extend Ndr::PointerClassPlugin
end

# [2.2.5.10 WKSTA_USER_INFO_1](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-wkst/c37b9606-866f-40ac-9490-57b8334968e2)
class UserInfo1 < Ndr::NdrStruct
class WkstaUserInfo1 < Ndr::NdrStruct
default_parameter byte_align: 4
endian :little

Expand All @@ -70,12 +67,9 @@ class UserInfo1 < Ndr::NdrStruct
ndr_wide_stringz_ptr :wkui1_oth_domains
ndr_wide_stringz_ptr :wkui1_logon_server
end

class WkstaUserInfo1 < Ndr::NdrConfArray
default_parameter type: :user_info1
end

class PwkstaUserInfo1 < WkstaUserInfo1
class WkstaUserInfo1ArrayPtr < Ndr::NdrConfArray
default_parameter type: :wksta_user_info1
extend Ndr::PointerClassPlugin
end

Expand All @@ -84,16 +78,16 @@ class WkstaUserInfo1Container < Ndr::NdrStruct
default_parameter byte_align: 4
endian :little

ndr_uint32 :wkui1_entries_read
pwksta_user_info1 :wkui1_buffer
ndr_uint32 :wkui1_entries_read
wksta_user_info1_array_ptr :wkui1_buffer
end

class PwkstaUserInfo1Container < WkstaUserInfo1Container
extend Ndr::PointerClassPlugin
end

# [2.2.5.14 WKSTA_USER_ENUM_STRUCT](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-wkst/4041455a-52be-4389-a4fc-82fea3cb3160)
class LpwkssvcUserEnumStructure < Ndr::NdrStruct
class WkstaUserEnumStructure < Ndr::NdrStruct
default_parameter byte_align: 4
endian :little

Expand Down
2 changes: 1 addition & 1 deletion lib/ruby_smb/dcerpc/wkssvc/netr_wksta_user_enum_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class NetrWkstaUserEnumRequest < BinData::Record
endian :little

wkssvc_identify_handle :server_name
lpwkssvc_user_enum_structure :user_info
wksta_user_enum_structure :user_info
ndr_uint32 :preferred_max_length, initial_value: 0xFFFFFFFF
ndr_uint32_ptr :result_handle, initial_value: 0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class NetrWkstaUserEnumResponse < BinData::Record

endian :little

lpwkssvc_user_enum_structure :user_info
wksta_user_enum_structure :user_info
ndr_uint32_ptr :total_entries
ndr_uint32_ptr :result_handle
ndr_uint32 :error_status
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/ruby_smb/dcerpc/wkssvc_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
RSpec.describe RubySMB::Dcerpc::Wkssvc::WkssvcIdentifyHandle do
subject(:packet) { described_class.new }

it 'is a Ndr::NdrWideStringPtr' do
expect(packet).to be_a(RubySMB::Dcerpc::Ndr::NdrWideStringPtr)
it 'is a Ndr::NdrWideStringzPtr' do
expect(packet).to be_a(RubySMB::Dcerpc::Ndr::NdrWideStringzPtr)
end
end

Expand Down

0 comments on commit 563542e

Please sign in to comment.