Skip to content

Commit

Permalink
add missing fbDecodeMetadata accesses
Browse files Browse the repository at this point in the history
  • Loading branch information
efd6 committed Aug 16, 2023
1 parent cced9cc commit 7871099
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions auditbeat/module/file_integrity/flatbuffers.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ func fbWriteMetadata(b *flatbuffers.Builder, m *Metadata) flatbuffers.UOffsetT {
if m.SID != "" {
sidOffset = b.CreateString(m.SID)
}
if m.SELinux != "" {
if len(m.SELinux) != 0 {
selinuxOffset = b.CreateString(m.SELinux)
}
if m.POSIXACLAccess != "" {
if len(m.POSIXACLAccess) != 0 {
aclAccessOffset = b.CreateString(m.POSIXACLAccess)
}
schema.MetadataStart(b)
Expand Down Expand Up @@ -257,16 +257,18 @@ func fbDecodeMetadata(e *schema.Event) *Metadata {
}
mode := os.FileMode(info.Mode())
rtn := &Metadata{
Inode: info.Inode(),
UID: info.Uid(),
GID: info.Gid(),
SID: string(info.Sid()),
Mode: mode & ^(os.ModeSetuid | os.ModeSetgid),
Size: info.Size(),
MTime: time.Unix(0, info.MtimeNs()).UTC(),
CTime: time.Unix(0, info.CtimeNs()).UTC(),
SetUID: mode&os.ModeSetuid != 0,
SetGID: mode&os.ModeSetgid != 0,
Inode: info.Inode(),
UID: info.Uid(),
GID: info.Gid(),
SID: string(info.Sid()),
Mode: mode & ^(os.ModeSetuid | os.ModeSetgid),
Size: info.Size(),
MTime: time.Unix(0, info.MtimeNs()).UTC(),
CTime: time.Unix(0, info.CtimeNs()).UTC(),
SetUID: mode&os.ModeSetuid != 0,
SetGID: mode&os.ModeSetgid != 0,
SELinux: string(info.Selinux()),
POSIXACLAccess: string(info.PosixAclAccess()),
}

switch info.Type() {
Expand Down

0 comments on commit 7871099

Please sign in to comment.