]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
SourceFormat Enforcement
authorAlex Rousskov <rousskov@measurement-factory.com>
Fri, 8 Aug 2014 03:07:03 +0000 (21:07 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Fri, 8 Aug 2014 03:07:03 +0000 (21:07 -0600)
16 files changed:
src/HttpHeader.cc
src/cache_cf.cc
src/clientStream.h
src/client_side.cc
src/clients/FtpClient.cc
src/clients/FtpClient.h
src/clients/FtpGateway.cc
src/clients/FtpRelay.cc
src/clients/forward.h
src/ftp/Elements.h
src/ftp/Parsing.h
src/parser/Tokenizer.cc
src/servers/FtpServer.cc
src/servers/FtpServer.h
src/servers/HttpServer.cc
src/servers/forward.h

index 0d7b2b7c8d67adc48c76f190cbd725f9a78a3d20..e9eef0f33b828fa4020a04387695836423e8678d 100644 (file)
@@ -739,9 +739,9 @@ HttpHeader::packInto(Packer * p, bool mask_sensitive_info) const
             e->packInto(p);
             continue;
         }
-        switch (e->id) {
         // TODO: When native FTP commands may end up in error pages and other
         // sensitive places, hide HDR_FTP_ARGUMENTS for the FTP PASS command.
+        switch (e->id) {
         case HDR_AUTHORIZATION:
         case HDR_PROXY_AUTHORIZATION:
             packerAppend(p, e->name.rawBuf(), e->name.size());
index 1e37007ddc79e7d9488804d86f8f53db00a15efa..17835cf12c6a5c642d0b8a003a1160a4700c3934 100644 (file)
@@ -3753,9 +3753,9 @@ parse_port_option(AnyP::PortCfgPointer &s, char *token)
         parseBytesOptionValue(&s->dynamicCertMemCacheSize, B_BYTES_STR, token + 28);
 #endif
     } else if (strcmp(token, "ftp-track-dirs=on") == 0) {
-       s->ftp_track_dirs = true;
+        s->ftp_track_dirs = true;
     } else if (strcmp(token, "ftp-track-dirs=off") == 0) {
-       s->ftp_track_dirs = false;
+        s->ftp_track_dirs = false;
     } else {
         debugs(3, DBG_CRITICAL, "FATAL: Unknown http(s)_port option '" << token << "'.");
         self_destruct();
index 8cce69a1a51eefa8a74a85a0800000a3d7d7b229..2c3348b7e90abee6c47be474714a68eca31a5562 100644 (file)
@@ -33,8 +33,8 @@
 #define SQUID_CLIENTSTREAM_H
 
 #include "base/RefCount.h"
-#include "dlink.h"
 #include "clientStreamForward.h"
+#include "dlink.h"
 #include "StoreIOBuffer.h"
 
 /**
index bd82eccfc2cabee2b297027b8fa4ce1bbb4f060c..28de880e8ec2977fdcbcc6440b775c371c93ef76 100644 (file)
@@ -4111,7 +4111,8 @@ clientHttpsConnectionsOpen(void)
 #endif
 
 void
-clientStartListeningOn(AnyP::PortCfgPointer &port, const RefCount< CommCbFunPtrCallT<CommAcceptCbPtrFun> > &subCall, const Ipc::FdNoteId fdNote) {
+clientStartListeningOn(AnyP::PortCfgPointer &port, const RefCount< CommCbFunPtrCallT<CommAcceptCbPtrFun> > &subCall, const Ipc::FdNoteId fdNote)
+{
     // Fill out a Comm::Connection which IPC will open as a listener for us
     port->listenConn = new Comm::Connection;
     port->listenConn->local = port->s;
@@ -4443,7 +4444,7 @@ void
 ConnStateData::pinConnection(const Comm::ConnectionPointer &pinServer, HttpRequest *request, CachePeer *aPeer, bool auth, bool monitor)
 {
     if (!Comm::IsConnOpen(pinning.serverConnection) ||
-        pinning.serverConnection->fd != pinServer->fd)
+            pinning.serverConnection->fd != pinServer->fd)
         pinNewConnection(pinServer, request, aPeer, auth);
 
     if (monitor)
index 0476a4a4db9ce56153e7d146858e9a4ae3c29843..f6a3132411fc4f5efa153908ea08f5d85e58e3e1 100644 (file)
@@ -6,11 +6,8 @@
 #include "squid.h"
 
 #include "acl/FilledChecklist.h"
-#include "clients/FtpClient.h"
-#include "Mem.h"
-#include "SquidConfig.h"
-#include "StatCounters.h"
 #include "client_side.h"
+#include "clients/FtpClient.h"
 #include "comm/ConnOpener.h"
 #include "comm/Read.h"
 #include "comm/TcpAcceptor.h"
 #include "fd.h"
 #include "ftp/Parsing.h"
 #include "ip/tools.h"
+#include "Mem.h"
+#include "SquidConfig.h"
 #include "SquidString.h"
+#include "StatCounters.h"
 #include "tools.h"
 #include "wordlist.h"
 #include <set>
 
-namespace Ftp {
+namespace Ftp
+{
 
 const char *const crlf = "\r\n";
 
@@ -64,7 +65,7 @@ escapeIAC(const char *buf)
 /// configures the channel with a descriptor and registers a close handler
 void
 Ftp::Channel::opened(const Comm::ConnectionPointer &newConn,
-                      const AsyncCall::Pointer &aCloser)
+                     const AsyncCall::Pointer &aCloser)
 {
     assert(!Comm::IsConnOpen(conn));
     assert(closer == NULL);
@@ -147,11 +148,11 @@ Ftp::DataChannel::~DataChannel()
 void
 Ftp::DataChannel::addr(const Ip::Address &import)
 {
-     static char addrBuf[MAX_IPSTRLEN];
-     import.toStr(addrBuf, sizeof(addrBuf));
-     xfree(host);
-     host = xstrdup(addrBuf);
-     port = import.port();
+    static char addrBuf[MAX_IPSTRLEN];
+    import.toStr(addrBuf, sizeof(addrBuf));
+    xfree(host);
+    host = xstrdup(addrBuf);
+    port = import.port();
 }
 
 /* Ftp::Client */
@@ -173,7 +174,7 @@ Ftp::Client::Client(FwdState *fwdState):
 
     typedef CommCbMemFunT<Client, CommCloseCbParams> Dialer;
     const AsyncCall::Pointer closer = JobCallback(9, 5, Dialer, this,
-                                                  Ftp::Client::ctrlClosed);
+                                      Ftp::Client::ctrlClosed);
     ctrl.opened(fwdState->serverConnection(), closer);
 }
 
@@ -281,7 +282,7 @@ Ftp::Client::failedHttpStatus(err_type &error)
     if (error == ERR_NONE)
         error = ERR_FTP_FAILURE;
     return error == ERR_READ_TIMEOUT ? Http::scGatewayTimeout :
-        Http::scBadGateway;
+           Http::scBadGateway;
 }
 
 /**
@@ -618,7 +619,6 @@ Ftp::Client::sendPassive()
         return false;
     }
 
-
     /// Closes any old FTP-Data connection which may exist. */
     data.close();
 
@@ -710,7 +710,6 @@ Ftp::Client::sendPassive()
     return true;
 }
 
-
 void
 Ftp::Client::connectDataChannel()
 {
@@ -1008,7 +1007,7 @@ Ftp::Client::switchTimeoutToDataChannel()
 
     typedef CommCbMemFunT<Client, CommTimeoutCbParams> TimeoutDialer;
     AsyncCall::Pointer timeoutCall = JobCallback(9, 5, TimeoutDialer, this,
-                                                 Ftp::Client::timeout);
+                                     Ftp::Client::timeout);
     commSetConnTimeout(data.conn, Config.Timeout.read, timeoutCall);
 }
 
index 12f2e20f26344f50eafa124d347af337cc3f5b60..6279203fd0ec21186d09afe651ada6d9a2a971b1 100644 (file)
@@ -9,7 +9,8 @@
 #include "Server.h"
 
 class String;
-namespace Ftp {
+namespace Ftp
+{
 
 extern const char *const crlf;
 
index 4daf7ae0ab5e6ccb833649f4fd4e60e6bc52d6c0..4a06d5c1019588f09c1e8bd43d61e82f9b4f51a8 100644 (file)
@@ -72,7 +72,8 @@
 
 #include <cerrno>
 
-namespace Ftp {
+namespace Ftp
+{
 
 /**
  \defgroup ServerProtocolFTPInternal Server-Side FTP Internals
@@ -365,8 +366,8 @@ Ftp::Gateway::dataClosed(const CommCloseCbParams &io)
 }
 
 Ftp::Gateway::Gateway(FwdState *fwdState):
-    AsyncJob("FtpStateData"),
-    Ftp::Client(fwdState)
+        AsyncJob("FtpStateData"),
+        Ftp::Client(fwdState)
 {
     const char *url = entry->url();
     debugs(9, 3, HERE << "'" << url << "'" );
index 780badeb4f7a57ae832f2b1725b3ed75e4037e3d..11219052dd80abe69ebaf8b9f421c43dd308d121 100644 (file)
 #include "HttpHdrCc.h"
 #include "HttpRequest.h"
 #include "SBuf.h"
-#include "servers/FtpServer.h"
 #include "Server.h"
+#include "servers/FtpServer.h"
 #include "SquidTime.h"
 #include "Store.h"
 #include "wordlist.h"
 
-namespace Ftp {
+namespace Ftp
+{
 
 /// An FTP client receiving native FTP commands from our FTP server
 /// (Ftp::Server), forwarding them to the next FTP hop,
@@ -160,9 +161,8 @@ Ftp::Relay::start()
 {
     if (!master().clientReadGreeting)
         Ftp::Client::start();
-    else
-    if (serverState() == fssHandleDataRequest ||
-        serverState() == fssHandleUploadRequest)
+    else if (serverState() == fssHandleDataRequest ||
+             serverState() == fssHandleUploadRequest)
         handleDataRequest();
     else
         sendCommand();
@@ -363,7 +363,7 @@ Ftp::Relay::forwardPreliminaryReply(const PreliminaryCb cb)
     // the Sink will use this to call us back after writing 1xx to the client
     typedef NullaryMemFunT<Relay> CbDialer;
     const AsyncCall::Pointer call = JobCallback(11, 3, CbDialer, this,
-        Ftp::Relay::proceedAfterPreliminaryReply);
+                                    Ftp::Relay::proceedAfterPreliminaryReply);
 
     CallJobHere1(9, 4, request->clientConnectionManager, ConnStateData,
                  ConnStateData::sendControlMsg, HttpControlMsg(reply, call));
@@ -486,9 +486,9 @@ Ftp::Relay::sendCommand()
         debugs(9, 5, "command: " << cmd << ", no parameters");
 
     if (serverState() == fssHandlePasv ||
-        serverState() == fssHandleEpsv ||
-        serverState() == fssHandleEprt ||
-        serverState() == fssHandlePort) {
+            serverState() == fssHandleEpsv ||
+            serverState() == fssHandleEprt ||
+            serverState() == fssHandlePort) {
         sendPassive();
         return;
     }
index d32c4612dd957f037b24f6996d30091271822f36..44aca5ef0d6d4d6fe350b71599a588952257eeca 100644 (file)
@@ -8,7 +8,8 @@ class AsyncJob;
 template <class Cbc> class CbcPointer;
 typedef CbcPointer<AsyncJob> AsyncJobPointer;
 
-namespace Ftp {
+namespace Ftp
+{
 
 /// A new FTP Gateway job
 AsyncJobPointer StartGateway(FwdState *const fwdState);
index 87f74e4a8d920f10a186cf7239992b0817290054..769de2f4331f7f59b9f51ce8d1950e6e858c3ff0 100644 (file)
@@ -6,7 +6,8 @@
 class SBuf;
 class HttpReply;
 
-namespace Ftp {
+namespace Ftp
+{
 
 /// Create an internal HttpReply structure to house FTP control response info.
 HttpReply *HttpReplyWrapper(const int ftpStatus, const char *ftpReason, const Http::StatusCode httpStatus, const int64_t clen);
index 89dd64a138f0f001d05a81043bdb45d6d7ec6392..56cd879ce99485522f2d492992d2ae382431f687 100644 (file)
@@ -3,7 +3,8 @@
 
 #include "ip/forward.h"
 
-namespace Ftp {
+namespace Ftp
+{
 
 /// parses and validates "A1,A2,A3,A4,P1,P2" IP,port sequence
 bool ParseIpPort(const char *buf, const char *forceIp, Ip::Address &addr);
index c735414d197d064ade6e35bdd1e75c68f1956e4c..a7dbdba6b6746aba2c89c010dad1ccd4e0806723 100644 (file)
 #endif
 #endif
 
-
 /// convenience method: consumes up to n bytes, counts, and returns them
 SBuf
-Parser::Tokenizer::consume(const SBuf::size_type n) {
+Parser::Tokenizer::consume(const SBuf::size_type n)
+{
     // careful: n may be npos!
     const SBuf result = buf_.consume(n);
     parsed_ += result.length();
@@ -40,7 +40,8 @@ Parser::Tokenizer::consume(const SBuf::size_type n) {
 
 /// convenience method: consume()s up to n bytes and returns their count
 SBuf::size_type
-Parser::Tokenizer::success(const SBuf::size_type n) {
+Parser::Tokenizer::success(const SBuf::size_type n)
+{
     return consume(n).length();
 }
 
index 51e6a4a3942ebfefa1acee5593a3e90042a7c44e..e17761ab0fa9122a12063fcb568b4367355b685b 100644 (file)
@@ -5,13 +5,13 @@
 #include "squid.h"
 #include "base/CharacterSet.h"
 #include "base/Subscription.h"
+#include "client_side_reply.h"
+#include "client_side_request.h"
 #include "clientStream.h"
 #include "comm/ConnOpener.h"
 #include "comm/Read.h"
 #include "comm/TcpAcceptor.h"
 #include "comm/Write.h"
-#include "client_side_reply.h"
-#include "client_side_request.h"
 #include "errorpage.h"
 #include "fd.h"
 #include "ftp/Elements.h"
@@ -32,7 +32,8 @@
 
 CBDATA_NAMESPACED_CLASS_INIT(Ftp, Server);
 
-namespace Ftp {
+namespace Ftp
+{
 static void PrintReply(MemBuf &mb, const HttpReply *reply, const char *const prefix = "");
 static bool SupportedCommand(const SBuf &name);
 static bool CommandHasPathParameter(const SBuf &cmd);
@@ -197,7 +198,7 @@ Ftp::Server::shovelUploadData()
 
     debugs(33, 5, "handling FTP request data for " << clientConnection);
     const size_t putSize = bodyPipe->putMoreData(uploadBuf,
-                                                 uploadAvailSize);
+                           uploadAvailSize);
     if (putSize > 0) {
         uploadAvailSize -= putSize;
         if (uploadAvailSize > 0)
@@ -262,8 +263,8 @@ Ftp::StartListening()
         // direct new connections accepted by listenConn to Accept()
         typedef CommCbFunPtrCallT<CommAcceptCbPtrFun> AcceptCall;
         RefCount<AcceptCall> subCall = commCbCall(5, 5, "Ftp::Server::AcceptCtrlConnection",
-            CommAcceptCbPtrFun(Ftp::Server::AcceptCtrlConnection,
-                               CommAcceptCbParams(NULL)));
+                                       CommAcceptCbPtrFun(Ftp::Server::AcceptCtrlConnection,
+                                                          CommAcceptCbParams(NULL)));
         clientStartListeningOn(s, subCall, Ipc::fdnFtpSocket);
     }
 }
@@ -393,8 +394,7 @@ Ftp::Server::acceptDataConnection(const CommAcceptCbParams &params)
         debugs(33, 5, "late data connection?");
         closeDataConnection(); // in case we are still listening
         params.conn->close();
-    } else
-    if (params.conn->remote != clientConnection->remote) {
+    } else if (params.conn->remote != clientConnection->remote) {
         debugs(33, 2, "rogue data conn? ctrl: " << clientConnection->remote);
         params.conn->close();
         // Some FTP servers close control connection here, but it may make
@@ -489,7 +489,7 @@ Ftp::Server::writeCustomReply(const int code, const char *msg, const HttpReply *
     assert(99 < code && code < 1000);
 
     const bool sendDetails = reply != NULL &&
-        reply->header.has(HDR_FTP_STATUS) && reply->header.has(HDR_FTP_REASON);
+                             reply->header.has(HDR_FTP_STATUS) && reply->header.has(HDR_FTP_REASON);
 
     MemBuf mb;
     mb.init();
@@ -621,7 +621,7 @@ Ftp::Server::parseOneRequest(Http::ProtocolVersion &ver)
         Http::METHOD_PUT : Http::METHOD_GET;
 
     const SBuf *path = params.length() && CommandHasPathParameter(cmd) ?
-        &params : NULL;
+                       &params : NULL;
     calcUri(path);
     char *newUri = xstrdup(uri.c_str());
     HttpRequest *const request = HttpRequest::CreateFromUrlAndMethod(newUri, method);
@@ -682,7 +682,7 @@ Ftp::Server::handleReply(HttpReply *reply, StoreIOBuffer data)
     assert(context != NULL);
 
     if (context->http && context->http->al != NULL &&
-        !context->http->al->reply && reply) {
+            !context->http->al->reply && reply) {
         context->http->al->reply = reply;
         HTTPMSGLOCK(context->http->al->reply);
     }
@@ -905,7 +905,8 @@ Ftp::Server::wroteReplyData(const CommIoCbParams &io)
 
 /// ClientStream checks after (actual or skipped) reply data writing
 void
-Ftp::Server::replyDataWritingCheckpoint() {
+Ftp::Server::replyDataWritingCheckpoint()
+{
     switch (getCurrentContext()->socketState()) {
     case STREAM_NONE:
         debugs(33, 3, "Keep going");
@@ -1066,8 +1067,8 @@ Ftp::Server::writeForwardedReplyAndCall(const HttpReply *reply, AsyncCall::Point
     // Status 125 or 150 implies upload or data request, but we still check
     // the state in case the server is buggy.
     if ((scode == 125 || scode == 150) &&
-        (master.serverState == fssHandleUploadRequest ||
-         master.serverState == fssHandleDataRequest)) {
+            (master.serverState == fssHandleUploadRequest ||
+             master.serverState == fssHandleDataRequest)) {
         if (checkDataConnPost()) {
             // If the data connection is ready, start reading data (here)
             // and forward the response to client (further below).
@@ -1174,8 +1175,8 @@ Ftp::Server::wroteReply(const CommIoCbParams &io)
     switch (socketState) {
     case STREAM_UNPLANNED_COMPLETE:
     case STREAM_FAILED:
-         io.conn->close();
-         return;
+        io.conn->close();
+        return;
 
     case STREAM_NONE:
     case STREAM_COMPLETE:
@@ -1189,7 +1190,8 @@ Ftp::Server::wroteReply(const CommIoCbParams &io)
 }
 
 bool
-Ftp::Server::handleRequest(String &cmd, String &params) {
+Ftp::Server::handleRequest(String &cmd, String &params)
+{
     HttpRequest *request = getCurrentContext()->http->request;
     Must(request);
 
@@ -1527,7 +1529,7 @@ Ftp::Server::checkDataConnPre()
     typedef CommCbMemFunT<Server, CommConnectCbParams> Dialer;
     connector = JobCallback(17, 3, Dialer, this, Ftp::Server::connectedForData);
     Comm::ConnOpener *cs = new Comm::ConnOpener(dataConn, connector,
-                                                Config.Timeout.connect);
+            Config.Timeout.connect);
     AsyncJob::Start(cs);
     return false; // ConnStateData::processFtpRequest waits handleConnectDone
 }
index 4f6f8a84af3bcd72f95561d1f0c99459ead69457..574e26efc30031290429b86b02b6d9bd1bc5cceb 100644 (file)
@@ -7,7 +7,8 @@
 
 #include "client_side.h"
 
-namespace Ftp {
+namespace Ftp
+{
 
 typedef enum {
     fssBegin,
index 58646d1b4ab730550ef1ac9e94bdee988f2cd534..1f3dab3cca0c526427b6e0d5a97d064b44bcb035 100644 (file)
@@ -11,7 +11,8 @@
 #include "servers/forward.h"
 #include "SquidConfig.h"
 
-namespace Http {
+namespace Http
+{
 
 /// Manages a connection from an HTTP client.
 class Server: public ConnStateData
index 50e20e5ddadc883b5054fdce5e3eb2b94fa88661..47def1d67b4f936d6d9bb5763c64e27dbef6dde9 100644 (file)
@@ -5,21 +5,24 @@ class MasterXaction;
 template <class C> class RefCount;
 typedef RefCount<MasterXaction> MasterXactionPointer;
 
-namespace Http {
+namespace Http
+{
 
 /// create a new HTTP connection handler; never returns NULL
 ConnStateData *NewServer(MasterXactionPointer &xact);
 
 } // namespace Http
 
-namespace Https {
+namespace Https
+{
 
 /// create a new HTTPS connection handler; never returns NULL
 ConnStateData *NewServer(MasterXactionPointer &xact);
 
 } // namespace Https
 
-namespace Ftp {
+namespace Ftp
+{
 
 /// accept connections on all configured ftp_ports
 void StartListening();