summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Denker <jsd@av8n.com>2012-08-03 22:04:43 -0700
committerJohn Denker <jsd@av8n.com>2012-12-02 11:55:48 -0700
commit6c0926be32e890baba2cac29c5398e82a49c7ab1 (patch)
treee93b43f646cc645653a9334f9b0a2f59754b8174
parentc5a1da0c735c428a53596b31b32aae82a257c3bf (diff)
a more logical way of keeping track of what hosts have been seen
-rw-r--r--tools/sepofra.c9
-rw-r--r--tools/sepofra.h4
2 files changed, 7 insertions, 6 deletions
diff --git a/tools/sepofra.c b/tools/sepofra.c
index 0a731b9..7ee9c8a 100644
--- a/tools/sepofra.c
+++ b/tools/sepofra.c
@@ -2,7 +2,7 @@
#include <sstream>
#include "sepofra.h"
-#include "utils.h"
+#include "utils.h" /* for trim() */
#ifndef HOST_NAME_MAX
#define HOST_NAME_MAX 255
@@ -47,9 +47,9 @@ SPF_result_t sepofra::check1(const string _host,
if (!host.length()) return SPF_RESULT_INVALID;
if (seen.find(host) != seen.end()) {
// already checked this one
- return SPF_RESULT_SOFTFAIL;
+ return seen[host];
}
- seen[host] = 1;
+ seen[host] = SPF_RESULT_TEMPERROR;
authorities.push_back(host);
if (SPF_request_set_env_from( spf_request,
@@ -60,7 +60,8 @@ SPF_result_t sepofra::check1(const string _host,
if (spf_response) SPF_response_free(spf_response);
SPF_request_query_mailfrom(spf_request, &spf_response);
if (debug) dumpit(debug, spf_response, "");
- return SPF_response_result(spf_response);
+
+ return seen[host] = SPF_response_result(spf_response);
}
diff --git a/tools/sepofra.h b/tools/sepofra.h
index 60a404f..17aa51a 100644
--- a/tools/sepofra.h
+++ b/tools/sepofra.h
@@ -16,13 +16,13 @@ extern "C" {
#include <string.h>
#include "bad_thing.h"
-typedef std::map<std::string,int> MSI;
+typedef std::map<std::string,SPF_result_t> MSR;
class sepofra{
public:
SPF_result_t result;
std::list<std::string> authorities;
- MSI seen;
+ MSR seen;
std::string ip;
std::string mailfrom;
std::string helo;