summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c62d376)
raw | patch | inline | side by side (parent: c62d376)
author | Subhendu Ghosh <sghosh@users.sourceforge.net> | |
Wed, 14 Aug 2002 19:04:56 +0000 (19:04 +0000) | ||
committer | Subhendu Ghosh <sghosh@users.sourceforge.net> | |
Wed, 14 Aug 2002 19:04:56 +0000 (19:04 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@77 f882894a-f735-0410-b71e-b25c423dba1c
plugins/check_smtp.c | patch | blob | history |
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c
index 2000c6207324e8b7800107ee457287931830288e..2d2e28914875848d8f1ebd18f697dbd69d7d86f5 100644 (file)
--- a/plugins/check_smtp.c
+++ b/plugins/check_smtp.c
#define SMTP_PORT 25
#define SMTP_EXPECT "220"
+#define SMTP_HELO "HELO "
+
/* 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)
int sd;
int result;
char buffer[MAX_INPUT_BUFFER] = "";
+ char helocmd[255] = SMTP_HELO ;
+ char myhostname[248];
+
if (process_arguments (argc, argv) != OK)
usage ("Invalid command arguments supplied\n");
+ /* initalize the HELO command with the localhostname */
+ gethostname(myhostname, sizeof(myhostname));
+ strcat(helocmd, myhostname);
+ strcat(helocmd, "\r\n");
+
/* initialize alarm signal handling */
signal (SIGALRM, socket_timeout_alarm_handler);
}
/* close the connection */
+ /* first send the HELO command */
+ send(sd,helocmd,strlen(helocmd),0);
+ /* allow for response to helo command to reach us */
+ recv(sd,buffer,MAX_INPUT_BUFFER-1,0);
+
#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 */
+ /* finally close the connection */
send (sd, SMTP_QUIT, strlen (SMTP_QUIT), 0);
close (sd);
}