/* * * EnderUnix Software Development Team @ Turkey * (c) 2002 Istanbul, Turkiye * * See COPYING for copyright and copying restrictions * */ #include #include #include #include #include #include #include #include #include #include "wildmat.h" #include "parser.h" #include "loadconfig.h" #include "functions.h" extern char logtype[VALSIZE]; extern char logfile[VALSIZE]; extern char ignorefile[VALSIZE]; extern char badmailfile[VALSIZE]; int w = 0; int b = 0; int p = 0; int main(int argc, char **argv) { int c, f = 0, error = 0; extern char *optarg; extern int optind; char spamguardconf[VALSIZE]; while (!error && (c = getopt(argc,argv,"f:hv")) != -1) { switch (c) { case 'v': printf("EnderUNIX spamGuard Version %s\n", VERSION); exit(0); break; case 'h': printf("Usage: %s [-f spamguard.conf]\n", argv[0]); exit(0); break; case 'f': strncpy(spamguardconf, optarg, VALSIZE); f = 1; break; default: error = 1; puts("Usage: spamGuard [-f spamguard.conf]"); exit(-1); break; } } if (f == 0) readconfig("/usr/local/etc/spamguard.conf"); else readconfig(spamguardconf); iaddrlist = NULL; /* First we open log file and fill our "from" list */ if (strcmp(logtype, "qmail") == 0) { readLogFile(logfile); /* ignore list is our list of priviliged mail users * firstly we read our ignore file */ loadIgnoreList(ignorefile); /* ... and from qmail's badmailfrom, since we do not want * to have duplicate spammer addresses */ loadIgnoreList(badmailfile); printf("Spammers:\n"); if (qmail_finalize() > 0) printf("Spammer is detected \n"); else printf("No spammer found yet\n"); } else if ((strcmp(logtype, "sendmail") == 0) || (strcmp(logtype, "postfix") == 0)) { /* postfix and sendmail format is same so we are using both of them in one place */ readLogFile(logfile); loadIgnoreList(ignorefile); loadIgnore_sendmail(badmailfile); printf("Spammers:\n"); if (sendmail_finalize() > 0) printf("Spammer is detected \n"); else printf("No spammer found yet\n"); } /* make compilers happy :) */ return 0; }