nagios.patch 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. Index: base/checks.c
  2. --- base/checks.c.orig 2006-06-21 02:59:19 +0200
  3. +++ base/checks.c 2006-10-20 20:44:43 +0200
  4. @@ -486,7 +486,8 @@
  5. _exit(STATE_UNKNOWN);
  6. /* default return string in case nothing was returned */
  7. - strcpy(plugin_output,"(No output!)");
  8. + snprintf(plugin_output,sizeof(plugin_output)-1,"(No output from command \"%s\")", processed_command);
  9. + plugin_output[sizeof(plugin_output)-1]='\x0';
  10. /* grab the plugin output and clean it */
  11. fgets(plugin_output,sizeof(plugin_output)-1,fp);
  12. @@ -508,7 +509,7 @@
  13. /* record check result info */
  14. strncpy(svc_msg.output,plugin_output,sizeof(svc_msg.output)-1);
  15. svc_msg.output[sizeof(svc_msg.output)-1]='\x0';
  16. - svc_msg.return_code=WEXITSTATUS(pclose_result);
  17. + svc_msg.return_code=(WIFEXITED(pclose_result) ? WEXITSTATUS(pclose_result) : -1);
  18. svc_msg.exited_ok=TRUE;
  19. svc_msg.check_type=SERVICE_CHECK_ACTIVE;
  20. svc_msg.finish_time=end_time;
  21. Index: base/logging.c
  22. --- base/logging.c.orig 2005-12-13 01:42:45 +0100
  23. +++ base/logging.c 2006-10-20 20:44:43 +0200
  24. @@ -208,6 +208,7 @@
  25. /* write something to the syslog facility */
  26. int write_to_syslog(char *buffer, unsigned long data_type){
  27. +static int logopen = 0;
  28. #ifdef DEBUG0
  29. printf("write_to_syslog() start\n");
  30. @@ -225,6 +226,12 @@
  31. if(!(data_type & syslog_options))
  32. return OK;
  33. + /* OSSP fsl identification */
  34. + if (!logopen) {
  35. + openlog("nagios", LOG_NDELAY, LOG_USER);
  36. + logopen = 1;
  37. + }
  38. +
  39. /* write the buffer to the syslog facility */
  40. syslog(LOG_USER|LOG_INFO,"%s",buffer);
  41. Index: base/utils.c
  42. --- base/utils.c.orig 2006-07-13 23:55:10 +0200
  43. +++ base/utils.c 2006-10-20 20:44:43 +0200
  44. @@ -2806,7 +2806,7 @@
  45. /* report an error if we couldn't run the command */
  46. if(fp==NULL){
  47. - strncpy(buffer,"(Error: Could not execute command)\n",sizeof(buffer)-1);
  48. + snprintf(buffer,sizeof(buffer)-1,"(Error: Could not execute command \"%s\")", cmd);
  49. buffer[sizeof(buffer)-1]='\x0';
  50. /* write the error back to the parent process */
  51. @@ -2817,7 +2817,8 @@
  52. else{
  53. /* default return string in case nothing was returned */
  54. - strcpy(buffer,"(No output!)");
  55. + snprintf(buffer,sizeof(buffer)-1,"(No output from command \"%s\")", cmd);
  56. + buffer[sizeof(buffer)-1]='\x0';
  57. /* read in the first line of output from the command */
  58. fgets(buffer,sizeof(buffer)-1,fp);
  59. @@ -2833,7 +2834,7 @@
  60. if(status==-1)
  61. result=STATE_CRITICAL;
  62. else
  63. - result=WEXITSTATUS(status);
  64. + result=(WIFEXITED(status) ? WEXITSTATUS(status) : -1);
  65. /* write the output back to the parent process */
  66. write(fd[1],buffer,strlen(buffer)+1);
  67. @@ -2870,11 +2871,11 @@
  68. #endif
  69. /* get the exit code returned from the program */
  70. - result=WEXITSTATUS(status);
  71. + result=(WIFEXITED(status) ? WEXITSTATUS(status) : -1);
  72. /* check for possibly missing scripts/binaries/etc */
  73. if(result==126 || result==127){
  74. - snprintf(buffer,sizeof(buffer)-1,"Warning: Attempting to execute the command \"%s\" resulted in a return code of %d. Make sure the script or binary you are trying to execute actually exists...\n",cmd,result);
  75. + snprintf(buffer,sizeof(buffer)-1,"Warning: Attempting to execute the command \"%s\" (timeout %ds) resulted in a return code of %d. Make sure the script or binary you are trying to execute actually exists...\n",cmd,timeout,result);
  76. buffer[sizeof(buffer)-1]='\x0';
  77. write_to_logs_and_console(buffer,NSLOG_RUNTIME_WARNING,TRUE);
  78. }
  79. Index: nagios-plugins-1.4.7/configure
  80. --- nagios-plugins-1.4.7/configure.orig 2006-10-19 22:08:11 +0200
  81. +++ nagios-plugins-1.4.7/configure 2006-10-20 20:44:43 +0200
  82. @@ -25123,8 +25123,8 @@
  83. fi
  84. if test "$ac_cv_lib_ldap_main" = "yes"; then
  85. - LDAPLIBS="-lldap -llber"\
  86. - LDAPINCLUDE="-I/usr/include/ldap"
  87. + LDAPLIBS="-lldap -llber -lssl -lcrypto"
  88. + LDAPINCLUDE="-I$prefix/include"
  89. @@ -29931,17 +29931,10 @@
  90. echo "$as_me:$LINENO: checking for ICMP ping syntax" >&5
  91. echo $ECHO_N "checking for ICMP ping syntax... $ECHO_C" >&6
  92. -ac_cv_ping_packets_first=no
  93. -ac_cv_ping_has_timeout=no
  94. if test -n "$with_ping_command"
  95. then
  96. echo "$as_me:$LINENO: result: (command-line) $with_ping_command" >&5
  97. echo "${ECHO_T}(command-line) $with_ping_command" >&6
  98. - if test -n "$ac_cv_ping_packets_first"
  99. - then
  100. - ac_cv_ping_packets_first=yes
  101. - ac_cv_ping_has_timeout=yes
  102. - fi
  103. elif [ "z$ac_cv_uname_s" = "zUnixWare" ] && \
  104. $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
  105. Index: nagios-plugins-1.4.7/plugins/common.h
  106. --- nagios-plugins-1.4.7/plugins/common.h.orig 2006-07-29 03:43:34 +0200
  107. +++ nagios-plugins-1.4.7/plugins/common.h 2006-10-20 20:44:43 +0200
  108. @@ -213,7 +213,7 @@
  109. /* Solaris does not have floorf, but floor works. Should probably be in configure */
  110. #if defined(__sun) || defined(__sun__)
  111. -static inline float floorf (float x) { return floor(x); }
  112. +#define floorf(x) (float)floor((double)(x))
  113. #endif
  114. enum {