Browse Source

Fix for yesterday's commit to handle NSClient++ problems.

The code worked fine, but forcing a minimum size messed up the
CRC calculation. This change makes sure both end are calculating
the CRC for the same length.
John C. Frickson 9 years ago
parent
commit
1f5fd43e2e
1 changed files with 2 additions and 4 deletions
  1. 2 4
      src/check_nrpe.c

+ 2 - 4
src/check_nrpe.c

@@ -1027,7 +1027,8 @@ int send_request()
 		v3_send_packet->packet_version = htons(packet_ver);
 		v3_send_packet->packet_type = htons(QUERY_PACKET);
 		v3_send_packet->alignment = 0;
-		v3_send_packet->buffer_length = htonl(strlen(query) + 1);
+/*		v3_send_packet->buffer_length = htonl(strlen(query) + 1); */
+		v3_send_packet->buffer_length = htonl(pkt_size - sizeof(v3_packet) + 1);
 		strcpy(&v3_send_packet->buffer[0], query);
 
 		/* calculate the crc 32 value of the packet */
@@ -1390,9 +1391,6 @@ void alarm_handler(int sig)
 	write(STDOUT_FILENO, msg2, sizeof(msg2) - 1);
 	write(STDOUT_FILENO, msg3, sizeof(msg3) - 1);
 
-	printf("CHECK_NRPE STATE %s: Socket timeout after %d seconds.\n",state_text(timeout_return_code),socket_timeout);
-
-
 	exit(timeout_return_code);
 }