From 6faf97fd62cc84e2405731534236fb2a93ba4407 Mon Sep 17 00:00:00 2001 From: John Denker Date: Thu, 22 Nov 2012 16:32:51 -0800 Subject: move some more stuff --- tools/ward.c | 79 +++--------------------------------------------------------- 1 file changed, 3 insertions(+), 76 deletions(-) (limited to 'tools/ward.c') diff --git a/tools/ward.c b/tools/ward.c index 56e626d..6280a28 100644 --- a/tools/ward.c +++ b/tools/ward.c @@ -37,9 +37,9 @@ void usage(const int sts){ exit(sts); } -#include "qq_exit_codes.h" -#include "utils.h" +#include "libskrewt.h" #include "sepofra.h" +#include "utils.h" void maybe_exeunt(const int sts, const int really){ if (!really) return; @@ -72,44 +72,6 @@ int mypid; /* Content-Type: multipart/mixed; boundary="1170861315-1262462055-1341954763=:92165" */ // -#include "libskrewt.h" - -class skrewt{ -public: - string received_from; // envelope HELO among other things - string proximta_HELO; - string proximta_rDNS; - string proximta_IP; - string proximta_AuthUser; - string return_path; // envelope MAIL FROM - string boundary; - string to; - string from; - string subject; - string date; - string message_id; - string content_type; - string delivered_to; - int msgsize; - vector bigbuf; - int saw_blank_line; - int recno; - - int maxsize; - int error_exit; - int mid_required; - - // constructor - skrewt() - : boundary("x-xx-x"), msgsize(0), saw_blank_line(0), recno(0), - maxsize(1000*1000), error_exit(0), mid_required(0) - {} - - int headers(); - int interstage(); - int body(); - int krunch_rfrom(); -}; #if 0 /* typical "Received: from" lines */ Received: from lists.sourceforge.net (216.34.181.88) @@ -135,41 +97,6 @@ Received: from ip68-231-191-153.tc.ph.cox.net (HELO asclepias.av8n.net) (smtp@68 /home/jsd/Maildir/cur/1342363199.24320.cloud:2, #endif -int skrewt::krunch_rfrom(){ - stringstream parse; - parse.str(received_from); - string word; - parse >> word; - if (word != "from") { - cerr << progid << " bad 'Received: from' line ... '" - << word << "'" << endl; - return ex_syserr; - } - parse >> proximta_rDNS; - parse >> word; - if (word == "(HELO") { - parse >> proximta_HELO; - proximta_HELO = rtrim(proximta_HELO, "()"); - parse >> word; - } else { - proximta_HELO = proximta_rDNS; - } - size_t len = word.length(); - if (len<2 || word[0] != '(' || word[len-1] != ')') { - cerr << progid << " bad 'Received: from' line ;;; '" - << word << "'" << endl; - return ex_syserr; - } - proximta_IP = word.substr(1, len-2); - size_t where = proximta_IP.find("@"); - if (where != string::npos){ - proximta_AuthUser = proximta_IP.substr(0, where); - proximta_IP = proximta_IP.substr(1+where); - } - - return 0; -} - int skrewt::headers(){ //xxxx cerr << progid << " begins" << endl; for (;;){ // outer loop over all records in the header @@ -392,7 +319,7 @@ int skrewt::interstage(){ } if (delivered_to.length()){ - cerr << progid << "Delivered-to: <<<" << delivered_to << ">>>" << endl; + cerr << progid << " Delivered-to: <<<" << delivered_to << ">>>" << endl; } if (toLower(trim(delivered_to)) == "jean@av8n.com") { badnews.push_back("Looping Delivered-to: " + delivered_to); -- cgit v1.2.3