From: Christos Tsantilas Date: Wed, 13 Jan 2016 10:15:33 +0000 (+0200) Subject: Add connections_encrypted ACL part2: add missing files X-Git-Tag: SQUID_4_0_5~42 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=652789d8b416b9b8eb51daf3f923ec03d6f18dd1;p=thirdparty%2Fsquid.git Add connections_encrypted ACL part2: add missing files The src/acl/ConnectionsEncrypted.[cc,h] files forgotten while the patch applieded to trunk. --- diff --git a/src/acl/ConnectionsEncrypted.cc b/src/acl/ConnectionsEncrypted.cc new file mode 100644 index 0000000000..cb3200437e --- /dev/null +++ b/src/acl/ConnectionsEncrypted.cc @@ -0,0 +1,78 @@ +/* + * Copyright (C) 1996-2015 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. + */ + +/* DEBUG: section 28 Access Control */ + +#include "squid.h" +#include "acl/FilledChecklist.h" +#include "acl/ConnectionsEncrypted.h" +#include "Debug.h" +#include "HttpRequest.h" +#include "HttpReply.h" +#include "SquidConfig.h" + +ACL * +Acl::ConnectionsEncrypted::clone() const +{ + return new Acl::ConnectionsEncrypted(*this); +} + +Acl::ConnectionsEncrypted::ConnectionsEncrypted (char const *theClass) : class_ (theClass) +{} + +Acl::ConnectionsEncrypted::ConnectionsEncrypted (Acl::ConnectionsEncrypted const & old) :class_ (old.class_) +{} + +Acl::ConnectionsEncrypted::~ConnectionsEncrypted() +{} + +char const * +Acl::ConnectionsEncrypted::typeString() const +{ + return class_; +} + +bool +Acl::ConnectionsEncrypted::empty () const +{ + return false; +} + +void +Acl::ConnectionsEncrypted::parse() +{ + if (ConfigParser::strtokFile()) { + debugs(89, DBG_CRITICAL, "WARNING: connections_encrypted does not accepts any value."); + } +} + +int +Acl::ConnectionsEncrypted::match(ACLChecklist *checklist) +{ + if (!checklist->hasRequest()) { + debugs(28, DBG_IMPORTANT, "WARNING: " << name << " ACL is used in " << + "context without an HTTP request. Assuming mismatch."); + return 0; + } + + ACLFilledChecklist *filled = Filled((ACLChecklist*)checklist); + + const bool safeRequest = + !(filled->request->sources & HttpMsg::srcUnsafe); + const bool safeReply = !filled->reply || + !(filled->reply->sources & HttpMsg::srcUnsafe); + + return (safeRequest && safeReply) ? 1 : 0; +} + +SBufList +Acl::ConnectionsEncrypted::dump() const +{ + return SBufList(); +} + diff --git a/src/acl/ConnectionsEncrypted.h b/src/acl/ConnectionsEncrypted.h new file mode 100644 index 0000000000..b01a79f487 --- /dev/null +++ b/src/acl/ConnectionsEncrypted.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 1996-2015 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_ACL_CONNECTIONS_ENCRYPTED_H +#define SQUID_ACL_CONNECTIONS_ENCRYPTED_H + +#include "acl/Acl.h" +#include "acl/Checklist.h" + +namespace Acl +{ + +class ConnectionsEncrypted : public ACL +{ + MEMPROXY_CLASS(ConnectionsEncrypted); + +public: + ConnectionsEncrypted(char const *); + ConnectionsEncrypted(ConnectionsEncrypted const &); + virtual ~ConnectionsEncrypted(); + ConnectionsEncrypted &operator =(ConnectionsEncrypted const &); + + virtual ACL *clone()const; + virtual char const *typeString() const; + virtual void parse(); + virtual int match(ACLChecklist *checklist); + virtual SBufList dump() const; + virtual bool empty () const; + +protected: + static Prototype RegistryProtoype; + static ConnectionsEncrypted RegistryEntry_; + char const *class_; +}; + +} // namespace Acl + +#endif /* SQUID_ACL_CONNECTIONS_ENCRYPTED_H */ +