]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Add connections_encrypted ACL part2: add missing files
authorChristos Tsantilas <chtsanti@users.sourceforge.net>
Wed, 13 Jan 2016 10:15:33 +0000 (12:15 +0200)
committerChristos Tsantilas <chtsanti@users.sourceforge.net>
Wed, 13 Jan 2016 10:15:33 +0000 (12:15 +0200)
The src/acl/ConnectionsEncrypted.[cc,h] files forgotten while the patch
applieded to trunk.

src/acl/ConnectionsEncrypted.cc [new file with mode: 0644]
src/acl/ConnectionsEncrypted.h [new file with mode: 0644]

diff --git a/src/acl/ConnectionsEncrypted.cc b/src/acl/ConnectionsEncrypted.cc
new file mode 100644 (file)
index 0000000..cb32004
--- /dev/null
@@ -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 (file)
index 0000000..b01a79f
--- /dev/null
@@ -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 */
+