#include #include #include #include "sepofra.h" #include "qq_exit_codes.h" // a bit of a kludge extern std::string progid; class xstr { public: int err; std::string str; xstr() : err(1), str("") {} xstr(const int foo, const std::string bar) : err(foo), str(bar) {} }; class skrewt{ public: std::string received_from; // envelope HELO among other things std::string proximta_HELO; std::string proximta_rDNS; std::string proximta_IP; std::string proximta_AuthUser; SPF_result_t spf_result; std::string return_path; // envelope MAIL FROM std::string boundary; std::string to; std::string from; std::string subject; std::string date; std::string message_id; std::string content_type; std::list delivered_to; int msgsize; int saw_blank_line; int recno; int maxsize; int error_exit; int mid_required; std::vector headerbuf; std::vector bigbuf; xstr lookahead; // constructor 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, "") {} xstr getRecord(std::istream& xin); xstr getLine(std::istream& xin); int headers(std::istream& xin); int dump_bigbuf(std::ostream& xout); int interstage(); int body(std::istream& xin, std::ostream& xout); int krunch_rfrom(); }; void parse_content(const std::string type_spec_line, std::string &maintype, std::string &boundary); void exeunt(const int sts); void maybe_exeunt(const int sts, const int really);