summaryrefslogtreecommitdiff
path: root/src/clstate.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/clstate.c')
-rw-r--r--src/clstate.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/clstate.c b/src/clstate.c
index 0a166f9..2c74e11 100644
--- a/src/clstate.c
+++ b/src/clstate.c
@@ -86,6 +86,7 @@
#define CFG_BOUNCE "Bounce"
#define CFG_QUARANTINE "Quarantine"
#define CFG_DEBUGFILES "DebugFiles"
+#define CFG_TRANSPARENT "TransparentProxy"
/* The set of delimiters that can be present between config and value */
#define CFG_DELIMS ": \t"
@@ -230,7 +231,6 @@ int clstate_parse_config(clstate_t* state, const char* configfile)
else if(PARSE(CFG_DIRECTORY))
state->directory = VAL;
-
else if(PARSE(CFG_BOUNCE))
state->bounce = strtob(VAL);
@@ -240,6 +240,9 @@ int clstate_parse_config(clstate_t* state, const char* configfile)
else if(PARSE(CFG_DEBUGFILES))
state->debug_files = strtob(VAL);
+ else if(PARSE(CFG_TRANSPARENT))
+ state->transparent = strtob(VAL);
+
/* Unrecognized option */
else
errx(2, "invalid config line: %s", p);
@@ -264,10 +267,6 @@ void clstate_validate(clstate_t* state)
if(state->timeout.tv_sec <= 0)
errx(2, "invalid setting: " CFG_TIMEOUT);
- /* This option has no default, but is required */
- if(state->outname == NULL)
- errx(2, "no " CFG_OUTADDR " specified.");
-
if(state->bounce == -1)
errx(2, "invalid value for " CFG_BOUNCE);
if(state->quarantine == -1)
@@ -275,11 +274,22 @@ void clstate_validate(clstate_t* state)
if(state->debug_files == -1)
errx(2, "invalid value for " CFG_DEBUGFILES);
+ /* This option has no default, but is required */
+ if(state->outname == NULL && !state->transparent)
+ errx(2, "no " CFG_OUTADDR " specified.");
+
/* Parse all the addresses */
+ if(state->outname != NULL)
+ {
+ if(state->transparent)
+ warnx("the " CFG_OUTADDR " option will be ignored when " CFG_TRANSPARENT " is enabled");
+ else
+ if(sock_any_pton(state->outname, &(state->outaddr), SANY_OPT_DEFPORT(25)) == -1)
+ errx(2, "invalid " CFG_OUTADDR " socket name or ip: %s", state->outname);
+ }
+
if(sock_any_pton(state->listenname, &(state->listenaddr), SANY_OPT_DEFANY | SANY_OPT_DEFPORT(DEFAULT_PORT)) == -1)
errx(2, "invalid " CFG_LISTENADDR " socket name or ip: %s", state->listenname);
- if(sock_any_pton(state->outname, &(state->outaddr), SANY_OPT_DEFPORT(25)) == -1)
- errx(2, "invalid " CFG_OUTADDR " socket name or ip: %s", state->outname);
if(sock_any_pton(state->clamname, &(state->clamaddr), SANY_OPT_DEFLOCAL) == -1)
errx(2, "invalid " CFG_CLAMADDR " socket name: %s", state->clamname);