Skip to content

Commit

Permalink
SMB Server fix filename offsets (#1831)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jborean93 authored Dec 12, 2024
1 parent 0fd9f28 commit af91d61
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions impacket/smbserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,9 @@ def findFirst2(path, fileName, level, searchAttributes, pktFlags=smb.SMB.FLAGS2_
item['LastAccessTime'] = getSMBTime(atime)
item['LastWriteDate'] = getSMBDate(mtime)
item['LastWriteTime'] = getSMBTime(mtime)
elif level in [smb.SMB_FIND_FILE_NAMES_INFO, smb2.SMB2_FILE_NAMES_INFO]:
padLen = (8 - (len(item) % 8)) % 8
item['NextEntryOffset'] = len(item) + padLen
searchResult.append(item)

# No more files
Expand Down

0 comments on commit af91d61

Please sign in to comment.