|
@@ -52,6 +52,7 @@ int days_till_exp_warn, days_till_exp_crit;
|
|
|
enum {
|
|
enum {
|
|
|
SMTP_PORT = 25
|
|
SMTP_PORT = 25
|
|
|
};
|
|
};
|
|
|
|
|
+#define PROXY_PREFIX "PROXY TCP4 0.0.0.0 0.0.0.0 25 25\r\n"
|
|
|
#define SMTP_EXPECT "220"
|
|
#define SMTP_EXPECT "220"
|
|
|
#define SMTP_HELO "HELO "
|
|
#define SMTP_HELO "HELO "
|
|
|
#define SMTP_EHLO "EHLO "
|
|
#define SMTP_EHLO "EHLO "
|
|
@@ -106,6 +107,7 @@ double critical_time = 0;
|
|
|
int check_critical_time = FALSE;
|
|
int check_critical_time = FALSE;
|
|
|
int verbose = 0;
|
|
int verbose = 0;
|
|
|
int use_ssl = FALSE;
|
|
int use_ssl = FALSE;
|
|
|
|
|
+short use_proxy_prefix = FALSE;
|
|
|
short use_ehlo = FALSE;
|
|
short use_ehlo = FALSE;
|
|
|
short use_lhlo = FALSE;
|
|
short use_lhlo = FALSE;
|
|
|
short ssl_established = 0;
|
|
short ssl_established = 0;
|
|
@@ -197,6 +199,13 @@ main (int argc, char **argv)
|
|
|
|
|
|
|
|
if (result == STATE_OK) { /* we connected */
|
|
if (result == STATE_OK) { /* we connected */
|
|
|
|
|
|
|
|
|
|
+ /* If requested, send PROXY header */
|
|
|
|
|
+ if (use_proxy_prefix) {
|
|
|
|
|
+ if (verbose)
|
|
|
|
|
+ printf ("Sending header %s\n", PROXY_PREFIX);
|
|
|
|
|
+ send(sd, PROXY_PREFIX, strlen(PROXY_PREFIX), 0);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/* watch for the SMTP connection string and */
|
|
/* watch for the SMTP connection string and */
|
|
|
/* return a WARNING status if we couldn't read any data */
|
|
/* return a WARNING status if we couldn't read any data */
|
|
|
if (recvlines(buffer, MAX_INPUT_BUFFER) <= 0) {
|
|
if (recvlines(buffer, MAX_INPUT_BUFFER) <= 0) {
|
|
@@ -484,6 +493,7 @@ process_arguments (int argc, char **argv)
|
|
|
{"starttls",no_argument,0,'S'},
|
|
{"starttls",no_argument,0,'S'},
|
|
|
{"certificate",required_argument,0,'D'},
|
|
{"certificate",required_argument,0,'D'},
|
|
|
{"ignore-quit-failure",no_argument,0,'q'},
|
|
{"ignore-quit-failure",no_argument,0,'q'},
|
|
|
|
|
+ {"proxy",no_argument,0,'r'},
|
|
|
{0, 0, 0, 0}
|
|
{0, 0, 0, 0}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -500,7 +510,7 @@ process_arguments (int argc, char **argv)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
while (1) {
|
|
while (1) {
|
|
|
- c = getopt_long (argc, argv, "+hVv46Lt:p:f:e:c:w:H:C:R:SD:F:A:U:P:q",
|
|
|
|
|
|
|
+ c = getopt_long (argc, argv, "+hVv46Lrt:p:f:e:c:w:H:C:R:SD:F:A:U:P:q",
|
|
|
longopts, &option);
|
|
longopts, &option);
|
|
|
|
|
|
|
|
if (c == -1 || c == EOF)
|
|
if (c == -1 || c == EOF)
|
|
@@ -622,6 +632,9 @@ process_arguments (int argc, char **argv)
|
|
|
use_ssl = TRUE;
|
|
use_ssl = TRUE;
|
|
|
use_ehlo = TRUE;
|
|
use_ehlo = TRUE;
|
|
|
break;
|
|
break;
|
|
|
|
|
+ case 'r':
|
|
|
|
|
+ use_proxy_prefix = TRUE;
|
|
|
|
|
+ break;
|
|
|
case 'L':
|
|
case 'L':
|
|
|
use_lhlo = TRUE;
|
|
use_lhlo = TRUE;
|
|
|
break;
|
|
break;
|
|
@@ -820,6 +833,8 @@ print_help (void)
|
|
|
printf (" %s\n", _("FROM-address to include in MAIL command, required by Exchange 2000")),
|
|
printf (" %s\n", _("FROM-address to include in MAIL command, required by Exchange 2000")),
|
|
|
printf (" %s\n", "-F, --fqdn=STRING");
|
|
printf (" %s\n", "-F, --fqdn=STRING");
|
|
|
printf (" %s\n", _("FQDN used for HELO"));
|
|
printf (" %s\n", _("FQDN used for HELO"));
|
|
|
|
|
+ printf (" %s\n", "-r, --proxy");
|
|
|
|
|
+ printf (" %s\n", _("Use PROXY protocol prefix for the connection."));
|
|
|
#ifdef HAVE_SSL
|
|
#ifdef HAVE_SSL
|
|
|
printf (" %s\n", "-D, --certificate=INTEGER[,INTEGER]");
|
|
printf (" %s\n", "-D, --certificate=INTEGER[,INTEGER]");
|
|
|
printf (" %s\n", _("Minimum number of days a certificate has to be valid."));
|
|
printf (" %s\n", _("Minimum number of days a certificate has to be valid."));
|