summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2006-11-14 03:26:14 +0000
committerStef Walter <stef@memberwebs.com>2006-11-14 03:26:14 +0000
commit85291cea9b7c412005cc03714d49e008170715a4 (patch)
treee41f7c311461002f5a92ce9dd0ebfc5f077f197e
parentc407d3106d685eceb526f758b740c1a644c453f8 (diff)
Add header option back into proxsmtp
-rw-r--r--ChangeLog1
-rw-r--r--src/proxsmtpd.c16
2 files changed, 14 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 22e69bd..9ca5d19 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
- On FreeBSD fix problem where stderr wasn't processed when filter
didn't read stdin.
- Add strcasestr which is missing on Solaris.
+ - Add back 'Header' option which was accidentally removed in 1.5. Blush!
1.5 [2006-09-05]
- Added support for setting the REMOTE variable when an XFORWARD
diff --git a/src/proxsmtpd.c b/src/proxsmtpd.c
index 2a75592..a74b9e9 100644
--- a/src/proxsmtpd.c
+++ b/src/proxsmtpd.c
@@ -65,6 +65,7 @@ typedef struct pxstate
struct timeval timeout; /* The command timeout */
int pipe_cmd; /* Whether command is a pipe or not */
const char* directory; /* The directory for temp files */
+ const char* header; /* Header to include in output */
}
pxstate_t;
@@ -82,6 +83,7 @@ pxstate_t;
#define CFG_DIRECTORY "TempDirectory"
#define CFG_DEBUGFILES "DebugFiles"
#define CFG_CMDTIMEOUT "FilterTimeout"
+#define CFG_HEADER "Header"
#define TYPE_PIPE "pipe"
#define TYPE_FILE "file"
@@ -221,7 +223,7 @@ int cb_check_data(spctx_t* ctx)
sp_messagex(ctx, LOG_WARNING, "no filter command specified. passing message through");
if(sp_cache_data(ctx) == -1 ||
- sp_done_data(ctx, NULL) == -1)
+ sp_done_data(ctx, g_pxstate.header) == -1)
return -1; /* Message already printed */
return 0;
@@ -280,6 +282,14 @@ int cb_parse_option(const char* name, const char* value)
return 1;
}
+ else if(strcasecmp(CFG_HEADER, name) == 0)
+ {
+ g_pxstate.header = trim_start(value);
+ if(strlen(g_pxstate.header) == 0)
+ g_pxstate.header = NULL;
+ return 1;
+ }
+
return 0;
}
@@ -520,7 +530,7 @@ static int process_file_command(spctx_t* sp)
/* A successful response */
if(WEXITSTATUS(status) == 0)
{
- if(sp_done_data(sp, NULL) == -1)
+ if(sp_done_data(sp, g_pxstate.header) == -1)
RETURN(-1); /* message already printed */
sp_add_log(sp, "status=", "FILTERED");
@@ -763,7 +773,7 @@ static int process_pipe_command(spctx_t* sp)
/* A successful response */
if(WEXITSTATUS(status) == 0)
{
- if(sp_done_data(sp, NULL) == -1)
+ if(sp_done_data(sp, g_pxstate.header) == -1)
RETURN(-1); /* message already printed */
sp_add_log(sp, "status=", "FILTERED");