Browse Source

"Remote %s accepted a Version %s Packet", please add to debug

Partial fix for issue #72

I would really rather not add another command-line flag at this
point, so instead I changed a little what gets logged.

If check_nrpe is v3.x, it will NOT log any messages if the remote
accepts a version 3 packet. If the `-2` switch (only use version 2
packet) was set, it will NOT log any messages. It will only log
a message if it first tried to send a version 3 packet, failed,
and sent a version 2 packet which succeeded. It will be logged
with logleve `LOG_DEBUG`.

It's not quite what the origianal poster wanted, but it should
reduce the number of log messages.
John C. Frickson 9 năm trước cách đây
mục cha
commit
08425ff922
2 tập tin đã thay đổi với 3 bổ sung6 xóa
  1. 1 0
      Changelog
  2. 2 6
      src/check_nrpe.c

+ 1 - 0
Changelog

@@ -19,6 +19,7 @@ FIXES
 - Got rid of some compiler warnings (Stefan Krüger / John Frickson)
 - Add SOURCE_DATE_EPOCH specification support for reproducible builds. (Bas Couwenberg)
 - nrpe 3.0.1 allows TLSv1 and TLSv1.1 when I configure for TLSv1.2+ (John Frickson)
+- "Remote %s accepted a Version %s Packet", please add to debug (John Frickson)
 
 
 3.0.1 - 2016-09-08

+ 2 - 6
src/check_nrpe.c

@@ -169,12 +169,8 @@ int main(int argc, char **argv)
 		result = read_response();	/* Get the response */
 	}
 
-	if (result != -1) {
-		if (force_v2_packet = 0 && packet_ver == NRPE_PACKET_VERSION_2)
-			syslog(LOG_INFO, "Remote %s accepted a Version %d Packet", rem_host, packet_ver);
-		else
-			syslog(LOG_DEBUG, "Remote %s accepted a Version %d Packet", rem_host, packet_ver);
-	}
+	if (result != -1 && force_v2_packet == 0 && packet_ver == NRPE_PACKET_VERSION_2)
+		syslog(LOG_DEBUG, "Remote %s accepted a Version %d Packet", rem_host, packet_ver);
 
 	return result;
 }