Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error message from AddRule #103

Merged
merged 1 commit into from
Feb 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,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