Просмотр исходного кода

patch to stop NOQUEUE syslog messages - Karl Ewald

git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@49 f882894a-f735-0410-b71e-b25c423dba1c
Subhendu Ghosh 24 лет назад
Родитель
Сommit
2d61d4b43e
1 измененных файлов с 13 добавлено и 0 удалено
  1. 13 0
      plugins/check_smtp.c

+ 13 - 0
plugins/check_smtp.c

@@ -43,6 +43,13 @@
 
 
 #define SMTP_PORT	25
 #define SMTP_PORT	25
 #define SMTP_EXPECT     "220"
 #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"
 #define SMTP_QUIT	"QUIT\n"
 
 
 int process_arguments (int, char **);
 int process_arguments (int, char **);
@@ -131,6 +138,12 @@ main (int argc, char **argv)
 		}
 		}
 
 
 		/* close the connection */
 		/* 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);
 		send (sd, SMTP_QUIT, strlen (SMTP_QUIT), 0);
 		close (sd);
 		close (sd);
 	}
 	}