diff -ur nrpe-2.12.original/include/common.h nrpe-2.12/include/common.h --- nrpe-2.12.original/include/common.h 2008-03-10 22:04:42.000000000 +0100 +++ nrpe-2.12/include/common.h 2008-08-05 00:27:10.664753368 +0200 @@ -41,7 +41,7 @@ #define DEFAULT_SOCKET_TIMEOUT 10 /* timeout after 10 seconds */ #define DEFAULT_CONNECTION_TIMEOUT 300 /* timeout if daemon is waiting for connection more than this time */ -#define MAX_INPUT_BUFFER 2048 /* max size of most buffers we use */ +#define MAX_INPUT_BUFFER 16384 /* max size of most buffers we use */ #define MAX_FILENAME_LENGTH 256 #define MAX_HOST_ADDRESS_LENGTH 256 /* max size of a host address */ @@ -55,12 +55,14 @@ #define QUERY_PACKET 1 /* id code for a packet containing a query */ #define RESPONSE_PACKET 2 /* id code for a packet containing a response */ +#define RESPONSE_PACKET_WITH_MORE 3 /* id code for a packet containing a response, with more data to follow */ #define NRPE_PACKET_VERSION_3 3 /* packet version identifier */ #define NRPE_PACKET_VERSION_2 2 #define NRPE_PACKET_VERSION_1 1 /* older packet version identifiers (no longer supported) */ -#define MAX_PACKETBUFFER_LENGTH 1024 /* max amount of data we'll send in one query/response */ +#define MAX_PACKETBUFFER_LENGTH 1024 /* max amount of data we'll send in one query/response. WARNING - do not change this + as older clients/servers will not work */ typedef struct packet_struct{ int16_t packet_version; Binary files nrpe-2.12.original/src/check_nrpe and nrpe-2.12/src/check_nrpe differ diff -ur nrpe-2.12.original/src/check_nrpe.c nrpe-2.12/src/check_nrpe.c --- nrpe-2.12.original/src/check_nrpe.c 2008-03-10 22:04:43.000000000 +0100 +++ nrpe-2.12/src/check_nrpe.c 2008-08-05 00:48:00.731981872 +0200 @@ -221,6 +221,11 @@ return STATE_UNKNOWN; } + /* Altinity patch: Allow multiple packets to be received */ + /* Indentation not corrected to allow simpler patching */ + /* START MULTI_PACKET LOOP */ + do { + /* wait for the response packet */ bytes_to_recv=sizeof(receive_packet); if(use_ssl==FALSE) @@ -233,31 +238,24 @@ /* reset timeout */ alarm(0); - /* close the connection */ -#ifdef HAVE_SSL - if(use_ssl==TRUE){ - SSL_shutdown(ssl); - SSL_free(ssl); - SSL_CTX_free(ctx); - } -#endif - graceful_close(sd,1000); - /* recv() error */ if(rc<0){ printf("CHECK_NRPE: Error receiving data from daemon.\n"); + graceful_close(sd,1000); return STATE_UNKNOWN; } /* server disconnected */ else if(rc==0){ printf("CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.\n"); + graceful_close(sd,1000); return STATE_UNKNOWN; } /* receive underflow */ else if(bytes_to_recv0) + send_packet.packet_type=(int16_t)htons(RESPONSE_PACKET_WITH_MORE); + else + send_packet.packet_type=(int16_t)htons(RESPONSE_PACKET); + /* calculate the crc 32 value of the packet */ send_packet.crc32_value=(u_int32_t)0L; calculated_crc32=calculate_crc32((char *)&send_packet,sizeof(send_packet)); @@ -1276,6 +1292,9 @@ SSL_write(ssl,&send_packet,bytes_to_send); #endif + } while (strlen(pbuffer) > 0); + /* END MULTI_PACKET LOOP */ + #ifdef HAVE_SSL if(ssl){ SSL_shutdown(ssl);