[Nagiosplug-checkins] CVS: nagiosplug/plugins check_tcp.c,1.38,1.39 netutils.c,1.17,1.18
Karl DeBisschop
kdebisschop at users.sourceforge.net
Mon Mar 1 04:39:02 CET 2004
Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24139/plugins
Modified Files:
check_tcp.c netutils.c
Log Message:
check_tcp was returning uninitialized string with user-defined refused outcome
Index: check_tcp.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_tcp.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -r1.38 -r1.39
*** check_tcp.c 21 Jan 2004 12:45:19 -0000 1.38
--- check_tcp.c 1 Mar 2004 12:27:19 -0000 1.39
***************
*** 207,210 ****
--- 207,211 ----
server_send = SEND;
server_quit = QUIT;
+ status = strdup ("");
if (process_arguments (argc, argv) == ERROR)
***************
*** 260,264 ****
buffer = malloc (MAXBUF);
memset (buffer, '\0', MAXBUF);
- status = strdup ("");
/* watch for the expect string */
while ((i = my_recv ()) > 0) {
--- 261,264 ----
***************
*** 272,276 ****
/* return a CRITICAL status if we couldn't read any data */
! if (status == NULL)
die (STATE_CRITICAL, _("No data received from host\n"));
--- 272,276 ----
/* return a CRITICAL status if we couldn't read any data */
! if (strlen(status) == 0)
die (STATE_CRITICAL, _("No data received from host\n"));
Index: netutils.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/netutils.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** netutils.c 29 Feb 2004 04:09:34 -0000 1.17
--- netutils.c 1 Mar 2004 12:27:19 -0000 1.18
***************
*** 253,261 ****
switch (errno) {
case ECONNREFUSED:
! switch (econn_refuse_state) {
! case STATE_OK:
! case STATE_WARNING:
! was_refused = TRUE;
! }
break;
}
--- 253,257 ----
switch (errno) {
case ECONNREFUSED:
! was_refused = TRUE;
break;
}
***************
*** 270,275 ****
if (result == 0)
return STATE_OK;
! else if (was_refused)
! return econn_refuse_state;
else {
printf ("%s\n", strerror(errno));
--- 266,284 ----
if (result == 0)
return STATE_OK;
! else if (was_refused) {
! switch (econn_refuse_state) { /* a user-defined expected outcome */
! case STATE_OK:
! case STATE_WARNING: /* user wants WARN or OK on refusal */
! return econn_refuse_state;
! break;
! case STATE_CRITICAL: /* user did not set econn_refuse_state */
! printf ("%s\n", strerror(errno));
! return econn_refuse_state;
! break;
! default: /* it's a logic error if we do not end up in STATE_(OK|WARNING|CRITICAL) */
! return STATE_UNKNOWN;
! break;
! }
! }
else {
printf ("%s\n", strerror(errno));
More information about the Commits
mailing list