From cea4c2dee6af6ff2c94f7681f828da33b52840a7 Mon Sep 17 00:00:00 2001
From: Jann Horn <jannhorn@googlemail.com>
Date: Sat, 12 Feb 2011 15:26:30 +0100
Subject: [PATCH] removed random data from network packets

---
 include/utils.h  |    2 --
 src/check_nrpe.c |    3 ---
 src/nrpe.c       |    3 ---
 src/utils.c      |   35 -----------------------------------
 4 files changed, 0 insertions(+), 43 deletions(-)

diff --git a/include/utils.h b/include/utils.h
index 2c6b1a5..210db34 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -38,8 +38,6 @@
 void generate_crc32_table(void);
 unsigned long calculate_crc32(char *, int);
 
-void randomize_buffer(char *,int);
-
 int my_tcp_connect(char *,char *,int *);
 
 void strip(char *);
diff --git a/src/check_nrpe.c b/src/check_nrpe.c
index c4e5fe8..7b4d96d 100644
--- a/src/check_nrpe.c
+++ b/src/check_nrpe.c
@@ -186,9 +186,6 @@ int main(int argc, char **argv){
 		/* clear the packet buffer */
 		bzero(&send_packet,sizeof(send_packet));
 
-		/* fill the packet with semi-random data */
-		randomize_buffer((char *)&send_packet,sizeof(send_packet));
-
 		/* initialize packet data */
 		send_packet.packet_version=(int16_t)htons(NRPE_PACKET_VERSION_2);
 		send_packet.packet_type=(int16_t)htons(QUERY_PACKET);
diff --git a/src/nrpe.c b/src/nrpe.c
index b86fa4e..f3f8baf 100644
--- a/src/nrpe.c
+++ b/src/nrpe.c
@@ -1239,9 +1239,6 @@ void handle_connection(int sock){
 	/* clear the response packet buffer */
 	bzero(&send_packet,sizeof(send_packet));
 
-	/* fill the packet with semi-random data */
-	randomize_buffer((char *)&send_packet,sizeof(send_packet));
-
 	/* initialize response packet data */
 	send_packet.packet_version=(int16_t)htons(NRPE_PACKET_VERSION_2);
 	send_packet.packet_type=(int16_t)htons(RESPONSE_PACKET);
diff --git a/src/utils.c b/src/utils.c
index 26c0190..091d734 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -76,41 +76,6 @@ unsigned long calculate_crc32(char *buffer, int buffer_size){
         }
 
 
-/* fill a buffer with semi-random data */
-void randomize_buffer(char *buffer,int buffer_size){
-	FILE *fp;
-	int x;
-	int seed;
-
-	/**** FILL BUFFER WITH RANDOM ALPHA-NUMERIC CHARACTERS ****/
-
-	/***************************************************************
-	   Only use alpha-numeric characters becase plugins usually
-	   only generate numbers and letters in their output.  We
-	   want the buffer to contain the same set of characters as
-	   plugins, so its harder to distinguish where the real output
-	   ends and the rest of the buffer (padded randomly) starts.
-	***************************************************************/
-
-	/* try to get seed value from /dev/urandom, as its a better source of entropy */
-	fp=fopen("/dev/urandom","r");
-	if(fp!=NULL){
-		seed=fgetc(fp);
-		fclose(fp);
-	        }
-
-	/* else fallback to using the current time as the seed */
-	else
-		seed=(int)time(NULL);
-
-	srand(seed);
-	for(x=0;x<buffer_size;x++)
-		buffer[x]=(int)'0'+(int)(72.0*rand()/(RAND_MAX+1.0));
-
-	return;
-        }
-
-
 /* opens a connection to a remote host/tcp port */
 int my_tcp_connect(char *host_name,char *port,int *sd6){
 	int result;
-- 
1.5.6.5

