]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Squid-dev review comments by Alex and Amos
authorChristos Tsantilas <chtsanti@users.sourceforge.net>
Fri, 15 Jul 2016 11:05:34 +0000 (14:05 +0300)
committerChristos Tsantilas <chtsanti@users.sourceforge.net>
Fri, 15 Jul 2016 11:05:34 +0000 (14:05 +0300)
13 files changed:
src/Downloader.cc
src/Downloader.h
src/HttpRequest.h
src/Makefile.am
src/base/AsyncJob.cc
src/client_side_reply.cc
src/client_side_request.cc
src/security/Handshake.cc
src/security/forward.h
src/ssl/PeerConnector.cc
src/ssl/bio.h
src/ssl/support.cc
src/ssl/support.h

index 901b2559a874bd2545b92966a0e6fe1db848077f..cdad7d9db6bf9defe31787f462e56411a822bdc4 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
 #include "squid.h"
 #include "client_side.h"
 #include "client_side_request.h"
 #include "http/one/RequestParser.h"
 #include "http/Stream.h"
 
+CBDATA_CLASS_INIT(Downloader);
+
 /// Used to hold and pass the required info and buffers to the
 /// clientStream callbacks
 class DownloaderContext: public RefCountable
 {
-    CBDATA_CLASS(DownloaderContext);
+    MEMPROXY_CLASS(DownloaderContext);
 
 public:
     typedef RefCount<DownloaderContext> Pointer;
 
-    DownloaderContext(Downloader *dl, ClientHttpRequest *h):
-        downloader(cbdataReference(dl)),
-        http(h)
-        {}
+    DownloaderContext(Downloader *dl, ClientHttpRequest *h);
     ~DownloaderContext();
     void finished();
-    Downloader* downloader;
+
+    CbcPointer<Downloader> downloader;
     ClientHttpRequest *http;
     char requestBuffer[HTTP_REQBUF_SZ];
 };
 
-CBDATA_CLASS_INIT(DownloaderContext);
-CBDATA_CLASS_INIT(Downloader);
+DownloaderContext::DownloaderContext(Downloader *dl, ClientHttpRequest *h):
+    downloader(dl),
+    http(h)
+{
+    debugs(33, 6, "DownloaderContext constructed, this=" << (void*)this);
+}
 
 DownloaderContext::~DownloaderContext()
 {
-    debugs(33, 5, HERE);
-    cbdataReferenceDone(downloader);
+    debugs(33, 6, "DownloaderContext destructed, this=" << (void*)this);
     if (http)
         finished();
 }
@@ -42,36 +53,34 @@ void
 DownloaderContext::finished()
 {
     delete http;
-    http = NULL;
+    http = nullptr;
 }
 
 Downloader::Downloader(SBuf &url, AsyncCall::Pointer &aCallback, unsigned int level):
     AsyncJob("Downloader"),
     url_(url),
-    callback(aCallback),
-    status(Http::scNone),
+    callback_(aCallback),
     level_(level)
 {
 }
 
 Downloader::~Downloader()
 {
-    debugs(33 , 2, HERE);
 }
 
 bool
 Downloader::doneAll() const
 {
-    return (!callback || callback->canceled()) && AsyncJob::doneAll();
+    return (!callback_ || callback_->canceled()) && AsyncJob::doneAll();
 }
 
 static void
 downloaderRecipient(clientStreamNode * node, ClientHttpRequest * http,
                     HttpReply * rep, StoreIOBuffer receivedData)
 {
-    debugs(33, 6, HERE);
+    debugs(33, 6, MYNAME);
      /* Test preconditions */
-    assert(node != NULL);
+    assert(node);
 
     /* TODO: handle this rather than asserting
      * - it should only ever happen if we cause an abort and
@@ -79,33 +88,32 @@ downloaderRecipient(clientStreamNode * node, ClientHttpRequest * http,
      * However, that itself shouldn't happen, so it stays as an assert for now.
      */
     assert(cbdataReferenceValid(node));
-    assert(node->node.next == NULL);
+    assert(!node->node.next);
     DownloaderContext::Pointer context = dynamic_cast<DownloaderContext *>(node->data.getRaw());
-    assert(context != NULL);
+    assert(context);
 
-    if (!cbdataReferenceValid(context->downloader))
-        return;
-
-    context->downloader->handleReply(node, http, rep, receivedData);
+    if (context->downloader.valid())
+        context->downloader->handleReply(node, http, rep, receivedData);
 }
 
 static void
 downloaderDetach(clientStreamNode * node, ClientHttpRequest * http)
 {
-    debugs(33, 5, HERE);
+    debugs(33, 5, MYNAME);
     clientStreamDetach(node, http);
 }
 
+/// Initializes and starts the HTTP GET request to the remote server
 bool
 Downloader::buildRequest()
 { 
     const HttpRequestMethod method = Http::METHOD_GET;
 
-    char *uri = strdup(url_.c_str());
+    char *uri = xstrdup(url_.c_str());
     HttpRequest *const request = HttpRequest::CreateFromUrl(uri, method);
     if (!request) {
-        debugs(33, 5, "Invalid FTP URL: " << uri);
-        safe_free(uri);
+        debugs(33, 5, "Invalid URI: " << url_);
+        xfree(uri);
         return false; //earlyError(...)
     }
     request->http_ver = Http::ProtocolVersion();
@@ -120,7 +128,12 @@ Downloader::buildRequest()
     request->my_addr.port(0);
     request->downloader = this;
 
-    ClientHttpRequest *const http = new ClientHttpRequest(NULL);
+    debugs(11, 2, "HTTP Client Downloader " << this << "/" << id);
+    debugs(11, 2, "HTTP Client REQUEST:\n---------\n" <<
+           request->method << " " << url_ << " " << request->http_ver << "\n" <<
+           "\n----------");
+
+    ClientHttpRequest *const http = new ClientHttpRequest(nullptr);
     http->request = request;
     HTTPMSGLOCK(http->request);
     http->req_sz = 0;
@@ -139,14 +152,6 @@ Downloader::buildRequest()
 
     // Build a ClientRequestContext to start doCallouts
     http->calloutContext = new ClientRequestContext(http);
-
-    // Do not check for redirect, tos,nfmark and sslBump
-    http->calloutContext->redirect_done = true;
-    http->calloutContext->tosToClientDone = true;
-    http->calloutContext->nfmarkToClientDone = true;
-    http->calloutContext->sslBumpCheckDone = true;
-    http->al->ssl.bumpMode = Ssl::bumpEnd; // SslBump does not apply; log -
-
     http->doCallouts();
     return true;
 }
@@ -154,63 +159,65 @@ Downloader::buildRequest()
 void
 Downloader::start()
 {
-    if (!buildRequest()) {
-        status = Http::scInternalServerError;
-        callBack();
-    }
+    if (!buildRequest())
+        callBack(Http::scInternalServerError);
 }
 
 void
 Downloader::handleReply(clientStreamNode * node, ClientHttpRequest *http, HttpReply *reply, StoreIOBuffer receivedData)
 {
-    // TODO: remove the following check:
     DownloaderContext::Pointer callerContext = dynamic_cast<DownloaderContext *>(node->data.getRaw());
+    // TODO: remove the following check:
     assert(callerContext == context_);
 
-    bool existingContent = reply ? reply->content_length : 0;
-    bool exceedSize = (existingContent > -1 && (size_t)existingContent > MaxObjectSize) || 
-        ((object.length() + receivedData.length) > MaxObjectSize);
+    debugs(33, 4, "Received " << receivedData.length <<
+           " object data, offset: " << receivedData.offset <<
+           " error flag:" << receivedData.flags.error);
 
-    if (exceedSize) {
-        status = Http::scInternalServerError;
-        callBack();
+    const bool failed = receivedData.flags.error;
+    if (failed) {
+        callBack(Http::scInternalServerError);
         return;
     }
 
-    debugs(33, 4, "Received " << receivedData.length <<
-           " object data, offset: " << receivedData.offset <<
-           " error flag:" << receivedData.flags.error);
+    const int64_t existingContent = reply ? reply->content_length : 0;
+    const size_t maxSize = MaxObjectSize > SBuf::maxSize ? SBuf::maxSize : MaxObjectSize;
+    const bool tooLarge = (existingContent > -1 && existingContent > static_cast<int64_t>(maxSize)) ||
+                          (maxSize < object_.length()) ||
+                          ((maxSize - object_.length()) < receivedData.length);
+
+    if (tooLarge) {
+        callBack(Http::scInternalServerError);
+        return;
+    }
 
-    if (receivedData.length > 0) {
-        object.append(receivedData.data, receivedData.length);
+    if (receivedData.length) {
+        object_.append(receivedData.data, receivedData.length);
         http->out.size += receivedData.length;
         http->out.offset += receivedData.length;
     }
 
-    switch (clientStreamStatus (node, http)) {
+    switch (clientStreamStatus(node, http)) {
     case STREAM_NONE: {
-        debugs(33, 3, HERE << "Get more data");
+        debugs(33, 3, "Get more data");
         StoreIOBuffer tempBuffer;
         tempBuffer.offset = http->out.offset;
         tempBuffer.data = context_->requestBuffer;
         tempBuffer.length = HTTP_REQBUF_SZ;
-        clientStreamRead (node, http, tempBuffer);
+        clientStreamRead(node, http, tempBuffer);
     }
         break;
     case STREAM_COMPLETE:
-        debugs(33, 3, HERE << "Object data transfer successfully complete");
-        status = Http::scOkay;
-        callBack();
+        debugs(33, 3, "Object data transfer successfully complete");
+        callBack(Http::scOkay);
         break;
     case STREAM_UNPLANNED_COMPLETE:
-        debugs(33, 3, HERE << "Object data transfer failed: STREAM_UNPLANNED_COMPLETE");
-        status = Http::scInternalServerError;
-        callBack();
+        debugs(33, 3, "Object data transfer failed: STREAM_UNPLANNED_COMPLETE");
+        callBack(Http::scInternalServerError);
         break;
     case STREAM_FAILED:
-        debugs(33, 3, HERE << "Object data transfer failed: STREAM_FAILED");
-        status = Http::scInternalServerError;
-        callBack();
+        debugs(33, 3, "Object data transfer failed: STREAM_FAILED");
+        callBack(Http::scInternalServerError);
         break;
     default:
         fatal("unreachable code");
@@ -221,29 +228,34 @@ void
 Downloader::downloadFinished()
 {
     debugs(33, 7, this);
+    // We cannot delay http destruction until refcounting deletes 
+    // DownloaderContext. The http object destruction will cause 
+    // clientStream cleanup and will release the refcount to context_
+    // object hold by clientStream structures.
     context_->finished();
-    context_ = NULL;
+    context_ = nullptr;
     Must(done());
-    // Not really needed. Squid will delete this object because "doneAll" is true.
-    //deleteThis("completed");
 }
 
+/// Schedules for execution the "callback" with parameters the status
+/// and object.
 void
-Downloader::callBack()
+Downloader::callBack(Http::StatusCode const statusCode)
 {
-     CbDialer *dialer = dynamic_cast<CbDialer*>(callback->getDialer());
+     CbDialer *dialer = dynamic_cast<CbDialer*>(callback_->getDialer());
      Must(dialer);
-     dialer->status = status;
-     if (status == Http::scOkay)
-         dialer->object = object;
-     ScheduleCallHere(callback);
-     callback = nullptr;
+     dialer->status = statusCode;
+     if (statusCode == Http::scOkay)
+         dialer->object = object_;
+     ScheduleCallHere(callback_);
+     callback_ = nullptr;
+
      // Calling deleteThis method here to finish Downloader
      // may result to squid crash.
      // This method called by handleReply method which maybe called
      // by ClientHttpRequest::doCallouts. The doCallouts after this object
      // deleted, may operate on non valid objects.
-     // Schedule a fake call here just to force squid to delete this object.
+     // Schedule an async call here just to force squid to delete this object.
      CallJobHere(33, 7, CbcPointer<Downloader>(this), Downloader, downloadFinished);
 }
 
index 4d6546252dd6ca34a4a736ef9463e8ce6b42f15f..b409dfa0ff1cc480d7728bd1138baf1b2aef56ab 100644 (file)
@@ -1,17 +1,23 @@
+/*
+ * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
 #ifndef SQUID_DOWNLOADER_H
 #define SQUID_DOWNLOADER_H
 
-#include "base/AsyncCall.h"
 #include "base/AsyncJob.h"
-#include "cbdata.h"
 #include "defines.h"
+#include "http/forward.h"
 #include "http/StatusCode.h"
 #include "sbuf/SBuf.h"
 
 class ClientHttpRequest;
 class StoreIOBuffer;
 class clientStreamNode;
-class HttpReply;
 class DownloaderContext;
 typedef RefCount<DownloaderContext> DownloaderContextPointer;
 
@@ -36,37 +42,31 @@ public:
     Downloader(SBuf &url, AsyncCall::Pointer &aCallback, unsigned int level = 0);
     virtual ~Downloader();
 
-    /// Fake call used internally by Downloader.
+    /// delays destruction to protect doCallouts()
     void downloadFinished();
 
     /// The nested level of Downloader object (downloads inside downloads).
     unsigned int nestedLevel() const {return level_;}
     
-    /* AsyncJob API */
-    virtual bool doneAll() const;
+    void handleReply(clientStreamNode *, ClientHttpRequest *, HttpReply *, StoreIOBuffer);
 
-    void handleReply(clientStreamNode * node, ClientHttpRequest *http, HttpReply *header, StoreIOBuffer receivedData);
 protected:
 
     /* AsyncJob API */
+    virtual bool doneAll() const;
     virtual void start();
 
 private:
 
-    /// Initializes and starts the HTTP GET request to the remote server
     bool buildRequest();
-
-    /// Schedules for execution the "callback" with parameters the status
-    /// and object.
-    void callBack();
+    void callBack(Http::StatusCode const status);
 
     /// The maximum allowed object size.
     static const size_t MaxObjectSize = 1*1024*1024;
 
     SBuf url_; ///< the url to download
-    AsyncCall::Pointer callback; ///< callback to call when download finishes
-    Http::StatusCode status; ///< the download status code
-    SBuf object; ///< the object body data
+    AsyncCall::Pointer callback_; ///< callback to call when download finishes
+    SBuf object_; ///< the object body data
     const unsigned int level_; ///< holds the nested downloads level
 
     /// Pointer to an object that stores the clientStream required info
index 66422d1fd84f60c67c8738e18f2669a2ca4895de..8d9702ac58beda98f3e51b990a4eefeb06f2cf92 100644 (file)
@@ -213,7 +213,7 @@ public:
      */
     CbcPointer<ConnStateData> clientConnectionManager;
 
-    /// The Downloader object intiated the HTTP request if exist
+    /// The Downloader object which initiated the HTTP request if any
     CbcPointer<Downloader> downloader;
 
     /// forgets about the cached Range header (for a reason)
index 8408005aa19242b55caec917bcd10ea0fcf8d0ff..acdfd990732d5d50b7c3b0214351f993564f5ddc 100644 (file)
@@ -272,8 +272,8 @@ squid_SOURCES = \
        dlink.h \
        dlink.cc \
        $(DNSSOURCE) \
-       Downloader.h \
        Downloader.cc \
+       Downloader.h \
        enums.h \
        err_type.h \
        err_detail_type.h \
index b79edf64258b9f57ad54c8e60153766fc7f8dce0..96f110183a432d21aabbcf3f46675f8395d6fb70 100644 (file)
@@ -126,7 +126,7 @@ void AsyncJob::callStart(AsyncCall &call)
 void
 AsyncJob::callException(const std::exception &ex)
 {
-    debugs(93 , 2, ex.what());
+    debugs(93, 2, ex.what());
     // we must be called asynchronously and hence, the caller must lock us
     Must(cbdataReferenceValid(toCbdata()));
 
index ccd279ebd62a34025730cfe74762a2642826b438..eccb6b56222ca5036afbfaca5e9c48ce614725e2 100644 (file)
@@ -2131,7 +2131,7 @@ clientReplyContext::sendMoreData (StoreIOBuffer result)
             return;
         }
 
-        if (reqofs==0 && !http->logType.isTcpHit() && Comm::IsConnOpen(conn->clientConnection)) {
+        if (reqofs==0 && !http->logType.isTcpHit()) {
             if (Ip::Qos::TheConfig.isHitTosActive()) {
                 Ip::Qos::doTosLocalMiss(conn->clientConnection, http->request->hier.code);
             }
@@ -2140,8 +2140,7 @@ clientReplyContext::sendMoreData (StoreIOBuffer result)
             }
         }
 
-        debugs(88, 5, "clientReplyContext::sendMoreData:" <<
-               conn->clientConnection <<
+        debugs(88, 5, conn->clientConnection <<
                " '" << entry->url() << "'" <<
                " out.offset=" << http->out.offset);
     }
index 87e9aa7c88a379ad666174bce1b2bd55705d3391..f269b533ecad2f83b151de5ef1d325b830142cf3 100644 (file)
@@ -1409,6 +1409,11 @@ ClientRequestContext::checkNoCacheDone(const allow_t &answer)
 bool
 ClientRequestContext::sslBumpAccessCheck()
 {
+    if (!http->getConn()) {
+        http->al->ssl.bumpMode = Ssl::bumpEnd; // SslBump does not apply; log -
+        return false;
+    }
+
     // If SSL connection tunneling or bumping decision has been made, obey it.
     const Ssl::BumpMode bumpMode = http->getConn()->sslBumpMode;
     if (bumpMode != Ssl::bumpEnd) {
index 7dfc7cc04f6976bc6ef150d7e3a7ec1e7c14277d..c664f41f48e622a66c6fc0ffb865b49c9c9761b1 100644 (file)
@@ -539,14 +539,12 @@ void
 Security::HandshakeParser::ParseCertificate(const SBuf &raw, Security::CertPointer &pCert)
 {
 #if USE_OPENSSL
-    typedef const unsigned char *x509Data;
-    const x509Data x509Start = reinterpret_cast<x509Data>(raw.rawContent());
-    x509Data x509Pos = x509Start;
+    auto x509Start = reinterpret_cast<const unsigned char *>(raw.rawContent());
+    auto x509Pos = x509Start;
     X509 *x509 = d2i_X509(nullptr, &x509Pos, raw.length());
     Must(x509); // successfully parsed
     Must(x509Pos == x509Start + raw.length()); // no leftovers
     pCert.resetAndLock(x509);
-#else
 #endif
 }
 
index e14f475a0f514a0c51191ea34181dbbc427a07e1..70e03e22d6666ee800913e7989944ad44120f80f 100644 (file)
@@ -56,10 +56,10 @@ typedef Security::LockingPointer<struct gnutls_x509_crl_int, gnutls_x509_crl_dei
 typedef void *CrlPointer;
 #endif
 
-typedef std::list<Security::CrlPointer> CertRevokeList;
-
 typedef std::list<Security::CertPointer> CertList;
 
+typedef std::list<Security::CrlPointer> CertRevokeList;
+
 #if USE_OPENSSL
 CtoCpp1(DH_free, DH *);
 typedef Security::LockingPointer<DH, DH_free_cpp, CRYPTO_LOCK_DH> DhePointer;
index abdf5cfc57b0d73a72d0c2ba22d6d6478198f3a8..7efdc25aced065a24d2b67265d5cfee4880436f0 100644 (file)
@@ -550,7 +550,7 @@ Ssl::PeerConnector::startCertDownloading(SBuf &url)
 void
 Ssl::PeerConnector::certDownloadingDone(SBuf &obj, int downloadStatus)
 {
-    certsDownloads++;
+    ++certsDownloads;
     debugs(81, 5, "Certificate downloading status: " << downloadStatus << " certificate size: " << obj.length());
 
     // get ServerBio from SSL object
@@ -571,7 +571,8 @@ Ssl::PeerConnector::certDownloadingDone(SBuf &obj, int downloadStatus)
         Ssl::SSL_add_untrusted_cert(ssl, cert);
     }
 
-    // check if has uri to download from and if yes add it to urlsOfMissingCerts
+    // Check if there are URIs to download from and if yes start downloading
+    // the first in queue.
     if (urlsOfMissingCerts.size() && certsDownloads <= MaxCertsDownloads) {
         startCertDownloading(urlsOfMissingCerts.front());
         urlsOfMissingCerts.pop();
@@ -583,7 +584,7 @@ Ssl::PeerConnector::certDownloadingDone(SBuf &obj, int downloadStatus)
 }
 
 bool
-Ssl::PeerConnector::checkForMissingCertificates ()
+Ssl::PeerConnector::checkForMissingCertificates()
 {
     // Check for nested SSL certificates downloads. For example when the
     // certificate located in an SSL site which requires to download a
@@ -591,7 +592,7 @@ Ssl::PeerConnector::checkForMissingCertificates ()
 
     // XXX: find a way to link HttpRequest with Downloader.
     // The following always fails:
-    const Downloader *csd = dynamic_cast<const Downloader*>(request->downloader.valid());
+    const Downloader *csd = request->downloader.get();
     if (csd && csd->nestedLevel() >= MaxNestedDownloads)
         return false;
 
index ef4d0ba7afa8b7666a1fd3509fe886e891c96c39..f5612aefaafde0e08b0808fc1326876caa53425d 100644 (file)
@@ -152,12 +152,13 @@ public:
     void mode(Ssl::BumpMode m) {bumpMode_ = m;}
     Ssl::BumpMode bumpMode() {return bumpMode_;} ///< return the bumping mode
 
-    /// Return true if the Server hello message received
+    /// \retval true if the Server hello message received
     bool gotHello() const { return (parsedHandshake && !parseError); }
 
     /// Return true if the Server Hello parsing failed
     bool gotHelloFailed() const { return (parsedHandshake && parseError); }
 
+    /// \return the server certificates list if received and parsed correctly
     const Security::CertList &serverCertificatesIfAny() { return parser_.serverCertificates; }
 
     /// \return the TLS Details advertised by TLS server.
index 1bb7debe2b258ee6bcf32a7c88ecff6628b445b9..f064bad23db6977d1dba28db7958213d9a834d4c 100644 (file)
@@ -1100,7 +1100,7 @@ hasAuthorityInfoAccessCaIssuers(X509 *cert)
     AUTHORITY_INFO_ACCESS *info;
     if (!cert)
         return nullptr;
-    info = (AUTHORITY_INFO_ACCESS *)X509_get_ext_d2i(cert, NID_info_access, NULL, NULL);
+    info = static_cast<AUTHORITY_INFO_ACCESS *>(X509_get_ext_d2i(cert, NID_info_access, NULL, NULL));
     if (!info)
         return nullptr;
 
@@ -1111,7 +1111,7 @@ hasAuthorityInfoAccessCaIssuers(X509 *cert)
         ACCESS_DESCRIPTION *ad = sk_ACCESS_DESCRIPTION_value(info, i);
         if (OBJ_obj2nid(ad->method) == NID_ad_ca_issuers) {
             if (ad->location->type == GEN_URI) {
-                xstrncpy(uri, (char *)ASN1_STRING_data(ad->location->d.uniformResourceIdentifier), sizeof(uri));
+                xstrncpy(uri, reinterpret_cast<char *>(ASN1_STRING_data(ad->location->d.uniformResourceIdentifier)), sizeof(uri));
             }
             break;
         }
@@ -1185,7 +1185,6 @@ Ssl::uriOfIssuerIfMissing(X509 *cert, Security::CertList const &serverCertificat
             // and issuer not found in local untrusted certificates database 
             if (const char *issuerUri = hasAuthorityInfoAccessCaIssuers(cert)) {
                 // There is a URI where we can download a certificate.
-                // Check to see if this is required.
                 return issuerUri;
             }
         }
@@ -1199,8 +1198,8 @@ Ssl::missingChainCertificatesUrls(std::queue<SBuf> &URIs, Security::CertList con
     if (!serverCertificates.size())
         return;
 
-    for (Security::CertList::const_iterator it = serverCertificates.begin(); it != serverCertificates.end(); ++it) {
-        if (const char *issuerUri = uriOfIssuerIfMissing(it->get(), serverCertificates))
+    for (const auto &i : serverCertificates) {
+        if (const char *issuerUri = uriOfIssuerIfMissing(i.get(), serverCertificates))
             URIs.push(SBuf(issuerUri));
     }
 }
@@ -1270,7 +1269,7 @@ untrustedToStoreCtx_cb(X509_STORE_CTX *ctx,void *data)
 {
     debugs(83, 4,  "Try to use pre-downloaded intermediate certificates\n");
 
-    SSL *ssl = (SSL *)X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx());
+    SSL *ssl = static_cast<SSL *>(X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx()));
     STACK_OF(X509) *sslUntrustedStack = static_cast <STACK_OF(X509) *>(SSL_get_ex_data(ssl, ssl_ex_index_ssl_untrusted_chain));
 
     // OpenSSL already maintains ctx->untrusted but we cannot modify
index dec887acb5c03438d569b5fc7d8f844de39a11a5..bbe655adeafb121e5226d703c7ee5f6131ee63bf 100644 (file)
@@ -187,27 +187,23 @@ inline const char *bumpMode(int bm)
 typedef std::multimap<SBuf, X509 *> CertsIndexedList;
 
 /**
- \ingroup ServerProtocolSSLAPI
  * Load PEM-encoded certificates from the given file.
  */
 bool loadCerts(const char *certsFile, Ssl::CertsIndexedList &list);
 
 /**
- \ingroup ServerProtocolSSLAPI
  * Load PEM-encoded certificates to the squid untrusteds certificates
  * internal DB from the given file.
  */
 bool loadSquidUntrusted(const char *path);
 
 /**
- \ingroup ServerProtocolSSLAPI
  * Removes all certificates from squid untrusteds certificates
  * internal DB and frees all memory
  */
 void unloadSquidUntrusted();
 
 /**
- \ingroup ServerProtocolSSLAPI
  * Add the certificate cert to ssl object untrusted certificates.
  * Squid uses an attached to SSL object list of untrusted certificates,
  * with certificates which can be used to complete incomplete chains sent
@@ -216,14 +212,12 @@ void unloadSquidUntrusted();
 void SSL_add_untrusted_cert(SSL *ssl, X509 *cert);
 
 /**
- \ingroup ServerProtocolSSLAPI
  * Searches in serverCertificates list for the cert issuer and if not found
  * and Authority Info Access of cert provides a URI return it.
  */
 const char *uriOfIssuerIfMissing(X509 *cert,  Security::CertList const &serverCertificates);
 
 /**
- \ingroup ServerProtocolSSLAPI
  * Fill URIs queue with the uris of missing certificates from serverCertificate chain
  * if this information provided by Authority Info Access.
  */
@@ -325,13 +319,6 @@ void addChainToSslContext(Security::ContextPtr sslContext, STACK_OF(X509) *certL
  */
 void useSquidUntrusted(SSL_CTX *sslContext);
 
-/**
-  \ingroup ServerProtocolSSLAPI
-  * Configures sslContext to use squid untrusted certificates internal list
-  * to complete certificate chains when verifies SSL servers certificates.
- */
-void useSquidUntrusted(SSL_CTX *sslContext);
-
 /**
  \ingroup ServerProtocolSSLAPI
  *  Read certificate, private key and any certificates which must be chained from files.