Sfoglia il codice sorgente

Patch for ReiserFS, prep for NRPE 2.5 release

Ethan Galstad 20 anni fa
parent
commit
c18b6834d4
3 ha cambiato i file con 15 aggiunte e 20 eliminazioni
  1. 1 0
      Changelog
  2. 6 6
      include/dh.h
  3. 8 14
      src/nrpe.c

+ 1 - 0
Changelog

@@ -7,6 +7,7 @@ NRPE Changelog
 ----------------
 - (Re)added allowed_hosts option for systems that don't support TCP wrappers
 - Fix for SSL errors under Solaris 8 (Niels Endres)
+- Fix for config file directory inclusion on ReiserFS (Gerhard Lausser)
 
 
 2.4 - 02/22/2006

+ 6 - 6
include/dh.h

@@ -4,12 +4,12 @@
 DH *get_dh512()
 	{
 	static unsigned char dh512_p[]={
-		0xB0,0xE0,0xEC,0x93,0x2C,0x3E,0xBB,0x6C,0x9C,0x7D,0xD7,0x46,
-		0xA5,0x9A,0xBD,0x05,0x35,0x09,0xAA,0xD4,0xF6,0x59,0xD9,0xB7,
-		0xC8,0x04,0x7A,0x88,0x0F,0xBF,0x9D,0xBB,0xAE,0xC9,0xD0,0xA2,
-		0xC6,0xE5,0x8E,0xAC,0x13,0x01,0x4C,0x2B,0x1E,0x18,0xB0,0xC6,
-		0x46,0x6E,0x70,0x6E,0xED,0xBC,0x4C,0x47,0xA3,0x9D,0x23,0x6D,
-		0xD1,0x37,0xFB,0x3B,
+		0xE2,0x44,0x02,0x4F,0x5D,0x56,0x0A,0x7E,0xA9,0x54,0x39,0x9F,
+		0xFA,0x36,0x7A,0x59,0xBD,0x4B,0xC4,0x7E,0xC9,0xF6,0x79,0xA4,
+		0xD7,0x3B,0xAD,0xB7,0xA6,0x8E,0xEA,0xE1,0x4E,0x79,0x09,0x62,
+		0x02,0xD0,0xBD,0xED,0x70,0x13,0xFE,0x29,0x66,0x57,0xFB,0x3A,
+		0x4A,0xF7,0x23,0xFF,0x65,0xE4,0xB0,0x75,0x76,0xD6,0x48,0x15,
+		0x01,0x5F,0xBA,0x63,
 		};
 	static unsigned char dh512_g[]={
 		0x02,

+ 8 - 14
src/nrpe.c

@@ -511,6 +511,7 @@ int read_config_dir(char *dirname){
 	char config_file[MAX_FILENAME_LENGTH];
 	DIR *dirp;
 	struct dirent *dirfile;
+	struct stat buf;
 	int result=OK;
 	int x;
 
@@ -524,19 +525,18 @@ int read_config_dir(char *dirname){
 	/* process all files in the directory... */
 	while((dirfile=readdir(dirp))!=NULL){
 
+		/* create the full path to the config file or subdirectory */
+		snprintf(config_file,sizeof(config_file)-1,"%s/%s",dirname,dirfile->d_name);
+		config_file[sizeof(config_file)-1]='\x0';
+		stat(config_file, &buf);
+
 		/* process this if it's a config file... */
 		x=strlen(dirfile->d_name);
 		if(x>4 && !strcmp(dirfile->d_name+(x-4),".cfg")){
 
-#ifdef _DIRENT_HAVE_D_TYPE
 			/* only process normal files */
-			if(dirfile->d_type!=DT_REG)
+			if(!S_ISREG(buf.st_mode))
 				continue;
-#endif
-
-			/* create the full path to the config file */
-			snprintf(config_file,sizeof(config_file)-1,"%s/%s",dirname,dirfile->d_name);
-			config_file[sizeof(config_file)-1]='\x0';
 
 			/* process the config file */
 			result=read_config_file(config_file);
@@ -546,18 +546,13 @@ int read_config_dir(char *dirname){
 				break;
 		        }
 
-#ifdef _DIRENT_HAVE_D_TYPE
 		/* recurse into subdirectories... */
-		if(dirfile->d_type==DT_DIR){
+		if(S_ISDIR(buf.st_mode)){
 
 			/* ignore current, parent and hidden directory entries */
 			if(dirfile->d_name[0]=='.')
 				continue;
 
-			/* create the full path to the config directory */
-			snprintf(config_file,sizeof(config_file)-1,"%s/%s",dirname,dirfile->d_name);
-			config_file[sizeof(config_file)-1]='\x0';
-
 			/* process the config directory */
 			result=read_config_dir(config_file);
 
@@ -565,7 +560,6 @@ int read_config_dir(char *dirname){
 			if(result==ERROR)
 				break;
 		        }
-#endif
 		}
 
 	closedir(dirp);