NRPE will remove its pidfile if poked with aborted tcp connections (the
child performs cleanup normally done by the parent instead of just
exiting).  /etc/rc.d doesn't care, but some people may have scripts that
use this pidfile.

Worth a patch?

Index: Makefile
===================================================================
RCS file: /cvs/ports/net/nagios/nrpe/Makefile,v
retrieving revision 1.27
diff -u -p -r1.27 Makefile
--- Makefile    11 Jul 2014 20:08:23 -0000      1.27
+++ Makefile    21 Jul 2014 22:39:11 -0000
@@ -3,7 +3,7 @@
 COMMENT=       Nagios Remote Plugin Executor
 
 DISTNAME=      nrpe-2.15
-REVISION=      4
+REVISION=      5
 CATEGORIES=    net
 
 MAINTAINER=    Stuart Henderson <[email protected]>
Index: patches/patch-src_nrpe_c
===================================================================
RCS file: /cvs/ports/net/nagios/nrpe/patches/patch-src_nrpe_c,v
retrieving revision 1.8
diff -u -p -r1.8 patch-src_nrpe_c
--- patches/patch-src_nrpe_c    18 Apr 2014 11:33:41 -0000      1.8
+++ patches/patch-src_nrpe_c    21 Jul 2014 22:52:44 -0000
@@ -1,9 +1,14 @@
 $OpenBSD: patch-src_nrpe_c,v 1.8 2014/04/18 11:33:41 sthen Exp $
 
-http://seclists.org/fulldisclosure/2014/Apr/240 plus \r suggested on oss-sec
+- http://seclists.org/fulldisclosure/2014/Apr/240 plus \r suggested on oss-sec
+- fix reading of non-blocking sockets
+- don't remove the pidfile when accept(2) or getpeername(2) fail.
+  Author: Hiren Patel
+  From: http://comments.gmane.org/gmane.network.nagios.devel/6774
+  Bug-Ubuntu: https://launchpad.net/bugs/1126890
 
---- src/nrpe.c.orig    Fri Sep  6 16:27:13 2013
-+++ src/nrpe.c Fri Apr 18 12:29:57 2014
+--- src/nrpe.c.orig    Fri Sep  6 17:27:13 2013
++++ src/nrpe.c Tue Jul 22 00:52:20 2014
 @@ -30,6 +30,8 @@
  #include "utils.h"
  #include "acl.h"
@@ -47,3 +52,21 @@ http://seclists.org/fulldisclosure/2014/
  
                                /* fix for HP-UX 11.0 - just retry */
                                if(errno==ENOBUFS)
+@@ -998,7 +1006,7 @@ void wait_for_connections(void){
+                                               /* close socket prioer to 
exiting */
+                                               close(sock);
+                       
+-                                              return;
++                                              exit(STATE_CRITICAL);
+                                               }
+ 
+                                       /* handle signals */
+@@ -1022,7 +1030,7 @@ void wait_for_connections(void){
+                                       /* close socket prior to exiting */
+                                               close(new_sd);
+ 
+-                                              return;
++                                              exit(STATE_CRITICAL);
+                                               }
+ 
+                                       /* is this is a blessed machine? */


-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to