squidGuard: Update for new squid helper protocol.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 1 Jun 2014 22:54:19 +0000 (00:54 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 1 Jun 2014 22:54:19 +0000 (00:54 +0200)
config/rootfiles/core/78/filelists/files
lfs/squidguard
src/patches/squidguard-1.4-squid-helper-protocol.patch [new file with mode: 0644]

index 6b9f795..7ba6c80 100644 (file)
@@ -9,6 +9,7 @@ srv/web/ipfire/cgi-bin/modem-status.cgi
 srv/web/ipfire/cgi-bin/ovpnmain.cgi
 srv/web/ipfire/cgi-bin/proxy.cgi
 srv/web/ipfire/html/themes/ipfire/include/functions.pl
+usr/bin/squidGuard
 usr/local/bin/setddns.pl
 var/ipfire/langs
 var/ipfire/menu.d/20-status.menu
index c70a0d8..a48c25c 100644 (file)
@@ -70,6 +70,7 @@ $(subst %,%_MD5,$(objects)) :
 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        @$(PREBUILD)
        @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
+       cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/squidguard-1.4-squid-helper-protocol.patch
        cd $(DIR_APP) && ./configure --prefix=/usr --datadir=/usr/share \
                --sysconfdir=/etc --localstatedir=/var --infodir=/usr/info --mandir=/usr/man  \
                --with-sg-config=/var/ipfire/urlfilter/squidGuard.conf \
diff --git a/src/patches/squidguard-1.4-squid-helper-protocol.patch b/src/patches/squidguard-1.4-squid-helper-protocol.patch
new file mode 100644 (file)
index 0000000..9806946
--- /dev/null
@@ -0,0 +1,75 @@
+http://bugs.squid-cache.org/show_bug.cgi?id=3978
+
+--- squidGuard-1.4.orig/src/main.c     2013-12-11 17:42:15.000000000 +1300
++++ squidGuard-1.4.orig/src/main.c     2013-12-11 19:04:09.000000000 +1300
+@@ -175,7 +175,7 @@ 
+       sgReloadConfig();
+       }
+       if(failsafe_mode) {
+-      puts("");
++      puts("ERR message=\"squidGuard failsafe mode\"");
+       fflush(stdout);
+       if(sig_hup){
+           sgReloadConfig();
+@@ -184,7 +184,7 @@ 
+       }
+       if(parseLine(buf,&squidInfo) != 1){
+       sgLogError("Error parsing squid line: %s",buf);
+-      puts("");
++      puts("BH message=\"squidGuard error parsing squid line\"");
+       }
+         else {
+       src = Source;
+@@ -196,14 +196,14 @@ 
+         acl = sgAclCheckSource(src);
+         if((redirect = sgAclAccess(src,acl,&squidInfo)) == NULL){
+           if(src == NULL || src->cont_search == 0){
+-            puts(""); 
++            puts("ERR");
+             break;
+           } else
+             if(src->next != NULL){
+               src = src->next;
+               continue;
+             } else {
+-              puts("");
++              puts("ERR");
+               break;
+             }
+         } else {
+@@ -215,9 +215,10 @@ 
+             squidInfo.ident[0] = '-';
+             squidInfo.ident[1] = '\0';
+           }
+-          fprintf(stdout,"%s %s/%s %s %s\n",redirect,squidInfo.src,
+-                  squidInfo.srcDomain,squidInfo.ident,
+-                  squidInfo.method);
++          if (isdigit(redirect[0]) && isdigit(redirect[1]) && isdigit(redirect[2]) && redirect[3]==':') {
++            fprintf(stdout,"OK status=%c%c%c url=\"%s\"\n", redirect[0], redirect[1], redirect[2], &redirect[4]);
++          } else
++            fprintf(stdout,"OK rewrite-url=\"%s\"\n",redirect);
+             /* sgLogError("%s %s/%s %s %s\n",redirect,squidInfo.src,squidInfo.srcDomain,squidInfo.ident,squidInfo.method);  */
+           break;
+         }
+--- squidGuard-1.4.orig/src/sgDiv.c    2013-12-11 17:42:15.000000000 +1300
++++ squidGuard-1.4.orig/src/sgDiv.c    2013-12-11 18:58:33.000000000 +1300
+@@ -771,7 +771,7 @@ 
+   }
+   sgLogError("Going into emergency mode");
+   while(fgets(buf, MAX_BUF, stdin) != NULL){
+-    puts("");
++    puts("ERR");
+     fflush(stdout);
+   }
+   sgLogError("ending emergency mode, stdin empty");
+--- squidGuard-1.4.orig/src/sgDiv.c.in 2013-12-11 17:42:15.000000000 +1300
++++ squidGuard-1.4.orig/src/sgDiv.c.in 2013-12-11 18:58:40.000000000 +1300
+@@ -782,7 +782,7 @@ 
+   }
+   sgLogError("Going into emergency mode");
+   while(fgets(buf, MAX_BUF, stdin) != NULL){
+-    puts("");
++    puts("ERR");
+     fflush(stdout);
+   }
+   sgLogError("ending emergency mode, stdin empty");