summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
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 */
}