Classes | |
| class | Channel | 
| class | Client | 
| FTP client functionality shared among FTP Gateway and Relay clients.  More... | |
| class | CtrlChannel | 
| class | DataChannel | 
| class | ErrorDetail | 
| class | Gateway | 
| struct | GatewayFlags | 
| class | MasterState | 
| Transaction information shared among our FTP client and server jobs.  More... | |
| class | Relay | 
| class | Server | 
| Manages a control connection from an FTP client.  More... | |
Typedefs | |
| typedef void() | StateMethod(Ftp::Gateway *) | 
Enumerations | |
| enum | ServerState {  fssBegin, fssConnected, fssHandleFeat, fssHandlePasv, fssHandlePort, fssHandleDataRequest, fssHandleUploadRequest, fssHandleEprt, fssHandleEpsv, fssHandleCwd, fssHandlePass, fssHandleCdup, fssError }  | 
Functions | |
| void | StartGateway (FwdState *const fwdState) | 
| A new FTP Gateway job.  More... | |
| void | StartRelay (FwdState *const fwdState) | 
| A new FTP Relay job.  More... | |
| const SBuf & | UrlWith2f (HttpRequest *) | 
| static char * | escapeIAC (const char *buf) | 
| AnyP::ProtocolVersion | ProtocolVersion () | 
| Protocol version to use in Http::Message structures wrapping FTP messages.  More... | |
| HttpReply * | HttpReplyWrapper (const int ftpStatus, const char *ftpReason, const Http::StatusCode httpStatus, const int64_t clen) | 
| Create an internal HttpReply structure to house FTP control response info.  More... | |
| const SBuf & | cmdAppe () | 
| const SBuf & | cmdAuth () | 
| const SBuf & | cmdCwd () | 
| const SBuf & | cmdDele () | 
| const SBuf & | cmdEprt () | 
| const SBuf & | cmdEpsv () | 
| const SBuf & | cmdList () | 
| const SBuf & | cmdMkd () | 
| const SBuf & | cmdMlsd () | 
| const SBuf & | cmdMlst () | 
| const SBuf & | cmdNlst () | 
| const SBuf & | cmdRetr () | 
| const SBuf & | cmdRmd () | 
| const SBuf & | cmdRnfr () | 
| const SBuf & | cmdRnto () | 
| const SBuf & | cmdSmnt () | 
| const SBuf & | cmdStat () | 
| const SBuf & | cmdStor () | 
| const SBuf & | cmdStou () | 
| const SBuf & | cmdUser () | 
| bool | Is1xx (const int sc) | 
| whether this is an informational 1xx response status code  More... | |
| bool | ParseIpPort (const char *buf, const char *forceIp, Ip::Address &addr) | 
| parses and validates "A1,A2,A3,A4,P1,P2" IP,port sequence  More... | |
| bool | ParseProtoIpPort (const char *buf, Ip::Address &addr) | 
| const char * | UnescapeDoubleQuoted (const char *quotedPath) | 
| parses an FTP-quoted quote-escaped path  More... | |
| void | StartListening () | 
| accept connections on all configured ftp_ports  More... | |
| void | StopListening () | 
| reject new connections to any configured ftp_port  More... | |
| static void | PrintReply (MemBuf &mb, const HttpReply *reply, const char *const prefix="") | 
| static bool | SupportedCommand (const SBuf &name) | 
| Whether Squid FTP Relay supports a named feature (e.g., a command).  More... | |
| static bool | CommandHasPathParameter (const SBuf &cmd) | 
| whether the given FTP command has a pathname parameter  More... | |
Variables | |
| const char *const | crlf = "\r\n" | 
Typedef Documentation
◆ StateMethod
| typedef void() Ftp::StateMethod(Ftp::Gateway *) | 
Definition at line 90 of file FtpGateway.cc.
Enumeration Type Documentation
◆ ServerState
| enum Ftp::ServerState | 
| Enumerator | |
|---|---|
| fssBegin | |
| fssConnected | |
| fssHandleFeat | |
| fssHandlePasv | |
| fssHandlePort | |
| fssHandleDataRequest | |
| fssHandleUploadRequest | |
| fssHandleEprt | |
| fssHandleEpsv | |
| fssHandleCwd | |
| fssHandlePass | |
| fssHandleCdup | |
| fssError | |
Definition at line 23 of file FtpServer.h.
Function Documentation
◆ cmdAppe()
| const SBuf & Ftp::cmdAppe | ( | ) | 
Definition at line 56 of file Elements.cc.
Referenced by CommandHasPathParameter(), and Ftp::Server::parseOneRequest().
◆ cmdAuth()
| const SBuf & Ftp::cmdAuth | ( | ) | 
Definition at line 63 of file Elements.cc.
Referenced by SupportedCommand().
◆ cmdCwd()
| const SBuf & Ftp::cmdCwd | ( | ) | 
Definition at line 70 of file Elements.cc.
Referenced by CommandHasPathParameter().
◆ cmdDele()
| const SBuf & Ftp::cmdDele | ( | ) | 
Definition at line 77 of file Elements.cc.
Referenced by CommandHasPathParameter().
◆ cmdEprt()
| const SBuf & Ftp::cmdEprt | ( | ) | 
Definition at line 84 of file Elements.cc.
Referenced by Ftp::Server::handleFeatReply().
◆ cmdEpsv()
| const SBuf & Ftp::cmdEpsv | ( | ) | 
Definition at line 91 of file Elements.cc.
Referenced by Ftp::Server::handleFeatReply().
◆ cmdList()
| const SBuf & Ftp::cmdList | ( | ) | 
Definition at line 98 of file Elements.cc.
Referenced by CommandHasPathParameter().
◆ cmdMkd()
| const SBuf & Ftp::cmdMkd | ( | ) | 
Definition at line 105 of file Elements.cc.
Referenced by CommandHasPathParameter().
◆ cmdMlsd()
| const SBuf & Ftp::cmdMlsd | ( | ) | 
Definition at line 112 of file Elements.cc.
Referenced by CommandHasPathParameter().
◆ cmdMlst()
| const SBuf & Ftp::cmdMlst | ( | ) | 
Definition at line 119 of file Elements.cc.
Referenced by CommandHasPathParameter().
◆ cmdNlst()
| const SBuf & Ftp::cmdNlst | ( | ) | 
Definition at line 126 of file Elements.cc.
Referenced by CommandHasPathParameter().
◆ cmdRetr()
| const SBuf & Ftp::cmdRetr | ( | ) | 
Definition at line 133 of file Elements.cc.
Referenced by CommandHasPathParameter().
◆ cmdRmd()
| const SBuf & Ftp::cmdRmd | ( | ) | 
Definition at line 140 of file Elements.cc.
Referenced by CommandHasPathParameter().
◆ cmdRnfr()
| const SBuf & Ftp::cmdRnfr | ( | ) | 
Definition at line 147 of file Elements.cc.
Referenced by CommandHasPathParameter().
◆ cmdRnto()
| const SBuf & Ftp::cmdRnto | ( | ) | 
Definition at line 154 of file Elements.cc.
Referenced by CommandHasPathParameter().
◆ cmdSmnt()
| const SBuf & Ftp::cmdSmnt | ( | ) | 
Definition at line 161 of file Elements.cc.
Referenced by CommandHasPathParameter().
◆ cmdStat()
| const SBuf & Ftp::cmdStat | ( | ) | 
Definition at line 168 of file Elements.cc.
Referenced by CommandHasPathParameter().
◆ cmdStor()
| const SBuf & Ftp::cmdStor | ( | ) | 
Definition at line 175 of file Elements.cc.
Referenced by CommandHasPathParameter(), and Ftp::Server::parseOneRequest().
◆ cmdStou()
| const SBuf & Ftp::cmdStou | ( | ) | 
Definition at line 182 of file Elements.cc.
Referenced by Ftp::Server::parseOneRequest().
◆ cmdUser()
| const SBuf & Ftp::cmdUser | ( | ) | 
Definition at line 189 of file Elements.cc.
Referenced by Ftp::Server::parseOneRequest().
◆ CommandHasPathParameter()
      
  | 
  static | 
◆ escapeIAC()
      
  | 
  static | 
Definition at line 43 of file FtpClient.cc.
References assert, and xmalloc.
Referenced by Ftp::Client::writeCommand().
◆ HttpReplyWrapper()
| HttpReply * Ftp::HttpReplyWrapper | ( | const int | ftpStatus, | 
| const char * | ftpReason, | ||
| const Http::StatusCode | httpStatus, | ||
| const int64_t | clen | ||
| ) | 
Definition at line 30 of file Elements.cc.
References Http::CONTENT_LENGTH, Http::DATE, Http::FTP_REASON, Http::FTP_STATUS, HttpReply::hdrCacheInit(), Http::Message::header, HttpHdrCc::Private(), Http::ProtocolVersion(), ProtocolVersion(), HttpHeader::putCc(), HttpHeader::putInt(), HttpHeader::putInt64(), HttpHeader::putStr(), HttpHeader::putTime(), Http::StatusLine::set(), HttpReply::sline, and squid_curtime.
Referenced by Ftp::Relay::createHttpReply(), Ftp::Server::earlyError(), Ftp::Server::handleFeatReply(), and Ftp::Server::setReply().
◆ Is1xx()
      
  | 
  inline | 
Definition at line 53 of file Elements.h.
References Http::scContinue, and Http::scOkay.
Referenced by Ftp::Relay::readCwdOrCdupReply(), Ftp::Relay::readEpsvReply(), Ftp::Relay::readFeatReply(), Ftp::Relay::readPasvReply(), Ftp::Relay::readReply(), and Ftp::Relay::readUserOrPassReply().
◆ ParseIpPort()
| bool Ftp::ParseIpPort | ( | const char * | buf, | 
| const char * | forceIp, | ||
| Ip::Address & | addr | ||
| ) | 
Definition at line 18 of file Parsing.cc.
References Config, SquidConfig::Ftp, Ip::Address::isAnyAddr(), port, Ip::Address::port(), and SquidConfig::sanitycheck.
Referenced by Ftp::Client::handlePasvReply(), and Ftp::Server::handlePortRequest().
◆ ParseProtoIpPort()
| bool Ftp::ParseProtoIpPort | ( | const char * | buf, | 
| Ip::Address & | addr | ||
| ) | 
parses and validates EPRT "<d><net-prt><d><net-addr><d><tcp-port><d>" proto,IP,port sequence
Definition at line 52 of file Parsing.cc.
References Config, SquidConfig::Ftp, Ip::Address::isAnyAddr(), Ip::Address::isIPv6(), MAX_IPSTRLEN, port, Ip::Address::port(), and SquidConfig::sanitycheck.
Referenced by Ftp::Server::handleEprtRequest().
◆ PrintReply()
      
  | 
  static | 
Definition at line 1213 of file FtpServer.cc.
References Packable::appendf(), Http::FTP_PRE, Http::FTP_REASON, Http::FTP_STATUS, HttpHeader::getEntry(), HttpHeader::getInt(), HttpHeader::getStr(), HttpHeader::has(), Http::Message::header, HttpHeaderInitPos, httpHeaderParseQuotedString(), and String::termedBuf().
Referenced by Ftp::Server::writeCustomReply(), and Ftp::Server::writeForwardedReplyAndCall().
◆ ProtocolVersion()
      
  | 
  inline | 
HTTP version label information.
Squid being conditionally compliant with RFC 7230 on both client and server connections the default value is HTTP/1.1.
Definition at line 24 of file Elements.cc.
References AnyP::PROTO_FTP, and AnyP::PROTO_HTTP.
Referenced by Http::One::Parser::clear(), HttpReplyWrapper(), Http::StatusLine::parse(), Ftp::Server::parseOneRequest(), parsePortProtocol(), Security::ParseProtocolVersionBase(), Security::HandshakeParser::parseVersion2Record(), Http::ProtocolVersion(), TestHttp1Parser::testDripFeed(), TestHttp1Parser::testParseRequestLineInvalid(), TestHttp1Parser::testParseRequestLineMethods(), TestHttp1Parser::testParseRequestLineProtocols(), TestHttp1Parser::testParseRequestLineStrange(), TestHttp1Parser::testParseRequestLineTerminators(), and toProtocolVersion().
◆ StartGateway()
| void Ftp::StartGateway | ( | FwdState *const | fwdState | ) | 
Definition at line 2694 of file FtpGateway.cc.
References AsyncJob::Start().
Referenced by FwdState::dispatch().
◆ StartListening()
| void Ftp::StartListening | ( | ) | 
Definition at line 265 of file FtpServer.cc.
References Ftp::Server::AcceptCtrlConnection(), clientStartListeningOn(), commCbCall(), CodeContext::Current(), DBG_IMPORTANT, debugs, Ipc::fdnFtpSocket, FtpPortList, MAXTCPLISTENPORTS, NHttpSockets, and CodeContext::Reset().
Referenced by clientOpenListenSockets().
◆ StartRelay()
| void Ftp::StartRelay | ( | FwdState *const | fwdState | ) | 
Definition at line 807 of file FtpRelay.cc.
References AsyncJob::Start().
Referenced by FwdState::dispatch().
◆ StopListening()
| void Ftp::StopListening | ( | ) | 
Definition at line 287 of file FtpServer.cc.
References CodeContext::Current(), DBG_IMPORTANT, debugs, FtpPortList, and CodeContext::Reset().
Referenced by clientConnectionsClose().
◆ SupportedCommand()
      
  | 
  static | 
Definition at line 1842 of file FtpServer.cc.
References cmdAuth().
Referenced by Ftp::Server::handleFeatReply(), and Ftp::Server::parseOneRequest().
◆ UnescapeDoubleQuoted()
| const char * Ftp::UnescapeDoubleQuoted | ( | const char * | quotedPath | ) | 
Definition at line 93 of file Parsing.cc.
References MemBuf::append(), MemBuf::content(), and MemBuf::reset().
Referenced by Ftp::Relay::stopDirTracking().
◆ UrlWith2f()
| const SBuf & Ftp::UrlWith2f | ( | HttpRequest * | request | ) | 
Construct an URI with leading / in PATH portion for use by CWD command possibly others. FTP encodes absolute paths as beginning with '/' after the initial URI path delimiter, which happens to be / itself. This makes FTP absolute URI appear as: ftp:host:port//root/path To encompass older software which compacts multiple // to / in transit We use standard URI-encoding on the second / making it ftp:host:port/%2froot/path AKA 'the FTP %2f hack'.
TODO: Should be an AnyP::Uri member
Definition at line 2613 of file FtpGateway.cc.
References SBuf::append(), HttpRequest::effectiveRequestUri(), AnyP::Uri::getScheme(), AnyP::Uri::path(), AnyP::PROTO_FTP, AnyP::Uri::SlashPath(), and HttpRequest::url.
Referenced by ErrorState::compileLegacyCode().
Variable Documentation
◆ crlf
| const char *const Ftp::crlf = "\r\n" | 
Definition at line 40 of file FtpClient.cc.
Referenced by Ftp::Client::parseControlReply(), Ftp::Gateway::parseListing(), Ftp::Relay::sendCommand(), Ftp::Client::sendEprt(), and Ftp::Client::sendPassive().
Introduction
- About Squid
 - Why Squid?
 - Squid Developers
 - How to Donate
 - How to Help Out
 - Getting Squid
 - Squid Source Packages
 - Squid Deployment Case-Studies
 - Squid Software Foundation
 
Documentation
- Quick Setup
 - Configuration:
 - FAQ and Wiki
 - Guide Books:
 - Non-English
 - More...
 
Support
- Security Advisories
 - Bugzilla Database
 - Mailing lists
 - Contacting us
 - Commercial services
 - Project Sponsors
 - Squid-based products
 
