]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Updated "make check" support:
authorserassio <>
Sun, 18 Dec 2005 16:23:39 +0000 (16:23 +0000)
committerserassio <>
Sun, 18 Dec 2005 16:23:39 +0000 (16:23 +0000)
- Added Negotiate schema support
- Allow 'make check' with --enable-ssl
- Updated new HttpReply class usage

src/Makefile.am
src/Makefile.in
src/auth/negotiate/auth_negotiate.h
src/auth/ntlm/auth_ntlm.h
src/tests/stub_HttpReply.cc
src/tests/testAuth.cc
src/tests/testAuth.h
src/tests/testCoss.cc
src/tests/testNull.cc
src/tests/testUfs.cc

index 5b3eb82c96906bbc8a8df4a27d0862a5c20872a9..4f2d9deeee4de8a9350c24bb3ae8fed5e5fe66f3 100644 (file)
@@ -1,7 +1,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.am,v 1.121 2005/12/15 22:25:24 hno Exp $
+#  $Id: Makefile.am,v 1.122 2005/12/18 09:23:39 serassio Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -1045,7 +1045,8 @@ tests_testStore_SOURCES= tests/testStore.cc \
 
 tests_testStore_LDADD= \
        -L../lib -lmiscutil \
-       @SQUID_CPPUNIT_LA@
+       @SQUID_CPPUNIT_LA@ \
+       @SSLLIB@
 tests_testStore_LDFLAGS = $(LIBADD_DL)
 tests_testStore_DEPENDENCIES = $(top_builddir)/lib/libmiscutil.a \
        @SQUID_CPPUNIT_LA@
@@ -1105,7 +1106,8 @@ tests_testUfs_SOURCES= tests/testUfs.cc \
        tests/testUfs.h \
        $(SWAP_TEST_SOURCES)
 tests_testUfs_LDADD= \
-       $(SWAP_TEST_LDADD)
+       $(SWAP_TEST_LDADD) \
+       @SSLLIB@
 tests_testUfs_LDFLAGS = $(LIBADD_DL)
 tests_testUfs_DEPENDENCIES = \
        $(SWAP_TEST_DS)
@@ -1115,7 +1117,8 @@ tests_testCoss_SOURCES= tests/testCoss.cc \
        tests/testCoss.h \
        $(SWAP_TEST_SOURCES)
 tests_testCoss_LDADD= \
-       $(SWAP_TEST_LDADD)
+       $(SWAP_TEST_LDADD) \
+       @SSLLIB@
 tests_testCoss_LDFLAGS = $(LIBADD_DL)
 tests_testCoss_DEPENDENCIES = \
        $(SWAP_TEST_DS)
@@ -1125,7 +1128,8 @@ tests_testNull_SOURCES= tests/testNull.cc \
        tests/testNull.h \
        $(SWAP_TEST_SOURCES)
 tests_testNull_LDADD= \
-       $(SWAP_TEST_LDADD)
+       $(SWAP_TEST_LDADD) \
+       @SSLLIB@
 tests_testNull_LDFLAGS = $(LIBADD_DL)
 tests_testNull_DEPENDENCIES = \
        $(SWAP_TEST_DS)
index 764114ccf76a485d4c83cf4dc984565384993290..5f2348f698ae302606367b04f1e4e167d6ec2198 100644 (file)
@@ -17,7 +17,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.358 2005/12/16 01:10:45 hno Exp $
+#  $Id: Makefile.in,v 1.359 2005/12/18 09:23:39 serassio Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -1576,7 +1576,8 @@ tests_testStore_SOURCES = tests/testStore.cc \
 
 tests_testStore_LDADD = \
        -L../lib -lmiscutil \
-       @SQUID_CPPUNIT_LA@
+       @SQUID_CPPUNIT_LA@ \
+       @SSLLIB@
 
 tests_testStore_LDFLAGS = $(LIBADD_DL)
 tests_testStore_DEPENDENCIES = $(top_builddir)/lib/libmiscutil.a \
@@ -1639,7 +1640,8 @@ tests_testUfs_SOURCES = tests/testUfs.cc \
        $(SWAP_TEST_SOURCES)
 
 tests_testUfs_LDADD = \
-       $(SWAP_TEST_LDADD)
+       $(SWAP_TEST_LDADD) \
+       @SSLLIB@
 
 tests_testUfs_LDFLAGS = $(LIBADD_DL)
 tests_testUfs_DEPENDENCIES = \
@@ -1651,7 +1653,8 @@ tests_testCoss_SOURCES = tests/testCoss.cc \
        $(SWAP_TEST_SOURCES)
 
 tests_testCoss_LDADD = \
-       $(SWAP_TEST_LDADD)
+       $(SWAP_TEST_LDADD) \
+       @SSLLIB@
 
 tests_testCoss_LDFLAGS = $(LIBADD_DL)
 tests_testCoss_DEPENDENCIES = \
@@ -1663,7 +1666,8 @@ tests_testNull_SOURCES = tests/testNull.cc \
        $(SWAP_TEST_SOURCES)
 
 tests_testNull_LDADD = \
-       $(SWAP_TEST_LDADD)
+       $(SWAP_TEST_LDADD) \
+       @SSLLIB@
 
 tests_testNull_LDFLAGS = $(LIBADD_DL)
 tests_testNull_DEPENDENCIES = \
index 488a5cc6f18d2abd04ce6c66dc357b2f3192db9f..c88dedc5ea2925b198dbb93771076390fe22ab9a 100644 (file)
@@ -12,6 +12,8 @@
 
 #define DefaultAuthenticateChildrenMax  32     /* 32 processes */
 
+#ifndef __AUTH_AUTHENTICATE_STATE_T__
+#define __AUTH_AUTHENTICATE_STATE_T__
 typedef enum {
     AUTHENTICATE_STATE_NONE,
     AUTHENTICATE_STATE_INITIAL,
@@ -31,6 +33,7 @@ typedef struct
 }
 
 authenticateStateData;
+#endif
 
 class NegotiateUser : public AuthUser
 {
index 7606ed30b86656ad60c31c04c0a334c1185a0bbe..4df71aa456e6014e08687d6d03f0995948420ad1 100644 (file)
@@ -12,6 +12,8 @@
 
 #define DefaultAuthenticateChildrenMax  32     /* 32 processes */
 
+#ifndef __AUTH_AUTHENTICATE_STATE_T__
+#define __AUTH_AUTHENTICATE_STATE_T__
 typedef enum {
     AUTHENTICATE_STATE_NONE,
     AUTHENTICATE_STATE_INITIAL,
@@ -31,6 +33,7 @@ typedef struct
 }
 
 authenticateStateData;
+#endif
 
 class NTLMUser : public AuthUser
 {
index 097e8c76d3bc6cf2f8253df668c83d69e0529582..25dba02c0b460b02dffdd4433c9f71ba612c16f0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: stub_HttpReply.cc,v 1.1 2005/01/03 16:08:27 robertc Exp $
+ * $Id: stub_HttpReply.cc,v 1.2 2005/12/18 09:23:40 serassio Exp $
  *
  * DEBUG: section 84    Helper process maintenance
  * AUTHOR: Robert Collins
 #include "HttpReply.h"
 
 void
-httpReplyAbsorb(HttpReply * rep, HttpReply * new_rep)
+HttpReply::absorb(HttpReply * new_rep)
 {
     fatal ("Not implemented");
 }
 
 void
-httpReplySetHeaders(HttpReply * rep, HttpVersion ver, http_status status,
-                    const char *reason, const char *ctype, int clen, time_t lmt, time_t expires)
+HttpReply::setHeaders(HttpVersion ver, http_status status, const char *reason,
+                      const char *ctype, int clen, time_t lmt, time_t expires)
 {
     fatal ("Not implemented");
 }
 
 void
-httpReplyPackHeadersInto(const HttpReply * rep, Packer * p)
+HttpReply::packHeadersInto(Packer * p) const
 {
     fatal ("Not implemented");
 }
 
-void
-httpReplyReset(HttpReply * rep)
+void HttpReply::reset()
 {
     fatal ("Not implemented");
 }
index 1a9638dd8a6db795964f7100bde66570814808d7..04361791374b9d15fa746c2f483bcaf0ffab4ede 100644 (file)
@@ -14,6 +14,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION( testAuthUserRequest );
 CPPUNIT_TEST_SUITE_REGISTRATION( testAuthBasicUserRequest );
 CPPUNIT_TEST_SUITE_REGISTRATION( testAuthDigestUserRequest );
 CPPUNIT_TEST_SUITE_REGISTRATION( testAuthNTLMUserRequest );
+CPPUNIT_TEST_SUITE_REGISTRATION( testAuthNegotiateUserRequest );
 
 /* Instantiate all auth framework types */
 void
@@ -34,10 +35,11 @@ find_proxy_auth(char const *type)
     char const * proxy_auths[][2]= { {"basic","Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="},
 
                                      {"digest", "Digest username=\"robertdig\", realm=\"Squid proxy-caching web server\", nonce=\"yy8rQXjEWwixXVBj\", uri=\"/images/bg8.gif\", response=\"f75a7d3edd48d93c681c75dc4fb58700\", qop=auth, nc=00000012, cnonce=\"e2216641961e228e\" "},
-                                     {"ntlm", "NTLM "}
+                                     {"ntlm", "NTLM "},
+                                     {"negotiate", "Negotiate "}
                                    };
 
-    for (unsigned count = 0; count < 3 ; count++) {
+    for (unsigned count = 0; count < 4 ; count++) {
         if (strcasecmp(type, proxy_auths[count][0]) == 0)
             return proxy_auths[count][1];
     }
@@ -109,6 +111,8 @@ fake_auth_setup()
 
     char const *ntlm_parms[]= {"program /home/robertc/install/squid/libexec/digest_pw_auth /home/robertc/install/squid/etc/digest.pwd"};
 
+    char const *negotiate_parms[]= {"program /home/robertc/install/squid/libexec/digest_pw_auth /home/robertc/install/squid/etc/digest.pwd"};
+
     struct _scheme_params {
         char const *name;
         char const **params;
@@ -117,9 +121,10 @@ fake_auth_setup()
 
     params[]={ {"digest", digest_parms, 2},
                {"basic", basic_parms, 2},
-               {"ntlm", ntlm_parms, 1}};
+               {"ntlm", ntlm_parms, 1},
+               {"negotiate", negotiate_parms, 1}};
 
-    for (unsigned scheme=0; scheme < 3; scheme++)
+    for (unsigned scheme=0; scheme < 4; scheme++)
         setup_scheme(getConfig(params[scheme].name), params[scheme].params, params[scheme].paramlength);
 
     authenticateInit(&config);
@@ -232,3 +237,27 @@ testAuthNTLMUserRequest::username()
     CPPUNIT_ASSERT_EQUAL(0, strcmp("John", temp->username()));
     delete temp;
 }
+
+#include "auth/negotiate/auth_negotiate.h"
+/* AuthNegotiateUserRequest::AuthNegotiateUserRequest works
+ */
+void
+testAuthNegotiateUserRequest::construction()
+{
+    AuthNegotiateUserRequest();
+    AuthNegotiateUserRequest *temp=new AuthNegotiateUserRequest();
+    delete temp;
+}
+
+void
+testAuthNegotiateUserRequest::username()
+{
+    AuthNegotiateUserRequest();
+    AuthNegotiateUserRequest *temp=new AuthNegotiateUserRequest();
+    NegotiateUser *user=new NegotiateUser(AuthConfig::Find("negotiate"));
+    user->username("John");
+    temp->user(user);
+    user->addRequest(temp);
+    CPPUNIT_ASSERT_EQUAL(0, strcmp("John", temp->username()));
+    delete temp;
+}
index faef6fbbd6d713cb77fa97e78c5b40c74b45fbf2..c59b09fde2115adb2092fbb18764f9c499dbbac9 100644 (file)
@@ -87,5 +87,19 @@ protected:
     void username();
 };
 
+class testAuthNegotiateUserRequest : public CPPUNIT_NS::TestFixture
+{
+    CPPUNIT_TEST_SUITE( testAuthNegotiateUserRequest );
+    CPPUNIT_TEST( construction );
+    CPPUNIT_TEST( username );
+    CPPUNIT_TEST_SUITE_END();
+
+public:
+
+protected:
+    void construction();
+    void username();
+};
+
 #endif
 
index 89a51aa000467e3f51ec06814678c01972cd41bd..44ec10dfe4b92a7188030dfb1a3c162133482a40 100644 (file)
@@ -187,8 +187,8 @@ testCoss::testCossSearch()
         flags.cachable = 1;
         StoreEntry *pe = storeCreateEntry("dummy url", "dummy log url", flags, METHOD_GET);
         HttpVersion version(1, 0);
-        /* We are allowed to do this typecast */
-        httpReplySetHeaders((HttpReply *)pe->getReply(), version, HTTP_OK, "dummy test object", "x-squid-internal/test", -1, -1, squid_curtime + 100000);
+        HttpReply *rep = (HttpReply *) pe->getReply(); // bypass const
+        rep->setHeaders(version, HTTP_OK, "dummy test object", "x-squid-internal/test", -1, -1, squid_curtime + 100000);
 
         storeSetPublicKey(pe);
 
@@ -197,7 +197,7 @@ testCoss::testCossSearch()
         {
             Packer p;
             packerToStoreInit(&p, pe);
-            httpReplyPackHeadersInto(pe->getReply(), &p);
+            pe->getReply()->packHeadersInto(&p);
             packerClean(&p);
         }
 
index 2fef3fe770a5234a4f7108a610f56e812daec4fd..7abf90977046fcf7bf094443185aff0088b3515c 100644 (file)
@@ -157,7 +157,8 @@ testNull::testNullSearch()
         StoreEntry *pe = storeCreateEntry("dummy url", "dummy log url", flags, METHOD_GET);
         HttpVersion version(1, 0);
         /* We are allowed to do this typecast */
-        httpReplySetHeaders((HttpReply *)pe->getReply(), version, HTTP_OK, "dummy test object", "x-squid-internal/test", -1, -1, squid_curtime + 100000);
+        HttpReply *rep = (HttpReply *) pe->getReply(); // bypass const
+        rep->setHeaders(version, HTTP_OK, "dummy test object", "x-squid-internal/test", -1, -1, squid_curtime + 100000);
 
         storeSetPublicKey(pe);
 
@@ -166,7 +167,7 @@ testNull::testNullSearch()
         {
             Packer p;
             packerToStoreInit(&p, pe);
-            httpReplyPackHeadersInto(pe->getReply(), &p);
+            pe->getReply()->packHeadersInto(&p);
             packerClean(&p);
         }
 
index 578e3af405f4db9b8bbe3faf3b1464044c56f91b..0b0d594b9eda378affdb6c2528e02a61ae136992 100644 (file)
@@ -121,8 +121,8 @@ testUfs::testUfsSearch()
         flags.cachable = 1;
         StoreEntry *pe = storeCreateEntry("dummy url", "dummy log url", flags, METHOD_GET);
         HttpVersion version(1, 0);
-        /* We are allowed to do this typecast */
-        httpReplySetHeaders((HttpReply *)pe->getReply(), version, HTTP_OK, "dummy test object", "x-squid-internal/test", -1, -1, squid_curtime + 100000);
+        HttpReply *rep = (HttpReply *) pe->getReply(); // bypass const
+        rep->setHeaders(version, HTTP_OK, "dummy test object", "x-squid-internal/test", -1, -1, squid_curtime + 100000);
 
         storeSetPublicKey(pe);
 
@@ -131,7 +131,7 @@ testUfs::testUfsSearch()
         {
             Packer p;
             packerToStoreInit(&p, pe);
-            httpReplyPackHeadersInto(pe->getReply(), &p);
+            pe->getReply()->packHeadersInto(&p);
             packerClean(&p);
         }