]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Callers should not have to test for transparency when they want it to stop.
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 11 Apr 2008 01:49:20 +0000 (13:49 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 11 Apr 2008 01:49:20 +0000 (13:49 +1200)
Transparency and Interception controller can do that on their behalf much cleaner.

src/IPInterception.cc
src/tools.cc

index f10730b15a87e4e8fd0ffbfa9bd80d1f8fa286d3..5aacb448abc0892b4ed7a6c953d14caa3948362e 100644 (file)
@@ -105,14 +105,18 @@ IPIntercept IPInterceptor;
 
 void
 IPIntercept::StopTransparency(const char *str) {
-    debugs(89, DBG_IMPORTANT, "Stopping full transparency: " << str);
-    transparent_active = 0;
+    if(transparent_active) {
+        debugs(89, DBG_IMPORTANT, "Stopping full transparency: " << str);
+        transparent_active = 0;
+    }
 }
 
 void
 IPIntercept::StopInterception(const char *str) {
-    debugs(89, DBG_IMPORTANT, "Stopping IP interception: " << str);
-    intercept_active = 0;
+    if(intercept_active) {
+        debugs(89, DBG_IMPORTANT, "Stopping IP interception: " << str);
+        intercept_active = 0;
+    }
 }
 
 int
index 61ef6bee30ccd0d33f14c83b0a20ecb8ba1865e0..72a975a7fd59c1a299ca4cb011e82ba532e85221 100644 (file)
@@ -1235,11 +1235,7 @@ keepCapabilities(void)
 #if HAVE_PRCTL && defined(PR_SET_KEEPCAPS) && HAVE_SYS_CAPABILITY_H
 
     if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0)) {
-        /* Silent failure unless transparency is required. Maybe not started as root */
-        if (IPInterceptor.TransparentActive()) {
-            debugs(1, 1, "Error - full transparency support requires capability setting which has failed. Continuing without transparency support");
-            IPInterceptor.StopTransparency();
-        }
+        IPInterceptor.StopTransparency("capability setting has failed.");
     }
 #endif
 }
@@ -1279,21 +1275,15 @@ restoreCapabilities(int keep)
         cap->permitted &= cap->effective;
 
     if (capset(head, cap) != 0) {
-        /* Silent failure unless transparency is required */
-        if(IPInterceptor.TransparentActive()) {
-            IPInterceptor.StopTransparency("Error enabling needed capabilities.");
-        }
+        IPInterceptor.StopTransparency("Error enabling needed capabilities.");
     }
 
 nocap:
     xfree(head);
     xfree(cap);
-#else /* not defined(_SQUID_LINUX_) && HAVE_SYS_CAPABILITY_H */
-
-    if (IPInterceptor.TransparentActive()) {
-        IPInterceptor.StopTransparency("Missing needed capability support.");
-    }
 
+#else /* not defined(_SQUID_LINUX_) && HAVE_SYS_CAPABILITY_H */
+    IPInterceptor.StopTransparency("Missing needed capability support.");
 #endif
 }