Browse Source

Fixes for dumb Solaris, prep for 2.0b4

Ethan Galstad 23 năm trước cách đây
mục cha
commit
cedfdced42
10 tập tin đã thay đổi với 66 bổ sung18 xóa
  1. 1 0
      Changelog
  2. 2 2
      common/common.h
  3. 2 2
      configure
  4. 2 2
      configure.in
  5. 1 1
      nrpe.spec
  6. 1 1
      src/check_nrpe.c
  7. 6 6
      src/dh.h
  8. 4 2
      src/nrpe.c
  9. 44 1
      src/utils.c
  10. 3 1
      src/utils.h

+ 1 - 0
Changelog

@@ -13,6 +13,7 @@ NRPE Changelog
 - Added 'include_dir' variable to allow inclusion of external
   config files in directories (with recursion)
 - Added native SSL support (Derrick Bennett)
+- Added my_strsep(), as Solaris doesn't have strsep()
 
 
 1.8 - 01/16/2003

+ 2 - 2
common/common.h

@@ -23,8 +23,8 @@
 
 #include "config.h"
 
-#define PROGRAM_VERSION "2.0b3"
-#define MODIFICATION_DATE "04-17-2003"
+#define PROGRAM_VERSION "2.0b4"
+#define MODIFICATION_DATE "06-04-2003"
 
 #define OK		0
 #define ERROR		-1

+ 2 - 2
configure

@@ -535,9 +535,9 @@ fi
 
 
 PKG_NAME=nrpe
-PKG_VERSION="2.0b3"
+PKG_VERSION="2.0b4"
 PKG_HOME_URL="http://www.nagios.org/"
-PKG_REL_DATE="04-17-2003"
+PKG_REL_DATE="06-04-2003"
 
 
 ac_aux_dir=

+ 2 - 2
configure.in

@@ -9,9 +9,9 @@ AC_CONFIG_HEADER(common/config.h)
 AC_PREFIX_DEFAULT(/usr/local/nagios)
 
 PKG_NAME=nrpe
-PKG_VERSION="2.0b3"
+PKG_VERSION="2.0b4"
 PKG_HOME_URL="http://www.nagios.org/"
-PKG_REL_DATE="04-17-2003"
+PKG_REL_DATE="06-04-2003"
 
 dnl Figure out how to invoke "install" and what install options to use.
 

+ 1 - 1
nrpe.spec

@@ -1,5 +1,5 @@
 %define name nrpe
-%define version 2.0b3
+%define version 2.0b4
 %define release 1
 %define nsusr nagios
 %define nsgrp nagios

+ 1 - 1
src/check_nrpe.c

@@ -4,7 +4,7 @@
  * Copyright (c) 1999-2003 Ethan Galstad (nagios@nagios.org)
  * License: GPL
  *
- * Last Modified: 04-17-2003
+ * Last Modified: 06-04-2003
  *
  * Command line: CHECK_NRPE -H <host_address> [-p port] [-c command] [-to to_sec]
  *

+ 6 - 6
src/dh.h

@@ -4,12 +4,12 @@
 DH *get_dh512()
 	{
 	static unsigned char dh512_p[]={
-		0xA8,0x3A,0x30,0xC2,0x7A,0xF8,0xEB,0xC5,0x01,0x11,0xB8,0x51,
-		0xBE,0x1A,0x6C,0x0D,0x62,0x0D,0xD5,0xED,0x7D,0x35,0x33,0xE9,
-		0xB7,0xB6,0x7C,0x14,0x3F,0x6B,0x1E,0xE5,0x73,0xB8,0x09,0x6C,
-		0xB2,0x06,0x7B,0x09,0x50,0xD5,0xCE,0xA2,0xFC,0x03,0x8D,0xD3,
-		0xDB,0x3F,0x2E,0x5B,0x98,0x49,0x25,0xDC,0x45,0x9B,0x92,0x84,
-		0x5F,0xAE,0x37,0x3B,
+		0xF1,0x28,0x95,0x15,0x27,0xE4,0x53,0x83,0x57,0xFD,0x65,0xB2,
+		0x18,0x7D,0x90,0x68,0xCA,0x00,0xF8,0x43,0x02,0x3D,0x44,0xCB,
+		0xD0,0x81,0x6D,0x47,0x3D,0x70,0x5C,0xCF,0x19,0xF0,0x26,0x05,
+		0x41,0xFD,0x59,0x13,0xC3,0x47,0x90,0xFC,0x38,0xC4,0xA8,0xE4,
+		0x63,0x65,0x6E,0x10,0x3F,0xE2,0x9A,0xAB,0x8B,0x73,0x83,0xF6,
+		0x84,0x87,0xF7,0x83,
 		};
 	static unsigned char dh512_g[]={
 		0x02,

+ 4 - 2
src/nrpe.c

@@ -4,7 +4,7 @@
  * Copyright (c) 1999-2003 Ethan Galstad (nagios@nagios.org)
  * License: GPL
  *
- * Last Modified: 04-17-2003
+ * Last Modified: 06-04-2003
  *
  * Command line: nrpe -c <config_file> [--inetd | --daemon]
  *
@@ -1074,6 +1074,7 @@ int my_system(char *command,int timeout,int *early_timeout,char *output,int outp
 		else{
 
 			/* read in the first line of output from the command */
+			strcpy(buffer,"");
 			fgets(buffer,sizeof(buffer)-1,fp);
 
 			/* close the command and get termination status */
@@ -1123,6 +1124,7 @@ int my_system(char *command,int timeout,int *early_timeout,char *output,int outp
 
 		/* try and read the results from the command output (retry if we encountered a signal) */
 		if(output!=NULL){
+			strcpy(output,"");
 			do{
 				bytes_read=read(fd[0],output,output_length-1);
 		                }while(bytes_read==-1 && errno==EINTR);
@@ -1375,7 +1377,7 @@ int process_macros(char *input_buffer,char *output_buffer,int buffer_length){
 
 	in_macro=FALSE;
 
-	for(temp_buffer=strsep(&input_buffer,"$");temp_buffer!=NULL;temp_buffer=strsep(&input_buffer,"$")){
+	for(temp_buffer=my_strsep(&input_buffer,"$");temp_buffer!=NULL;temp_buffer=my_strsep(&input_buffer,"$")){
 
 		selected_macro=NULL;
 

+ 44 - 1
src/utils.c

@@ -5,7 +5,7 @@
  * License: GPL
  * Copyright (c) 1999-2003 Ethan Galstad (nagios@nagios.org)
  *
- * Last Modified: 04-15-2003
+ * Last Modified: 06-04-2003
  *
  * Description:
  *
@@ -372,6 +372,49 @@ int recvall(int s, char *buf, int *len, int timeout){
         }
 
 
+/* fixes compiler problems under Solaris, since strsep() isn't included */
+/* this code is taken from the glibc source */
+char *my_strsep (char **stringp, const char *delim){
+	char *begin, *end;
+
+	begin = *stringp;
+	if (begin == NULL)
+		return NULL;
+
+	/* A frequent case is when the delimiter string contains only one
+	   character.  Here we don't need to call the expensive `strpbrk'
+	   function and instead work using `strchr'.  */
+	if(delim[0]=='\0' || delim[1]=='\0'){
+		char ch = delim[0];
+
+		if(ch=='\0')
+			end=NULL;
+		else{
+			if(*begin==ch)
+				end=begin;
+			else
+				end=strchr(begin+1,ch);
+			}
+		}
+
+	else
+		/* Find the end of the token.  */
+		end = strpbrk (begin, delim);
+
+	if(end){
+
+		/* Terminate the token and set *STRINGP past NUL character.  */
+		*end++='\0';
+		*stringp=end;
+		}
+	else
+		/* No more delimiters; this is the last token.  */
+		*stringp=NULL;
+
+	return begin;
+	}
+
+
 /* show license */
 void display_license(void){
 

+ 3 - 1
src/utils.h

@@ -5,7 +5,7 @@
  * License: GPL
  * Copyright (c) 1999-2003 Ethan Galstad (nagios@nagios.org)
  *
- * Last Modified: 01-28-2003
+ * Last Modified: 06-04-2003
  *
  * Description:
  *
@@ -50,6 +50,8 @@ void strip(char *);
 int sendall(int,char *,int *);
 int recvall(int,char *,int *,int);
 
+char *my_strsep(char **,const char *);
+
 void display_license(void);
 
 #endif