summaryrefslogtreecommitdiff
path: root/tools/libskrewt.c
diff options
context:
space:
mode:
authorJohn Denker <jsd@av8n.com>2012-11-22 16:32:51 -0800
committerJohn Denker <jsd@av8n.com>2012-11-22 16:32:51 -0800
commit6faf97fd62cc84e2405731534236fb2a93ba4407 (patch)
tree17c201b43b40579fbf3efac0497035e29db238f5 /tools/libskrewt.c
parentccb16252f0f9f55198ca2662ab8daf7199b817de (diff)
move some more stuff
Diffstat (limited to 'tools/libskrewt.c')
-rw-r--r--tools/libskrewt.c39
1 files changed, 38 insertions, 1 deletions
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 <iostream>
#include "libskrewt.h"
+#include "utils.h"
+#include <iostream>
+#include <sstream>
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;
+}