Skip to content

Commit af91d61

Browse files
authored
SMB Server fix filename offsets (#1831)
Correctly set the NextEntryOffset for the SMBFindFileNamesInfo results when querying the names of files. The current logic does not set this value so will be set to 0 making the client believe there are no more entries in the result if going by the MS-SMB2 logic.
1 parent 0fd9f28 commit af91d61

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

impacket/smbserver.py

+3
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,9 @@ def findFirst2(path, fileName, level, searchAttributes, pktFlags=smb.SMB.FLAGS2_
502502
item['LastAccessTime'] = getSMBTime(atime)
503503
item['LastWriteDate'] = getSMBDate(mtime)
504504
item['LastWriteTime'] = getSMBTime(mtime)
505+
elif level in [smb.SMB_FIND_FILE_NAMES_INFO, smb2.SMB2_FILE_NAMES_INFO]:
506+
padLen = (8 - (len(item) % 8)) % 8
507+
item['NextEntryOffset'] = len(item) + padLen
505508
searchResult.append(item)
506509

507510
# No more files

0 commit comments

Comments
 (0)