nagios.patch 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. Index: base/checks.c
  2. --- base/checks.c.orig 2007-04-10 16:50:22 +0200
  3. +++ base/checks.c 2007-04-11 08:41:13 +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 2007-04-11 08:41:13 +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 2007-04-10 16:50:22 +0200
  43. +++ base/utils.c 2007-04-11 08:43:42 +0200
  44. @@ -2811,7 +2811,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. @@ -2822,7 +2822,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. @@ -2838,7 +2839,7 @@
  60. if(status==-1)
  61. result=STATE_CRITICAL;
  62. else {
  63. - result=WEXITSTATUS(status);
  64. + result=(WIFEXITED(status) ? WEXITSTATUS(status) : -1);
  65. if(result==0 && WIFSIGNALED(status)){
  66. /* like bash */
  67. result=128+WTERMSIG(status);
  68. @@ -2882,11 +2883,11 @@
  69. #endif
  70. /* get the exit code returned from the program */
  71. - result=WEXITSTATUS(status);
  72. + result=(WIFEXITED(status) ? WEXITSTATUS(status) : -1);
  73. /* check for possibly missing scripts/binaries/etc */
  74. if(result==126 || result==127){
  75. - 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);
  76. + 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);
  77. buffer[sizeof(buffer)-1]='\x0';
  78. write_to_logs_and_console(buffer,NSLOG_RUNTIME_WARNING,TRUE);
  79. }
  80. Index: nagios-plugins-1.4.9/configure
  81. --- nagios-plugins-1.4.9/configure.orig 2007-03-29 12:55:12 +0200
  82. +++ nagios-plugins-1.4.9/configure 2007-04-11 08:41:13 +0200
  83. @@ -21070,8 +21070,8 @@
  84. fi
  85. if test "$ac_cv_lib_ldap_main" = "yes"; then
  86. - LDAPLIBS="-lldap -llber"\
  87. - LDAPINCLUDE="-I/usr/include/ldap"
  88. + LDAPLIBS="-lldap -llber -lssl -lcrypto"
  89. + LDAPINCLUDE="-I$prefix/include"
  90. @@ -24310,17 +24310,10 @@
  91. echo "$as_me:$LINENO: checking for ICMP ping syntax" >&5
  92. echo $ECHO_N "checking for ICMP ping syntax... $ECHO_C" >&6
  93. -ac_cv_ping_packets_first=no
  94. -ac_cv_ping_has_timeout=no
  95. if test -n "$with_ping_command"
  96. then
  97. echo "$as_me:$LINENO: result: (command-line) $with_ping_command" >&5
  98. echo "${ECHO_T}(command-line) $with_ping_command" >&6
  99. - if test -n "$ac_cv_ping_packets_first"
  100. - then
  101. - ac_cv_ping_packets_first=yes
  102. - ac_cv_ping_has_timeout=yes
  103. - fi
  104. elif [ "z$ac_cv_uname_s" = "zUnixWare" ] && \
  105. $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
  106. Index: nagios-plugins-1.4.9/plugins/common.h
  107. --- nagios-plugins-1.4.9/plugins/common.h.orig 2007-03-22 18:54:16 +0100
  108. +++ nagios-plugins-1.4.9/plugins/common.h 2007-04-11 08:41:13 +0200
  109. @@ -176,7 +176,7 @@
  110. /* Solaris does not have floorf, but floor works. Should probably be in configure */
  111. #if defined(__sun) || defined(__sun__)
  112. -static inline float floorf (float x) { return floor(x); }
  113. +#define floorf(x) (float)floor((double)(x))
  114. #endif
  115. enum {