mirror of
https://github.com/aljazceru/cowrie.git
synced 2026-02-01 04:24:32 +01:00
fs: Return blank contents for zero-size files lacking a realfile.
This allows reading from files newly created by touch without error.
This commit is contained in:
committed by
Michel Oosterhof
parent
731ec40492
commit
b5e7d4cc14
@@ -235,6 +235,11 @@ class HoneyPotFilesystem(object):
|
||||
raise IsADirectoryError
|
||||
elif f[A_TYPE] == T_FILE and f[A_REALFILE]:
|
||||
return file(f[A_REALFILE], 'rb').read()
|
||||
elif f[A_TYPE] == T_FILE and f[A_SIZE] == 0:
|
||||
# Zero-byte file lacking A_REALFILE backing: probably empty.
|
||||
# (The exceptions to this are some system files in /proc and /sys,
|
||||
# but it's likely better to return nothing than suspiciously fail.)
|
||||
return ''
|
||||
|
||||
|
||||
def mkfile(self, path, uid, gid, size, mode, ctime=None):
|
||||
|
||||
Reference in New Issue
Block a user