FtpGateway.cc File Reference
#include "squid.h"
#include "acl/FilledChecklist.h"
#include "base/PackableStream.h"
#include "clients/forward.h"
#include "clients/FtpClient.h"
#include "comm.h"
#include "comm/ConnOpener.h"
#include "comm/Read.h"
#include "comm/TcpAcceptor.h"
#include "CommCalls.h"
#include "compat/strtoll.h"
#include "errorpage.h"
#include "fd.h"
#include "fde.h"
#include "FwdState.h"
#include "html_quote.h"
#include "HttpHdrContRange.h"
#include "HttpHeader.h"
#include "HttpHeaderRange.h"
#include "HttpReply.h"
#include "ip/tools.h"
#include "MemBuf.h"
#include "mime.h"
#include "rfc1738.h"
#include "SquidConfig.h"
#include "SquidString.h"
#include "SquidTime.h"
#include "StatCounters.h"
#include "Store.h"
#include "tools.h"
#include "util.h"
#include "wordlist.h"
#include "DelayPools.h"
#include "MemObject.h"
#include <cerrno>
Include dependency graph for FtpGateway.cc:

Go to the source code of this file.

Classes

struct  Ftp::GatewayFlags
 
class  Ftp::Gateway
 
struct  ftpListParts
 

Namespaces

 Ftp
 

Macros

#define CTRL_BUFLEN   16*1024
 
#define MAX_TOKENS   64
 

Typedefs

typedef void() Ftp::StateMethod(Ftp::Gateway *)
 
typedef Ftp::StateMethod FTPSM
 

Functions

 CBDATA_NAMESPACED_CLASS_INIT (Ftp, Gateway)
 
static int is_month (const char *buf)
 
static void ftpListPartsFree (ftpListParts **parts)
 
static ftpListPartsftpListParseParts (const char *buf, struct Ftp::GatewayFlags flags)
 
static void ftpReadWelcome (Ftp::Gateway *ftpState)
 
static void ftpSendUser (Ftp::Gateway *ftpState)
 
static void ftpReadUser (Ftp::Gateway *ftpState)
 
static void ftpSendPass (Ftp::Gateway *ftpState)
 
static void ftpReadPass (Ftp::Gateway *ftpState)
 
static void ftpSendType (Ftp::Gateway *ftpState)
 
static void ftpReadType (Ftp::Gateway *ftpState)
 
static void ftpTraverseDirectory (Ftp::Gateway *ftpState)
 
static void ftpSendCwd (Ftp::Gateway *ftpState)
 
static void ftpReadCwd (Ftp::Gateway *ftpState)
 
static void ftpSendMkdir (Ftp::Gateway *ftpState)
 
static void ftpReadMkdir (Ftp::Gateway *ftpState)
 
static void ftpGetFile (Ftp::Gateway *ftpState)
 
static void ftpListDir (Ftp::Gateway *ftpState)
 
static void ftpSendMdtm (Ftp::Gateway *ftpState)
 
static void ftpReadMdtm (Ftp::Gateway *ftpState)
 
static void ftpSendSize (Ftp::Gateway *ftpState)
 
static void ftpReadSize (Ftp::Gateway *ftpState)
 
static void ftpReadEPSV (Ftp::Gateway *ftpState)
 
static void ftpSendPassive (Ftp::Gateway *ftpState)
 
static void ftpReadPasv (Ftp::Gateway *ftpState)
 
static void ftpOpenListenSocket (Ftp::Gateway *ftpState, int fallback)
 
static void ftpSendPORT (Ftp::Gateway *ftpState)
 
static void ftpReadPORT (Ftp::Gateway *ftpState)
 
static void ftpReadEPRT (Ftp::Gateway *ftpState)
 
static void ftpRestOrList (Ftp::Gateway *ftpState)
 
static void ftpSendStor (Ftp::Gateway *ftpState)
 
static void ftpReadStor (Ftp::Gateway *ftpState)
 
static void ftpSendRest (Ftp::Gateway *ftpState)
 
static void ftpReadRest (Ftp::Gateway *ftpState)
 
static void ftpSendList (Ftp::Gateway *ftpState)
 
static void ftpSendNlst (Ftp::Gateway *ftpState)
 
static void ftpReadList (Ftp::Gateway *ftpState)
 
static void ftpSendRetr (Ftp::Gateway *ftpState)
 
static void ftpReadRetr (Ftp::Gateway *ftpState)
 
static void ftpReadTransferDone (Ftp::Gateway *ftpState)
 
static void ftpWriteTransferDone (Ftp::Gateway *ftpState)
 
static void ftpSendQuit (Ftp::Gateway *ftpState)
 
static void ftpReadQuit (Ftp::Gateway *ftpState)
 
static void ftpTrySlashHack (Ftp::Gateway *ftpState)
 
static void ftpFail (Ftp::Gateway *ftpState)
 
static void ftpSendReply (Ftp::Gateway *ftpState)
 

Variables

static char cbuf [CTRL_BUFLEN]
 
static FTPSM ftpReadWelcome
 
static FTPSM ftpSendUser
 
static FTPSM ftpReadUser
 
static FTPSM ftpSendPass
 
static FTPSM ftpReadPass
 
static FTPSM ftpSendType
 
static FTPSM ftpReadType
 
static FTPSM ftpSendMdtm
 
static FTPSM ftpReadMdtm
 
static FTPSM ftpSendSize
 
static FTPSM ftpReadSize
 
static FTPSM ftpReadEPRT
 
static FTPSM ftpSendPORT
 
static FTPSM ftpReadPORT
 
static FTPSM ftpSendPassive
 
static FTPSM ftpReadEPSV
 
static FTPSM ftpReadPasv
 
static FTPSM ftpTraverseDirectory
 
static FTPSM ftpListDir
 
static FTPSM ftpGetFile
 
static FTPSM ftpSendCwd
 
static FTPSM ftpReadCwd
 
static FTPSM ftpRestOrList
 
static FTPSM ftpSendList
 
static FTPSM ftpSendNlst
 
static FTPSM ftpReadList
 
static FTPSM ftpSendRest
 
static FTPSM ftpReadRest
 
static FTPSM ftpSendRetr
 
static FTPSM ftpReadRetr
 
static FTPSM ftpReadTransferDone
 
static FTPSM ftpSendStor
 
static FTPSM ftpReadStor
 
static FTPSM ftpWriteTransferDone
 
static FTPSM ftpSendReply
 
static FTPSM ftpSendMkdir
 
static FTPSM ftpReadMkdir
 
static FTPSM ftpFail
 
static FTPSM ftpSendQuit
 
static FTPSM ftpReadQuit
 
FTPSMFTP_SM_FUNCS []
 
static const char * Month []
 

Macro Definition Documentation

◆ CTRL_BUFLEN

◆ MAX_TOKENS

#define MAX_TOKENS   64

Definition at line 527 of file FtpGateway.cc.

Referenced by ftpListParseParts().

Typedef Documentation

◆ FTPSM

Definition at line 178 of file FtpGateway.cc.

Function Documentation

◆ CBDATA_NAMESPACED_CLASS_INIT()

CBDATA_NAMESPACED_CLASS_INIT ( Ftp  ,
Gateway   
)

◆ ftpFail()

◆ ftpGetFile()

static void ftpGetFile ( Ftp::Gateway ftpState)
static

◆ ftpListDir()

◆ ftpListParseParts()

◆ ftpListPartsFree()

static void ftpListPartsFree ( ftpListParts **  parts)
static

Definition at line 518 of file FtpGateway.cc.

References safe_free.

Referenced by ftpListParseParts(), and Ftp::Gateway::htmlifyListEntry().

◆ ftpOpenListenSocket()

◆ ftpReadCwd()

◆ ftpReadEPRT()

static void ftpReadEPRT ( Ftp::Gateway ftpState)
static

◆ ftpReadEPSV()

static void ftpReadEPSV ( Ftp::Gateway ftpState)
static

◆ ftpReadList()

◆ ftpReadMdtm()

◆ ftpReadMkdir()

◆ ftpReadPass()

static void ftpReadPass ( Ftp::Gateway ftpState)
static

◆ ftpReadPasv()

static void ftpReadPasv ( Ftp::Gateway ftpState)
static

◆ ftpReadPORT()

◆ ftpReadQuit()

static void ftpReadQuit ( Ftp::Gateway ftpState)
static

Completes a client FTP operation with success or other page generated and stored in the entry field by the code issuing QUIT.

Definition at line 2338 of file FtpGateway.cc.

References Client::serverComplete().

◆ ftpReadRest()

◆ ftpReadRetr()

◆ ftpReadSize()

◆ ftpReadStor()

static void ftpReadStor ( Ftp::Gateway ftpState)
static
Deprecated:
use ftpState->readStor() instead.

Definition at line 2049 of file FtpGateway.cc.

References Ftp::Gateway::readStor().

◆ ftpReadTransferDone()

◆ ftpReadType()

◆ ftpReadUser()

static void ftpReadUser ( Ftp::Gateway ftpState)
static

◆ ftpReadWelcome()

◆ ftpRestOrList()

◆ ftpSendCwd()

◆ ftpSendList()

◆ ftpSendMdtm()

◆ ftpSendMkdir()

◆ ftpSendNlst()

◆ ftpSendPass()

◆ ftpSendPassive()

static void ftpSendPassive ( Ftp::Gateway ftpState)
static

Send Passive connection request. Default method is to use modern EPSV request. The failover mechanism should check for previous state and re-call with alternates on failure.

Checks the server control channel is still available before running.

Checks for 'HEAD' method request and passes off for special handling by Ftp::Gateway::processHeadResponse().

Definition at line 1662 of file FtpGateway.cc.

References debugs, Ftp::GatewayFlags::epsv_all_sent, Ftp::Gateway::flags, Ftp::Gateway::haveControlChannel(), HERE(), Ftp::GatewayFlags::isdir, HttpRequest::method, Http::METHOD_HEAD, Ftp::Gateway::processHeadResponse(), Client::request, Ftp::Client::sendPassive(), Ftp::Client::SENT_EPSV_ALL, Ftp::Client::state, and Ftp::Gateway::theSize.

◆ ftpSendPORT()

◆ ftpSendQuit()

static void ftpSendQuit ( Ftp::Gateway ftpState)
static

◆ ftpSendReply()

◆ ftpSendRest()

◆ ftpSendRetr()

◆ ftpSendSize()

◆ ftpSendStor()

◆ ftpSendType()

◆ ftpSendUser()

◆ ftpTraverseDirectory()

◆ ftpTrySlashHack()

◆ ftpWriteTransferDone()

◆ is_month()

static int is_month ( const char *  buf)
static

Definition at line 506 of file FtpGateway.cc.

References i, and Month.

Referenced by ftpListParseParts().

Variable Documentation

◆ cbuf

◆ FTP_SM_FUNCS

FTPSM* FTP_SM_FUNCS[]
Initial value:
= {
NULL,
NULL,
NULL,
NULL,
NULL
}
static FTPSM ftpReadStor
Definition: FtpGateway.cc:235
static FTPSM ftpReadTransferDone
Definition: FtpGateway.cc:233
static FTPSM ftpReadPass
Definition: FtpGateway.cc:204
static FTPSM ftpReadEPRT
Definition: FtpGateway.cc:214
static FTPSM ftpReadSize
Definition: FtpGateway.cc:210
static FTPSM ftpReadMkdir
Definition: FtpGateway.cc:239
static FTPSM ftpReadMdtm
Definition: FtpGateway.cc:208
static FTPSM ftpReadPasv
Definition: FtpGateway.cc:219
static FTPSM ftpReadEPSV
Definition: FtpGateway.cc:218
static FTPSM ftpReadUser
Definition: FtpGateway.cc:202
static FTPSM ftpReadPORT
Definition: FtpGateway.cc:216
static FTPSM ftpReadRest
Definition: FtpGateway.cc:230
static FTPSM ftpReadList
Definition: FtpGateway.cc:228
static FTPSM ftpReadRetr
Definition: FtpGateway.cc:232
static FTPSM ftpReadCwd
Definition: FtpGateway.cc:224
static FTPSM ftpReadWelcome
Definition: FtpGateway.cc:200
static FTPSM ftpWriteTransferDone
Definition: FtpGateway.cc:236
static FTPSM ftpReadQuit
Definition: FtpGateway.cc:242
static FTPSM ftpReadType
Definition: FtpGateway.cc:206
#define NULL
Definition: types.h:166

Definition at line 286 of file FtpGateway.cc.

Referenced by Ftp::Gateway::handleControlReply().

◆ ftpFail

◆ ftpGetFile

FTPSM ftpGetFile
static

Definition at line 222 of file FtpGateway.cc.

Referenced by ftpTraverseDirectory(), and ftpTrySlashHack().

◆ ftpListDir

FTPSM ftpListDir
static

Definition at line 221 of file FtpGateway.cc.

Referenced by ftpReadType(), and ftpTraverseDirectory().

◆ ftpReadCwd

FTPSM ftpReadCwd
static

Definition at line 224 of file FtpGateway.cc.

◆ ftpReadEPRT

FTPSM ftpReadEPRT
static

Definition at line 214 of file FtpGateway.cc.

◆ ftpReadEPSV

FTPSM ftpReadEPSV
static

Definition at line 218 of file FtpGateway.cc.

◆ ftpReadList

FTPSM ftpReadList
static

Definition at line 228 of file FtpGateway.cc.

◆ ftpReadMdtm

FTPSM ftpReadMdtm
static

Definition at line 208 of file FtpGateway.cc.

◆ ftpReadMkdir

FTPSM ftpReadMkdir
static

Definition at line 239 of file FtpGateway.cc.

◆ ftpReadPass

FTPSM ftpReadPass
static

Definition at line 204 of file FtpGateway.cc.

Referenced by ftpReadUser().

◆ ftpReadPasv

FTPSM ftpReadPasv
static

Definition at line 219 of file FtpGateway.cc.

◆ ftpReadPORT

FTPSM ftpReadPORT
static

Definition at line 216 of file FtpGateway.cc.

Referenced by ftpSendPORT().

◆ ftpReadQuit

FTPSM ftpReadQuit
static

Definition at line 242 of file FtpGateway.cc.

◆ ftpReadRest

FTPSM ftpReadRest
static

Definition at line 230 of file FtpGateway.cc.

◆ ftpReadRetr

FTPSM ftpReadRetr
static

Definition at line 232 of file FtpGateway.cc.

◆ ftpReadSize

FTPSM ftpReadSize
static

Definition at line 210 of file FtpGateway.cc.

◆ ftpReadStor

FTPSM ftpReadStor
static

Definition at line 235 of file FtpGateway.cc.

◆ ftpReadTransferDone

FTPSM ftpReadTransferDone
static

Definition at line 233 of file FtpGateway.cc.

◆ ftpReadType

FTPSM ftpReadType
static

Definition at line 206 of file FtpGateway.cc.

◆ ftpReadUser

FTPSM ftpReadUser
static

Definition at line 202 of file FtpGateway.cc.

◆ ftpReadWelcome

FTPSM ftpReadWelcome
static

Definition at line 200 of file FtpGateway.cc.

◆ ftpRestOrList

FTPSM ftpRestOrList
static

Definition at line 225 of file FtpGateway.cc.

Referenced by Ftp::Gateway::dataChannelConnected(), ftpReadEPRT(), and ftpReadPORT().

◆ ftpSendCwd

FTPSM ftpSendCwd
static

Definition at line 223 of file FtpGateway.cc.

Referenced by ftpReadMkdir(), ftpReadRetr(), and ftpTraverseDirectory().

◆ ftpSendList

FTPSM ftpSendList
static

Definition at line 226 of file FtpGateway.cc.

Referenced by ftpRestOrList().

◆ ftpSendMdtm

FTPSM ftpSendMdtm
static

Definition at line 207 of file FtpGateway.cc.

Referenced by ftpGetFile().

◆ ftpSendMkdir

FTPSM ftpSendMkdir
static

Definition at line 238 of file FtpGateway.cc.

Referenced by ftpReadCwd(), and ftpRestOrList().

◆ ftpSendNlst

FTPSM ftpSendNlst
static

Definition at line 227 of file FtpGateway.cc.

Referenced by ftpReadList(), and ftpRestOrList().

◆ ftpSendPass

FTPSM ftpSendPass
static

Definition at line 203 of file FtpGateway.cc.

Referenced by ftpReadUser().

◆ ftpSendPassive

FTPSM ftpSendPassive
static

◆ ftpSendPORT

FTPSM ftpSendPORT
static

Definition at line 215 of file FtpGateway.cc.

Referenced by ftpReadEPRT(), and ftpReadPORT().

◆ ftpSendQuit

FTPSM ftpSendQuit
static

◆ ftpSendReply

FTPSM ftpSendReply
static

Definition at line 237 of file FtpGateway.cc.

Referenced by ftpReadMkdir(), ftpSendStor(), and ftpWriteTransferDone().

◆ ftpSendRest

FTPSM ftpSendRest
static

Definition at line 229 of file FtpGateway.cc.

Referenced by ftpRestOrList().

◆ ftpSendRetr

FTPSM ftpSendRetr
static

Definition at line 231 of file FtpGateway.cc.

Referenced by ftpReadRest(), and ftpRestOrList().

◆ ftpSendSize

FTPSM ftpSendSize
static

Definition at line 209 of file FtpGateway.cc.

Referenced by ftpReadMdtm().

◆ ftpSendStor

FTPSM ftpSendStor
static

Definition at line 234 of file FtpGateway.cc.

Referenced by ftpRestOrList().

◆ ftpSendType

FTPSM ftpSendType
static

Definition at line 205 of file FtpGateway.cc.

Referenced by ftpReadPass().

◆ ftpSendUser

FTPSM ftpSendUser
static

Definition at line 201 of file FtpGateway.cc.

Referenced by ftpReadWelcome().

◆ ftpTraverseDirectory

FTPSM ftpTraverseDirectory
static

Definition at line 220 of file FtpGateway.cc.

Referenced by ftpReadCwd(), and ftpReadType().

◆ ftpWriteTransferDone

FTPSM ftpWriteTransferDone
static

Definition at line 236 of file FtpGateway.cc.

◆ Month

const char* Month[]
static
Initial value:
= {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
}

Definition at line 500 of file FtpGateway.cc.

Referenced by is_month().

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors