[PATCH] nrpe configuration verify option

Al Tobey albert.tobey at priority-health.com
Fri Sep 5 17:58:26 CEST 2003


Attached patch adds -v|--verify option to verify the configuration file,
then exit.  Patched against 2.0b5.

-Al Tobey



** ** **  PRIVILEGED AND CONFIDENTIAL  ** ** **
This email transmission contains privileged and confidential information 
intended only for the use of the individual or entity named above.  Any 
unauthorized review, use, disclosure or distribution is prohibited and 
may be a violation of law.  If you are not the intended recipient or a 
person responsible for delivering this message to an intended recipient, 
please delete the email and immediately notify the sender via the email 
return address or mailto:postmaster at priority-health.com.  Thank you.

-------------- next part --------------
--- nrpe.c.orig	Tue Jul 22 22:14:55 2003
+++ nrpe.c	Fri Sep  5 11:52:25 2003
@@ -73,6 +73,7 @@
 int     show_version=FALSE;
 int     use_inetd=TRUE;
 int     debug=FALSE;
+int     verify_only=FALSE;
 
 #ifdef HAVE_SSL
 SSL_METHOD *meth;
@@ -127,6 +128,7 @@
 		printf(" <mode>        = One of the following two operating modes:\n");  
 		printf("   -i          =    Run as a service under inetd or xinetd\n");
 		printf("   -d          =    Run as a standalone daemon\n");
+		printf("   -v          =    check configs - exit 0 if ok\n");
 		printf("\n");
 		printf("Notes:\n");
 		printf("This program is designed to process requests from the check_nrpe\n");
@@ -175,6 +177,10 @@
 		return STATE_CRITICAL;
 		}
 
+    if(verify_only==TRUE){
+        exit(STATE_OK);
+    }
+
 	/* initialize macros */
 	for(x=0;x<MAX_COMMAND_ARGUMENTS;x++)
 		macro_argv[x]=NULL;
@@ -1446,6 +1452,7 @@
 		{"no-ssl", no_argument, 0, 'n'},
 		{"help", no_argument, 0, 'h'},
 		{"license", no_argument, 0, 'l'},
+		{"verify", no_argument, 0, 'v'},
 		{0, 0, 0, 0}
                 };
 #endif
@@ -1454,7 +1461,7 @@
 	if(argc<2)
 		return ERROR;
 
-	snprintf(optchars,MAX_INPUT_BUFFER,"c:nidhl");
+	snprintf(optchars,MAX_INPUT_BUFFER,"c:nidhlv");
 
 	while(1){
 #ifdef HAVE_GETOPT_H
@@ -1493,6 +1500,10 @@
 		case 'n':
 			use_ssl=FALSE;
 			break;
+        case 'v':
+			have_mode=TRUE;
+            verify_only=TRUE;
+            break;
 		default:
 			return ERROR;
 			break;


More information about the Developers mailing list