From 9d90c0e2874753692b1af9302ec5afbe3c94aa20 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Tue, 27 May 2008 12:50:55 +0000 Subject: - Make the XFOWARD HELO available as a environment variable in scripts. [Glenn Matthys] --- ChangeLog | 1 + common/smtppass.c | 17 +++++++++++++++++ common/smtppass.h | 1 + configure.in | 4 ++-- doc/proxsmtpd.8 | 8 ++++++++ 5 files changed, 29 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index aeee25a..43bc604 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,5 @@ 1.8 + - Make the XFOWARD HELO available as a environment variable in scripts. [Glenn Matthys] - Send an RSET to the server after filter fails an email. - Fix an uninitialized pid variable. diff --git a/common/smtppass.c b/common/smtppass.c index 5532927..afdff03 100644 --- a/common/smtppass.c +++ b/common/smtppass.c @@ -657,6 +657,12 @@ static void cleanup_context(spctx_t* ctx) ctx->xforwardaddr = NULL; } + if(ctx->xforwardhelo) + { + free(ctx->xforwardhelo); + ctx->xforwardhelo = NULL; + } + ctx->logline[0] = 0; } @@ -1132,6 +1138,14 @@ static int smtp_passthru(spctx_t* ctx) if(ctx->xforwardaddr) strcpy(ctx->xforwardaddr, t); } + + if((t = parse_xforward (C_LINE + KL(XFORWARD_CMD), "HELO"))) + { + ctx->xforwardhelo = (char*)reallocf(ctx->xforwardhelo, strlen(t) + 1); + if(ctx->xforwardhelo) + strcpy(ctx->xforwardhelo, t); + } + } /* RSET */ @@ -1778,6 +1792,9 @@ void sp_setup_forked(spctx_t* ctx, int file) if(ctx->xforwardaddr) setenv("REMOTE", ctx->xforwardaddr, 1); + if(ctx->xforwardhelo) + setenv("REMOTE_HELO", ctx->xforwardhelo, 1); + if(spio_valid(&(ctx->server))) setenv("SERVER", ctx->server.peername, 1); diff --git a/common/smtppass.h b/common/smtppass.h index 27fc9d9..c0f23d9 100644 --- a/common/smtppass.h +++ b/common/smtppass.h @@ -132,6 +132,7 @@ typedef struct spctx char* sender; /* The email of the sender */ char* recipients; /* The email of the recipients */ char* xforwardaddr; /* The IP address proxied for */ + char* xforwardhelo; /* The HELO/EHLO proxied for */ int _crlf; /* Private data */ } diff --git a/configure.in b/configure.in index 64a4d3a..84b3a63 100644 --- a/configure.in +++ b/configure.in @@ -32,8 +32,8 @@ dnl DAMAGE. dnl Process this file with autoconf to produce a configure script. -AC_INIT(proxsmtp, 1.7.90, stef@memberwebs.com) -AM_INIT_AUTOMAKE(proxsmtp, 1.7.90) +AC_INIT(proxsmtp, 1.7.91, stef@memberwebs.com) +AM_INIT_AUTOMAKE(proxsmtp, 1.7.91) LDFLAGS="$LDFLAGS -L/usr/local/lib" CFLAGS="$CFLAGS -I/usr/local/include" diff --git a/doc/proxsmtpd.8 b/doc/proxsmtpd.8 index f43ab1f..e77991f 100644 --- a/doc/proxsmtpd.8 +++ b/doc/proxsmtpd.8 @@ -138,6 +138,14 @@ IP address of the original client. In order for this information to be present (a) the SMTP client (sending server) must an send an XFORWARD command and (b) the SMTP server (receiving server) must accept that XFORWARD command without error. +.It Ar REMOTE_HELO +If +.Nm +is being used to filter email between SMTP servers, then this is the +HELO/EHLO banner of the original client. In order for this information to be present +(a) the SMTP client (sending server) must an send an XFORWARD command and (b) +the SMTP server (receiving server) must accept that XFORWARD command without +error. .It Ar SENDER The email address for the sender of the email. .It Ar SERVER -- cgit v1.2.3