From 4779e1644fc9dff4eb3e1745a1b3f3119f9bf544 Mon Sep 17 00:00:00 2001 From: John Denker Date: Fri, 13 Jul 2012 18:21:21 -0700 Subject: Now apply spam filtering to all unauthenticated submissions, including submissions that are ssl encrypted (but not authenticated) --- tools/hi-q.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'tools/hi-q.c') diff --git a/tools/hi-q.c b/tools/hi-q.c index bf9c599..32b0a7b 100644 --- a/tools/hi-q.c +++ b/tools/hi-q.c @@ -114,7 +114,7 @@ void usage() { // we have data coming in on fd 0. // and envelope / control information coming in on fd 1. -void dump___not_used(const string var){ +void dump(const string var){ char* str = getenv(var.c_str()); if (str) cerr << "hi-q: " << var << " is set to '" << str << "'" << endl; @@ -151,11 +151,8 @@ int main(int argc, char** argv, char const * const * env) { typedef vector VS; vector filter; string conf_var = "HI_Q_CONF"; - - int mode(0); - char* modevar = getenv("HI_Q_MODE"); - if (modevar) mode = 1000 + atoi(modevar); - cerr << "hi-q mode: " << mode << endl; + char* auth = getenv("QMAIL_AUTHORIZED"); + if (auth && *auth) conf_var = "HI_Q_AUCONF"; char* conf_name; if (argc == 1) { @@ -165,9 +162,16 @@ int main(int argc, char** argv, char const * const * env) { exit(1); } } - else if (argc == 2) { + + if (argc >= 2) { conf_name = argv[1]; - } else { + } + + if (argc >= 3) { + if (auth && *auth) conf_name = argv[2]; + } + + if (argc > 3) { usage(); exit(1); } @@ -207,12 +211,12 @@ int main(int argc, char** argv, char const * const * env) { vector kidpid(nkids); // indexed by kid number // At this point, there are some loop invariants; -// (a) fd0 is open and has the email msg, +// (a) fd0 is open (standard input) and has the email msg, // ready for the next child to read, and -// (b) fd1 is open and has envelope information. +// (b) fd1 is open (nonstandard input) and has envelope information. // We need it to be open, so that pipe() -// doesn't choose it. That allows us to close -// it and dup() something onto it. +// doesn't choose it. That allows N-1 of the kids +// to close it and dup() something useful onto it. for (int ii=0; ii < nkids; ii++){ /* loop over all kids */ int datapipe[2]; -- cgit v1.2.3