-
Notifications
You must be signed in to change notification settings - Fork 133
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
Fixes #275
Open
dougnazar
wants to merge
12
commits into
NagiosEnterprises:master
Choose a base branch
from
dougnazar:fixes
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Fixes #275
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In my_system_parent(), don't wait for child to exit before reading buffer. The child may fill the pipe buffer and start erroring, so do both operations concurrently. In my_system_child(), similarly check that data/space is available before we read/write to handle asymetric data rates.
inet_ntoa uses a static buffer which causes duplicate IP addresses to be printed.
Spotted via valgrind.
Multiple allowed_hosts config lines or every SIGHUP would cause duplicates. Free previous allowed_hosts to prevent leaking. Fix dumping of ACLs to properly display AF_INET6 addresses.
Mostly config options that strdup() their value, causing leaks if there are multiple config lines or after restarting with SIGHUP. The last was the fd_set for incoming connections wouldn't be freed on restart. Also optimize the allocation of fdset and re-use if possible.
my_strpos() modifies the string pointer causing us to free an incorrect pointer.
rpv-tomsk
reviewed
Jun 27, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here are several fixes for
nrpe
&check_nrpe
. Let me know if you'd prefer me to break this up into multiple requests. Kind of kept finding new stuff as I went along.Fix various warnings when building with
-Wall
.Various misc fixes, mainly left over code.
Split
my_system()
into separate functions for child & parent.Rewrite
my_system_*()
IO loops to handle async & large buffers.Due to scheduling and various implementations, we can't depend on read/write having data/space available. It's also possible to fill the send buffer before we exit so need to read data while waiting for child to exit.
I've tested with 10000, 60000, 70000 sized outputs. The 10000 & 60000 hashes match, and as expected the 70000 gets truncated.
Will probably help with nrpe[xxxx]: ERROR: my_system() write(fd, buffer)-2 failed... #271
Fix debug display of acl IP addresses
Would always show same address due to shared buffer.
Show correct address family when setting up listen addresses.
Would always say
IPv4
no matter which family the address was.Only make requested binary
Top level Makefile didn't pass command to child so would always
make all
Don't compile utils.c twice, once for each program.
utils.c
is shared between both programs.Fix a few pedantic warnings, mostly prototype related.
Fix use of uninitialized variable.
Clear any existing ACLs before parsing new config.
Would get duplicate ACL entries if allowed_hosts was used multiple times in config or on every
SIGHUP
.Also would try to dump IPv6 ACLs as IPv4.
Fix various leaks detected by valgrind.
All config options that use
strdup()
would leak memory if used more than once or onSIGHUP
.Only allocate
fdset
when size changes and ensure we free it.