[Nagios-devel] Patch: don't drop privs unless running as root

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] Patch: don't drop privs unless running as root

Post by Guest »

This is a multi-part message in MIME format.
--------------050903060402010703070803
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Ahoy.

I've made a small patch to allow nagios to be run without dropping
privileges if it's started as a non-root user.

Apply with
patch -p1 < nagios-nonroot-no_priv_drop.diff

--
Andreas Ericsson [email protected]
OP5 AB www.op5.se
Lead Developer

--------------050903060402010703070803
Content-Type: text/plain;
name="nagios-nonroot-no_priv_drop.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="nagios-nonroot-no_priv_drop.diff"

diff -urN ../nagios.orig/base/utils.c ./base/utils.c
--- ../nagios.orig/base/utils.c Fri Apr 29 13:06:23 2005
+++ ./base/utils.c Fri Apr 29 13:06:27 2005
@@ -3591,6 +3591,11 @@
printf("Original UID/GID: %d/%d\n",(int)getuid(),(int)getgid());
#endif

+ /* only drop privileges if we're running as root, so we don't
+ * interfere with being debugged while running as some random user */
+ if(getuid()!=0)
+ return OK;
+
/* set effective group ID */
if(group!=NULL){


--------------050903060402010703070803--





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked