new version 5.0.5

This commit is contained in:
Lubos Uhliarik 2021-02-12 04:22:45 +01:00
parent 04e0b1693c
commit 5fc2c3b43c
6 changed files with 135 additions and 215 deletions

View File

@ -1,3 +1,3 @@
SHA512 (squid-4.13.tar.xz) = 06807f82ed01e12afe2dd843aa0a94f69c351765b1889c4c5c3da1cf2ecb06ac3a4be6a24a62f04397299c8fc0df5397f76f64df5422ff78b37a9382d5fdf7fc
SHA512 (squid-4.13.tar.xz.asc) = be1265376927dcb3c96ea0c8c1b0f1d6bd7e3deb0fdd38ff80030c31f53f77345a8b8564c6b8cc79d7449aa361d4bdf1ba10d02f5f08af245ee35b484977b93a
SHA512 (squid-5.0.5.tar.xz) = e0f816296d9d32fc97b98249dde077b321651dac70c212fe8eb9566003ce04f13a83665e387531e06bffbab1ec21277e3e0549a16caee426b6a749e18bf77991
SHA512 (squid-5.0.5.tar.xz.asc) = ca1b170bef9cca5afe1108e8a439282f3a19bea48d2dba42847acd1cf039d38ccc8c714e27fc9e49fe9e3027963f64e9ab19e6a358e6e038c78f85cc77657a3b
SHA512 (pgp.asc) = 09f7012030d68831dfc083d67ca63ee54ed851482ca8d0e9505b444ee3e7ddeed62369b53f2917c9b2e0e57cc0533fce46e8cafd2ebcd1c6cb186b516efd0ad2

View File

@ -6,5 +6,5 @@ index 4cb0480..4b89910 100755
-#!/usr/local/bin/perl -Tw
+#!/usr/bin/perl -Tw
#
# * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
# * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
# *

View File

@ -1,178 +0,0 @@
diff --git a/src/acl/RegexData.cc b/src/acl/RegexData.cc
index 01a4c12..b5c1679 100644
--- a/src/acl/RegexData.cc
+++ b/src/acl/RegexData.cc
@@ -22,6 +22,7 @@
#include "ConfigParser.h"
#include "Debug.h"
#include "sbuf/List.h"
+#include "sbuf/Algorithms.h"
ACLRegexData::~ACLRegexData()
{
@@ -129,6 +130,18 @@ compileRE(std::list<RegexPattern> &curlist, const char * RE, int flags)
return true;
}
+static bool
+compileRE(std::list<RegexPattern> &curlist, const SBufList &RE, int flags)
+{
+ if (RE.empty())
+ return curlist.empty(); // XXX: old code did this. It looks wrong.
+ SBuf regexp;
+ static const SBuf openparen("("), closeparen(")"), separator(")|(");
+ JoinContainerIntoSBuf(regexp, RE.begin(), RE.end(), separator, openparen,
+ closeparen);
+ return compileRE(curlist, regexp.c_str(), flags);
+}
+
/** Compose and compile one large RE from a set of (small) REs.
* The ultimate goal is to have only one RE per ACL so that match() is
* called only once per ACL.
@@ -137,16 +150,11 @@ static int
compileOptimisedREs(std::list<RegexPattern> &curlist, const SBufList &sl)
{
std::list<RegexPattern> newlist;
- int numREs = 0;
+ SBufList accumulatedRE;
+ int numREs = 0, reSize = 0;
int flags = REG_EXTENDED | REG_NOSUB;
- int largeREindex = 0;
- char largeRE[BUFSIZ];
- *largeRE = 0;
for (const SBuf & configurationLineWord : sl) {
- int RElen;
- RElen = configurationLineWord.length();
-
static const SBuf minus_i("-i");
static const SBuf plus_i("+i");
if (configurationLineWord == minus_i) {
@@ -155,10 +163,11 @@ compileOptimisedREs(std::list<RegexPattern> &curlist, const SBufList &sl)
debugs(28, 2, "optimisation of -i ... -i" );
} else {
debugs(28, 2, "-i" );
- if (!compileRE(newlist, largeRE, flags))
+ if (!compileRE(newlist, accumulatedRE, flags))
return 0;
flags |= REG_ICASE;
- largeRE[largeREindex=0] = '\0';
+ accumulatedRE.clear();
+ reSize = 0;
}
} else if (configurationLineWord == plus_i) {
if ((flags & REG_ICASE) == 0) {
@@ -166,37 +175,34 @@ compileOptimisedREs(std::list<RegexPattern> &curlist, const SBufList &sl)
debugs(28, 2, "optimisation of +i ... +i");
} else {
debugs(28, 2, "+i");
- if (!compileRE(newlist, largeRE, flags))
+ if (!compileRE(newlist, accumulatedRE, flags))
return 0;
flags &= ~REG_ICASE;
- largeRE[largeREindex=0] = '\0';
+ accumulatedRE.clear();
+ reSize = 0;
}
- } else if (RElen + largeREindex + 3 < BUFSIZ-1) {
+ } else if (reSize < 1024) {
debugs(28, 2, "adding RE '" << configurationLineWord << "'");
- if (largeREindex > 0) {
- largeRE[largeREindex] = '|';
- ++largeREindex;
- }
- largeRE[largeREindex] = '(';
- ++largeREindex;
- configurationLineWord.copy(largeRE+largeREindex, BUFSIZ-largeREindex);
- largeREindex += configurationLineWord.length();
- largeRE[largeREindex] = ')';
- ++largeREindex;
- largeRE[largeREindex] = '\0';
+ accumulatedRE.push_back(configurationLineWord);
++numREs;
+ reSize += configurationLineWord.length();
} else {
debugs(28, 2, "buffer full, generating new optimised RE..." );
- if (!compileRE(newlist, largeRE, flags))
+ accumulatedRE.push_back(configurationLineWord);
+ if (!compileRE(newlist, accumulatedRE, flags))
return 0;
- largeRE[largeREindex=0] = '\0';
+ accumulatedRE.clear();
+ reSize = 0;
continue; /* do the loop again to add the RE to largeRE */
}
}
- if (!compileRE(newlist, largeRE, flags))
+ if (!compileRE(newlist, accumulatedRE, flags))
return 0;
+ accumulatedRE.clear();
+ reSize = 0;
+
/* all was successful, so put the new list at the tail */
curlist.splice(curlist.end(), newlist);
diff --git a/src/sbuf/Algorithms.h b/src/sbuf/Algorithms.h
index 21ee889..338e9c0 100644
--- a/src/sbuf/Algorithms.h
+++ b/src/sbuf/Algorithms.h
@@ -81,6 +81,57 @@ SBufContainerJoin(const Container &items, const SBuf& separator)
return rv;
}
+/** Join container of SBufs and append to supplied target
+ *
+ * append to the target SBuf all elements in the [begin,end) range from
+ * an iterable container, prefixed by prefix, separated by separator and
+ * followed by suffix. Prefix and suffix are added also in case of empty
+ * iterable
+ *
+ * \return the modified dest
+ */
+template <class ContainerIterator>
+SBuf&
+JoinContainerIntoSBuf(SBuf &dest, const ContainerIterator &begin,
+ const ContainerIterator &end, const SBuf& separator,
+ const SBuf& prefix = SBuf(), const SBuf& suffix = SBuf())
+{
+ if (begin == end) {
+ dest.append(prefix).append(suffix);
+ return dest;
+ }
+
+ // optimization: pre-calculate needed storage
+ const SBuf::size_type totalContainerSize =
+ std::accumulate(begin, end, 0, SBufAddLength(separator)) +
+ dest.length() + prefix.length() + suffix.length();
+ SBufReservationRequirements req;
+ req.minSpace = totalContainerSize;
+ dest.reserve(req);
+
+ auto i = begin;
+ dest.append(prefix);
+ dest.append(*i);
+ ++i;
+ for (; i != end; ++i)
+ dest.append(separator).append(*i);
+ dest.append(suffix);
+ return dest;
+}
+
+
+/// convenience wrapper of JoinContainerIntoSBuf with no caller-supplied SBuf
+template <class ContainerIterator>
+SBuf
+JoinContainerToSBuf(const ContainerIterator &begin,
+ const ContainerIterator &end, const SBuf& separator,
+ const SBuf& prefix = SBuf(), const SBuf& suffix = SBuf())
+{
+ SBuf rv;
+ return JoinContainerIntoSBuf(rv, begin, end, separator, prefix, suffix);
+}
+
+
namespace std {
/// default hash functor to support std::unordered_map<SBuf,*>
template <>

View File

@ -0,0 +1,116 @@
diff --git a/src/Makefile.am b/src/Makefile.am
index 81403a7..5e2a493 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2477,6 +2477,7 @@ tests_testHttpRequest_LDADD = \
$(SSLLIB) \
$(KRB5LIBS) \
$(LIBCPPUNIT_LIBS) \
+ $(SYSTEMD_LIBS) \
$(COMPAT_LIB) \
$(XTRA_LIBS)
tests_testHttpRequest_LDFLAGS = $(LIBADD_DL)
@@ -2781,6 +2782,7 @@ tests_testCacheManager_LDADD = \
$(SSLLIB) \
$(KRB5LIBS) \
$(LIBCPPUNIT_LIBS) \
+ $(SYSTEMD_LIBS) \
$(COMPAT_LIB) \
$(XTRA_LIBS)
tests_testCacheManager_LDFLAGS = $(LIBADD_DL)
@@ -3101,6 +3103,7 @@ tests_testEvent_LDADD = \
$(SSLLIB) \
$(KRB5LIBS) \
$(LIBCPPUNIT_LIBS) \
+ $(SYSTEMD_LIBS) \
$(COMPAT_LIB) \
$(XTRA_LIBS)
tests_testEvent_LDFLAGS = $(LIBADD_DL)
@@ -3339,6 +3342,7 @@ tests_testEventLoop_LDADD = \
$(SSLLIB) \
$(KRB5LIBS) \
$(LIBCPPUNIT_LIBS) \
+ $(SYSTEMD_LIBS) \
$(COMPAT_LIB) \
$(XTRA_LIBS)
tests_testEventLoop_LDFLAGS = $(LIBADD_DL)
diff --git a/src/Makefile.in b/src/Makefile.in
index fda6de6..4e047cc 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -4581,6 +4581,7 @@ tests_test_http_range_LDADD = \
$(SSLLIB) \
$(KRB5LIBS) \
$(LIBCPPUNIT_LIBS) \
+ $(SYSTEMD_LIBS) \
$(COMPAT_LIB) \
$(XTRA_LIBS)
@@ -4972,6 +4973,7 @@ tests_testHttpRequest_LDADD = \
$(SSLLIB) \
$(KRB5LIBS) \
$(LIBCPPUNIT_LIBS) \
+ $(SYSTEMD_LIBS) \
$(COMPAT_LIB) \
$(XTRA_LIBS)
@@ -5274,6 +5276,7 @@ tests_testCacheManager_LDADD = \
$(SSLLIB) \
$(KRB5LIBS) \
$(LIBCPPUNIT_LIBS) \
+ $(SYSTEMD_LIBS) \
$(COMPAT_LIB) \
$(XTRA_LIBS)
@@ -5593,6 +5596,7 @@ tests_testEvent_LDADD = \
$(SSLLIB) \
$(KRB5LIBS) \
$(LIBCPPUNIT_LIBS) \
+ $(SYSTEMD_LIBS) \
$(COMPAT_LIB) \
$(XTRA_LIBS)
@@ -5832,6 +5836,7 @@ tests_testEventLoop_LDADD = \
$(SSLLIB) \
$(KRB5LIBS) \
$(LIBCPPUNIT_LIBS) \
+ $(SYSTEMD_LIBS) \
$(COMPAT_LIB) \
$(XTRA_LIBS)
diff --git a/src/proxyp/Parser.cc b/src/proxyp/Parser.cc
index 328d207..2f358a7 100644
--- a/src/proxyp/Parser.cc
+++ b/src/proxyp/Parser.cc
@@ -15,6 +15,7 @@
#include "sbuf/Stream.h"
#include <algorithm>
+#include <limits>
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
diff --git a/src/security/ServerOptions.cc b/src/security/ServerOptions.cc
index e114ed8..22bce84 100644
--- a/src/security/ServerOptions.cc
+++ b/src/security/ServerOptions.cc
@@ -18,6 +18,7 @@
#if USE_OPENSSL
#include "compat/openssl.h"
#include "ssl/support.h"
+#include <limits>
#if HAVE_OPENSSL_ERR_H
#include <openssl/err.h>
diff --git a/src/acl/ConnMark.cc b/src/acl/ConnMark.cc
index 1fdae0c..213cf39 100644
--- a/src/acl/ConnMark.cc
+++ b/src/acl/ConnMark.cc
@@ -15,6 +15,7 @@
#include "Debug.h"
#include "http/Stream.h"
#include "sbuf/Stream.h"
+#include <limits>
bool
Acl::ConnMark::empty() const

View File

@ -1,24 +0,0 @@
diff --git a/src/acl/ConnMark.cc b/src/acl/ConnMark.cc
index 1fdae0c..213cf39 100644
--- a/src/acl/ConnMark.cc
+++ b/src/acl/ConnMark.cc
@@ -15,6 +15,7 @@
#include "Debug.h"
#include "http/Stream.h"
#include "sbuf/Stream.h"
+#include <limits>
bool
Acl::ConnMark::empty() const
diff --git a/src/security/ServerOptions.cc b/src/security/ServerOptions.cc
index 5cd81ab..3f73892 100644
--- a/src/security/ServerOptions.cc
+++ b/src/security/ServerOptions.cc
@@ -6,6 +6,7 @@
* Please see the COPYING and CONTRIBUTORS files for details.
*/
+#include <limits>
#include "squid.h"
#include "anyp/PortCfg.h"
#include "base/Packable.h"

View File

@ -1,16 +1,16 @@
%define __perl_requires %{SOURCE98}
Name: squid
Version: 4.13
Release: 3%{?dist}
Version: 5.0.5
Release: 1%{?dist}
Summary: The Squid proxy caching server
Epoch: 7
# See CREDITS for breakdown of non GPLv2+ code
License: GPLv2+ and (LGPLv2+ and MIT and BSD and Public Domain)
URL: http://www.squid-cache.org
Source0: http://www.squid-cache.org/Versions/v4/squid-%{version}.tar.xz
Source1: http://www.squid-cache.org/Versions/v4/squid-%{version}.tar.xz.asc
Source0: http://www.squid-cache.org/Versions/v5/squid-%{version}.tar.xz
Source1: http://www.squid-cache.org/Versions/v5/squid-%{version}.tar.xz.asc
Source2: http://www.squid-cache.org/pgp.asc
Source3: squid.logrotate
Source4: squid.sysconfig
@ -32,8 +32,7 @@ Patch201: squid-4.0.11-config.patch
Patch202: squid-3.1.0.9-location.patch
Patch203: squid-3.0.STABLE1-perlpath.patch
Patch204: squid-3.5.9-include-guards.patch
Patch205: squid-4.0.21-large-acl.patch
Patch206: squid-gcc11.patch
Patch205: squid-5.0.5-build-errors.patch
# cache_swap.sh
Requires: bash gawk
@ -52,8 +51,8 @@ BuildRequires: pam-devel
BuildRequires: openssl-devel
# squid_kerb_aut requires Kerberos development libs
BuildRequires: krb5-devel
# time_quota requires DB
BuildRequires: libdb-devel
# time_quota requires TrivialDB
BuildRequires: libtdb-devel
# ESI support requires Expat & libxml2
BuildRequires: expat-devel libxml2-devel
# TPROXY requires libcap, and also increases security somewhat
@ -103,8 +102,7 @@ lookup program (dnsserver), a program for retrieving FTP data
%patch202 -p1 -b .location
%patch203 -p1 -b .perlpath
%patch204 -p0 -b .include-guards
%patch205 -p1 -b .large_acl
%patch206 -p1 -b .gcc11
%patch205 -p1 -b .build-errors
# https://bugzilla.redhat.com/show_bug.cgi?id=1679526
# Patch in the vendor documentation and used different location for documentation
@ -162,6 +160,11 @@ sed -i 's|@SYSCONFDIR@/squid.conf.documented|%{_pkgdocdir}/squid.conf.documented
--disable-strict-error-checking \
--with-swapdir=%{_localstatedir}/spool/squid
# workaround to build squid v5
mkdir -p src/icmp/tests
mkdir -p tools/squidclient/tests
mkdir -p tools/tests
%make_build
%check
@ -300,6 +303,9 @@ fi
%changelog
* Wed Feb 10 2021 Lubos Uhliarik <luhliari@redhat.com> - 7:5.0.5-1
- new version 5.0.5
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 7:4.13-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild