#include "__SMTP_HELO.h" #include "SMTPServer.h" #include "SMTPSyntax.h" namespace mail { int __SMTP_HELO::processCommand(coreutils::ZString &request, SMTPSession &session, SMTPServer &server) { // RFC 5321 4.1.1.1: HELO requires a domain argument. request[1] on // a bare "HELO" was an out-of-bounds read. std::string arg = SMTPSyntax::argument(line(request)); if (arg.empty()) { session.out << "501 Syntax: HELO hostname" << CRLF; return 1; } session.greeted = true; session.esmtp = false; session.resetTransaction(); session.clientDomainName = arg.substr(0, arg.find(' ')).c_str(); session.out << "250 " << server.hostName << CRLF; return 1; } }