#include "__SMTP_EHLO.h" #include "SMTPServer.h" namespace mail { int __SMTP_EHLO::processCommand(coreutils::ZString &request, SMTPSession &session, SMTPServer &server) { // RFC 5321 4.1.1.1 requires a domain/address-literal argument - // request[1] on a bare "EHLO" with none would have been an // out-of-bounds read on the split list (ZString::operator[] does // no bounds checking), not a graceful rejection. if (request.getList().size() < 2) { session.out << "501 Syntax error: EHLO requires a domain/address-literal argument" << CRLF; return 1; } session.clientDomainName = request[1]; session.out << "250-" << server.hostName << CRLF; // Both already true of this implementation, not just advertised // hopefully: multiple pipelined command lines arriving in one TCP // segment are already handled correctly (TCPSocket::onDataReceived // loops over every complete line it has buffered before returning, // not just the first), and message bodies are stored byte-for-byte // with no 7-bit stripping anywhere in this codebase. session.out << "250-PIPELINING" << CRLF; session.out << "250-8BITMIME" << CRLF; // Enforced by __SMTP_DATA.cpp while accumulating the body. session.out << "250-SIZE " << (long)SMTPServer::maxMessageSize << CRLF; session.out << "250-AUTH LOGIN" << CRLF; session.out << "250 HELP" << CRLF; session.state = READY; return 1; } }