summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/libltgrey.c72
-rw-r--r--tools/libltgrey.h1
-rw-r--r--tools/ltgrey.c4
3 files changed, 1 insertions, 76 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{
diff --git a/tools/libltgrey.h b/tools/libltgrey.h
index 6447297..1798a80 100644
--- a/tools/libltgrey.h
+++ b/tools/libltgrey.h
@@ -40,7 +40,6 @@ public:
std::map<box_state,std::string> decode_40;
whatsit(const std::string name, const std::string _parent_dir);
- int doit(const int penalty, const int stain);
// access comes after modification:
void update(const std::string msg, const timeval new_mod,
const timeval new_ac, const int penalty, const int stain);
diff --git a/tools/ltgrey.c b/tools/ltgrey.c
index ee6b4e5..75c8438 100644
--- a/tools/ltgrey.c
+++ b/tools/ltgrey.c
@@ -140,7 +140,5 @@ int main(int _argc, char** _argv){
return 0;
}
- int sts = foo.doit(shift, stain);
- return sts;
-
+ return 0;
}