summaryrefslogtreecommitdiff
path: root/tools/hi-q.c
diff options
context:
space:
mode:
authorJohn Denker <jsd@av8n.com>2012-07-13 18:21:21 -0700
committerJohn Denker <jsd@av8n.com>2012-07-14 08:53:37 -0700
commit4779e1644fc9dff4eb3e1745a1b3f3119f9bf544 (patch)
treefa3bdd0d42a1f821348e0514f2d928a2aaf2377f /tools/hi-q.c
parentbc151ae914c24f8d5461b68015c12c0abe629da2 (diff)
Now apply spam filtering to all unauthenticated submissions,
including submissions that are ssl encrypted (but not authenticated)
Diffstat (limited to 'tools/hi-q.c')
-rw-r--r--tools/hi-q.c28
1 files changed, 16 insertions, 12 deletions
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<string> VS;
vector<VS> 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<pid_t> 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];