pkg-nagios-plugins-contrib icon indicating copy to clipboard operation
pkg-nagios-plugins-contrib copied to clipboard

[check_ajp] Fix "or die" expressions.

Open ChristopherSchultz opened this issue 4 years ago • 1 comments

Using || ends up binding too tightly to the operand on the left, so the || xdie expressions never do anything because all of those trailing-parameters to system calls are not undefined.

Changing them to or xdie causes them to actually do what you wanted them to do, which was actually terminate if a system call failed.

I discovered this by using check_ajp across an stunnel setup where the remote server wouldn't properly handshake. The "pong" result ends up being the literal string null for some reason, but the real problem is that sysread is throwing a "Connection reset" error. check_ajp wasn't dying when sysread was throwing an error, so ... it continued and returned an UNKNOWN response.

ChristopherSchultz avatar Apr 14 '21 22:04 ChristopherSchultz

Did you have a look into https://github.com/bzed/pkg-nagios-plugins-contrib/blob/master/debian/patches/check_ajp/return_critical_on_failed_connection which patches the script on build time?

waja avatar Dec 16 '21 11:12 waja