Skip to content

Commit

Permalink
Fix error message from AddRule (#103)
Browse files Browse the repository at this point in the history
There was a copy/paste error in AddRule where it reference "delete" instead of "add".
  • Loading branch information
andrewkroh committed Feb 5, 2022
1 parent 7c19a0e commit b36e6ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Changed

- Update syscall, arches, and audit msg type tables for Linux 5.16. [#96](https://github.com/elastic/go-libaudit/pull/96)
- Fixed error messages from `AddRule()` in the audit client. [#103](https://github.com/elastic/go-libaudit/pull/103)

### Removed

Expand Down
8 changes: 4 additions & 4 deletions audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func (c *AuditClient) GetRules() ([][]byte, error) {
for {
reply, err := c.getReply(seq)
if err != nil {
return nil, fmt.Errorf("failed receive rule data: %w", err)
return nil, fmt.Errorf("failed receiving rule data: %w", err)
}

if reply.Header.Type == syscall.NLMSG_DONE {
Expand Down Expand Up @@ -259,7 +259,7 @@ func (c *AuditClient) DeleteRule(rule []byte) error {
// Send AUDIT_DEL_RULE message to the kernel.
seq, err := c.Netlink.Send(msg)
if err != nil {
return fmt.Errorf("failed sending delete request: %w", err)
return fmt.Errorf("failed sending delete rule request: %w", err)
}

_, err = c.getReply(seq)
Expand All @@ -283,12 +283,12 @@ func (c *AuditClient) AddRule(rule []byte) error {
// Send AUDIT_ADD_RULE message to the kernel.
seq, err := c.Netlink.Send(msg)
if err != nil {
return fmt.Errorf("failed sending delete request: %w", err)
return fmt.Errorf("failed sending add rule request: %w", err)
}

ack, err := c.getReply(seq)
if err != nil {
return fmt.Errorf("failed to get ACK to rule delete request: %w", err)
return fmt.Errorf("failed to get ACK to add rule request: %w", err)
}

if ack.Header.Type != syscall.NLMSG_ERROR {
Expand Down

0 comments on commit b36e6ab

Please sign in to comment.