Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pike/smb2.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ class ShareFlags(core.FlagEnum):
ShareFlags.import_items(globals())

# Misc
RELATED_SID = (2**64-1)
RELATED_TID = (2**32-1)
RELATED_FID = (2**64-1,2**64-1)
UNSOLICITED_MESSAGE_ID = (2**64-1)

Expand Down
31 changes: 30 additions & 1 deletion pike/test/compound.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def __init__(self, tree=None):
class CompoundTest(pike.test.PikeTest):

# Compounded create/close of the same file, with maximal access request
def test_create_close(self):
def generic_test_create_close(self, sid=None, tid=None):
chan, tree = self.tree_connect()

# Manually assemble a chained request
Expand All @@ -85,8 +85,37 @@ def test_create_close(self):
close_req.file_id = pike.smb2.RELATED_FID
smb_req2.flags |= pike.smb2.SMB2_FLAGS_RELATED_OPERATIONS

if sid is not None:
smb_req2.session_id = sid
if tid is not None:
smb_req2.tree_id = tid

chan.connection.transceive(nb_req)

def test_create_close(self):
self.generic_test_create_close()

def test_create_close_with_invalid_sid(self):
# verify that compound request with invalid session-id works
self.generic_test_create_close(sid=pike.smb2.RELATED_SID)

def test_create_close_with_invalid_tid(self):
# verify that compound request with invalid tree-id works
self.generic_test_create_close(tid=pike.smb2.RELATED_TID)

def test_create_close_with_invalid_sid_and_tid(self):
# verify that compound request with invalid session & tree id's works
self.generic_test_create_close(sid=pike.smb2.RELATED_SID,
tid=pike.smb2.RELATED_TID)

def test_create_close_with_bogus_sid(self):
# verify that compound request with bogus session-id works
self.generic_test_create_close(sid=0xdeadbeef)

def test_create_close_with_bogus_sid_and_tid(self):
# verify that compound request with bogus session-id works
self.generic_test_create_close(sid=0xdeadbeef, tid=0xfeedface)

# Compound create/query/close
def test_create_query_close(self):
chan, tree = self.tree_connect()
Expand Down