summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2008-05-27 12:50:55 +0000
committerStef Walter <stef@memberwebs.com>2008-05-27 12:50:55 +0000
commit9d90c0e2874753692b1af9302ec5afbe3c94aa20 (patch)
tree2e2f2a5752118b553dcaebdb6aa1b52b64c93d84 /common
parentf81457cf835cc6a1c79f104ea80bf6e50bf7e2ac (diff)
- Make the XFOWARD HELO available as a environment variable in scripts. [Glenn Matthys]
Diffstat (limited to 'common')
-rw-r--r--common/smtppass.c17
-rw-r--r--common/smtppass.h1
2 files changed, 18 insertions, 0 deletions
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 */
}