NSCA pwent cleanup

Mark Ferlatte ferlatte at cryptio.net
Sat Oct 25 01:28:52 CEST 2003


nsca wasn't calling endpwent() and endgrent() in drop_privileges().  I'm pretty
sure that this doesn't actually hurt anything, but it's good practice, as it
frees the resources associated with the passwd and group databases.

M
-------------- next part --------------
Index: nsca.c
===================================================================
RCS file: /cvsroot/nagios/nsca/src/nsca.c,v
retrieving revision 1.16
diff -u -r1.16 nsca.c
--- nsca.c	24 Oct 2003 01:31:08 -0000	1.16
+++ nsca.c	24 Oct 2003 23:23:29 -0000
@@ -1164,6 +1164,7 @@
 				gid=(gid_t)(grp->gr_gid);
 			else
 				syslog(LOG_ERR,"Warning: Could not get group entry for '%s'",group);
+			endgrent();
 		        }
 
 		/* else we were passed the GID */
@@ -1189,6 +1190,7 @@
 				uid=(uid_t)(pw->pw_uid);
 			else
 				syslog(LOG_ERR,"Warning: Could not get passwd entry for '%s'",user);
+			endpwent();
 		        }
 
 		/* else we were passed the UID */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20031024/1adedad1/attachment.sig>


More information about the Developers mailing list