summaryrefslogtreecommitdiff
path: root/tools/libltgrey.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/libltgrey.c')
-rw-r--r--tools/libltgrey.c72
1 files changed, 0 insertions, 72 deletions
diff --git a/tools/libltgrey.c b/tools/libltgrey.c
index 9b02642..8ae374c 100644
--- a/tools/libltgrey.c
+++ b/tools/libltgrey.c
@@ -159,78 +159,6 @@ int whatsit::maybe_mkdir(const string subdir, const string msg){
return 0;
}
-#if 1
-int whatsit::doit(const int penalty, const int stain){
- return ex_syserr;
-}
-
-#else
-int whatsit::doit(const int penalty, const int stain){
- if (!ipvar) {
- cerr << progid
- << " TCPREMOTEIP not set???" << endl;
- // should never happen
- // although you can make it happen using a weird test-harness
- return(ex_syserr);
- }
-
-? maybe_mkdir(parent_dir, "parent dir");
-? maybe_mkdir(parent_dir + "/quarante", "quarantine dir");
-? maybe_mkdir(parent_dir + "/repute", "reputation dir");
-
- ipname = dirname + "/" + ipbase;
- struct stat ipstat;
- rslt = stat(ipname.c_str(), &ipstat);
- if (rslt != 0){
- if (errno != ENOENT) {
- cerr << progid << ": stat failed for '"
- << ipname << "' : ";
- perror(0);
- }
-//???!! ofstream foo;
- int fd = creat(ipname.c_str(), 0644);
- if (fd < 0){
- cerr << progid << ": create failed for '"
- << ipname << "' : ";
- perror(0);
- }
- close(fd);
- update("new customer", now, now, penalty, stain);
- return(ex_greylisting);
- }
-
-// now for really checking the greylist status:
- mod_age = now.tv_sec - ipstat.st_mtime;
- ac_age = now.tv_sec - ipstat.st_atime;
- timeval mod_orig = {ipstat.st_mtime, 0};
- if (mod_age < 0) {
- update("penalty box", mod_orig, now, penalty, stain);
- return(ex_penaltybox);
- }
- if (mod_age < ac_age){
-// when he comes out on parole, he starts over with no reputation:
- update("paroled spammer", now, now, penalty, stain);
- return(ex_greylisting);
- }
- if (mod_age < minimum_age) {
- update("early bird", mod_orig, now, penalty, stain);
- return(ex_greylisting);
- }
- if (mod_age - ac_age < minimum_age // early bird, or completely unused
- && mod_age > probation) { // did not diligently resubmit
- update("disprobation", now, now, penalty, stain);
- return(ex_greylisting);
- }
- if (ac_age > maximum_age) {
- update("too old, starting over", now, now, penalty, stain);
- return(ex_greylisting);
- }
-// if all checks are passed, must be OK:
- update("returning customer", mod_orig, now, penalty, stain);
- return 0;
-}
-#endif
-
typedef vector<unsigned char> VU;
class VUx{