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/libskrewt.c | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'tools/libskrewt.c') diff --git a/tools/libskrewt.c b/tools/libskrewt.c index a756863..602fdb7 100644 --- a/tools/libskrewt.c +++ b/tools/libskrewt.c @@ -1,5 +1,7 @@ -#include #include "libskrewt.h" +#include "utils.h" +#include +#include using namespace std; @@ -47,3 +49,38 @@ void parse_content(const string type_spec_line, //xxxxxxx cerr << "boundary= not found in " << type_spec_line << endl; } } + +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; +} -- cgit v1.2.3