[Nagiosplug-devel] patch for check_smtp.c

Karl Ewald karl.ewald at ixos.de
Sun Jun 9 12:12:43 CEST 2002


Hi plugin developers,

sendmail will create a syslog entry when a session only issues a quit
command, looking roughly like this:
Jun  9 19:50:44 beaulieu.ixos.de sendmail[26790]: NOQUEUE: mucnm01.ixos.de
[149.
235.38.10] did not issue MAIL/EXPN/VRFY/ETRN during connection to MTA

This clobbers the syslog of every machine where SMTP is checked and can be
prevented by issuing a command. Thze following patch does just that. 
It is a diff against the netsaint-plugins-1.2.9-4 plugins/check_smtp.c file
(which I checked in locally as 1.1). 
Apologies if this change was already made in the latest release of the
plugins, I haven't checked.

Have fun,

Karl Ewald
Network Administrator, IT Services
IXOS Software AG http://www.ixos.com/

RCS file: check_smtp.c,v
retrieving revision 1.1
diff -u -r1.1 check_smtp.c
--- check_smtp.c        2002/06/09 17:21:38     1.1
+++ check_smtp.c        2002/06/09 17:31:48
@@ -43,6 +43,13 @@
 
 #define SMTP_PORT      25
 #define SMTP_EXPECT     "220"
+/* sendmail will syslog a "NOQUEUE" error if session does not attempt
+ * to do something useful. This can be prevented by giving a command
+ * even if syntax is illegal (MAIL requires a FROM:<...> argument)
+ * You can disable sending DUMMYCMD by undefining SMTP_USE_DUMMYCMD.
+ */
+#define SMTP_DUMMYCMD  "MAIL\n"
+#define SMTP_USE_DUMMYCMD 1
 #define SMTP_QUIT      "QUIT\n"
 
 int process_arguments(int, char **);
@@ -124,6 +131,11 @@
                }
 
                /* close the connection */
+#ifdef SMTP_USE_DUMMYCMD
+               send(sd,SMTP_DUMMYCMD,strlen(SMTP_DUMMYCMD),0);
+               /* allow for response to DUMMYCMD to reach us */
+               recv(sd,buffer,MAX_INPUT_BUFFER-1,0);
+#endif /* SMTP_USE_DUMMYCMD */
                send(sd,SMTP_QUIT,strlen(SMTP_QUIT),0);
                close(sd);
        }




More information about the Devel mailing list