[Nagiosplug-checkins] nagiosplug/plugins check_smtp.c,1.58,1.59

Ton Voon tonvoon at users.sourceforge.net
Tue Mar 6 23:29:29 CET 2007


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv3703

Modified Files:
	check_smtp.c 
Log Message:
Fixed compile errors in check_smtp.c


Index: check_smtp.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_smtp.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- check_smtp.c	6 Mar 2007 22:17:04 -0000	1.58
+++ check_smtp.c	6 Mar 2007 22:29:27 -0000	1.59
@@ -169,7 +169,7 @@
 	int result = STATE_UNKNOWN;
 	char *cmd_str = NULL;
 	char *helocmd = NULL;
-	char *error_msg = NULL;
+	char *error_msg = "";
 	struct timeval tv;
 
 	setlocale (LC_ALL, "");
@@ -380,12 +380,12 @@
 				do {
 					if (authuser == NULL) {
 						result = STATE_CRITICAL;
-						error_msg = _("no authuser specified, ");
+						asprintf(&error_msg, _("no authuser specified, "));
 						break;
 					}
 					if (authpass == NULL) {
 						result = STATE_CRITICAL;
-						error_msg = _("no authpass specified, ");
+						asprintf(&error_msg, _("no authpass specified, "));
 						break;
 					}
 
@@ -395,7 +395,7 @@
 						printf (_("sent %s\n"), "AUTH LOGIN");
 
 					if((ret = my_recv(buffer, MAXBUF - 1)) < 0){
-						error_msg = _("recv() failed after AUTH LOGIN, \n");
+						asprintf(&error_msg, _("recv() failed after AUTH LOGIN, "));
 						result = STATE_WARNING;
 						break;
 					}
@@ -405,7 +405,7 @@
 
 					if (strncmp (buffer, "334", 3) != 0) {
 						result = STATE_CRITICAL;
-						error_msg = _("invalid response received after AUTH LOGIN, ");
+						asprintf(&error_msg, _("invalid response received after AUTH LOGIN, "));
 						break;
 					}
 
@@ -418,7 +418,7 @@
 
 					if ((ret = my_recv(buffer, MAX_INPUT_BUFFER-1)) == -1) {
 						result = STATE_CRITICAL;
-						error_msg = _("recv() failed after sending authuser, ");
+						asprintf(&error_msg, _("recv() failed after sending authuser, "));
 						break;
 					}
 					buffer[ret] = 0;
@@ -427,7 +427,7 @@
 					}
 					if (strncmp (buffer, "334", 3) != 0) {
 						result = STATE_CRITICAL;
-						error_msg = _("invalid response received after authuser, ");
+						asprintf(&error_msg, _("invalid response received after authuser, "));
 						break;
 					}
 					/* encode authpass with base64 */
@@ -439,7 +439,7 @@
 					}
 					if ((ret = my_recv(buffer, MAX_INPUT_BUFFER-1)) == -1) {
 						result = STATE_CRITICAL;
-						error_msg = _("recv() failed after sending authpass, ");
+						asprintf(&error_msg, _("recv() failed after sending authpass, "));
 						break;
 					}
 					buffer[ret] = 0;
@@ -448,14 +448,14 @@
 					}
 					if (strncmp (buffer, "235", 3) != 0) {
 						result = STATE_CRITICAL;
-						error_msg = _("invalid response received after authpass, ");
+						asprintf(&error_msg, _("invalid response received after authpass, "));
 						break;
 					}
 					break;
 				} while (0);
 			} else {
 				result = STATE_CRITICAL;
-				error_msg = _("only authtype LOGIN is supported, ");
+				asprintf(&error_msg, _("only authtype LOGIN is supported, "));
 			}
 		}
 
@@ -481,7 +481,7 @@
 
 	printf (_("SMTP %s - %s%.3f sec. response time%s%s|%s\n"),
 			state_text (result),
-			(error_msg == NULL ? "" : error_msg),
+			error_msg,
 			elapsed_time,
 			verbose?", ":"", verbose?buffer:"",
 			fperfdata ("time", elapsed_time, "s",





More information about the Commits mailing list