From a80d71e7dc3b46980b9f91c9238599fee26cc1b2 Mon Sep 17 00:00:00 2001 From: John Denker Date: Sat, 24 Nov 2012 11:53:34 -0800 Subject: working toward identifying the "owning domain" --- tools/libskrewt.c | 86 ++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 60 insertions(+), 26 deletions(-) (limited to 'tools/libskrewt.c') diff --git a/tools/libskrewt.c b/tools/libskrewt.c index b41d7d0..3c820f1 100644 --- a/tools/libskrewt.c +++ b/tools/libskrewt.c @@ -64,7 +64,7 @@ int skrewt::krunch_rfrom(){ << word << "'" << endl; return ex_syserr; } - parse >> proximta_rDNS; + parse >> proximta_rDNS.name; for (;;) { // loop over words in this record parse >> word; size_t len = word.length(); @@ -75,8 +75,8 @@ int skrewt::krunch_rfrom(){ } if (word == "by") break; if (word == "(HELO" /*)*/) { - parse >> proximta_HELO; - proximta_HELO = rtrim(proximta_HELO, "()"); + parse >> proximta_HELO.name; + proximta_HELO.name = rtrim(proximta_HELO.name, "()"); continue; } if (word[0] != '(' || word[len-1] != ')') { @@ -92,8 +92,8 @@ int skrewt::krunch_rfrom(){ } } // provide some kind of default? maybe not. - if (0) if (proximta_HELO == "") { - proximta_HELO = proximta_rDNS + " (+-)"; + if (0) if (proximta_HELO.name == "") { + proximta_HELO.name = proximta_rDNS.name + " (+-)"; } return 0; @@ -178,7 +178,7 @@ int skrewt::headers(istream& xin){ } else if (headword == "to") { to = rest; } else if (headword == "return-path") { - return_path = rest; + return_path.name = rest; } else if (headword == "message-id") { message_id = rest; } @@ -214,6 +214,30 @@ int skrewt::dump_bigbuf(std::ostream& xout){ return 0; } +void check_name(name_tester& fqdn, const string ip) { + if (ip == "") { + cerr << "SPF: should never happen: email with no IP?" < sitch){ cerr << endl; } +// constructor + +skrewt::skrewt() + : spf_result(SPF_RESULT_INVALID), + boundary("x-xx-x"), msgsize(0), saw_blank_line(0), recno(0), + maxsize(1000*1000), error_exit(0), mid_required(0), + headerbuf(0), bigbuf(0), + lookahead(1, "") +{ +// expand the macro in a way that will initialize the decoder table: +# define foo(name) decode_test_state[name] = #name; + test_state_macro +# undef foo +} + int skrewt::body(std::istream& xin, std::ostream& xout){ list sitch; if (content_type.length()) { -- cgit v1.2.3