Revision: 7494
          http://sourceforge.net/p/ipcop/svn/7494
Author:   owes
Date:     2014-04-22 15:18:27 +0000 (Tue, 22 Apr 2014)
Log Message:
-----------
Fix (from squid developers) for newer redirector protocol.
Pass input line (without modifications!) to work with newer squid versions.

Modified Paths:
--------------
    ipcop/trunk/lfs/squidGuard
    ipcop/trunk/src/patches/squidGuard-1.5-beta_stdout-always.patch

Added Paths:
-----------
    ipcop/trunk/src/patches/squidGuard-1.5-beta_helper-protocol.patch

Modified: ipcop/trunk/lfs/squidGuard
===================================================================
--- ipcop/trunk/lfs/squidGuard  2014-04-22 10:07:27 UTC (rev 7493)
+++ ipcop/trunk/lfs/squidGuard  2014-04-22 15:18:27 UTC (rev 7494)
@@ -89,6 +89,7 @@
        @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar xf $(DIR_DL)/$(DL_FILE)
        cd $(DIR_APP) && tar xf $(DIR_DL)/$(PATCH1)
        cd $(DIR_APP) && for patch in `cat debian/patches/series` ; do echo 
"Using $$patch"; patch -p1 -i debian/patches/$$patch; done
+       cd $(DIR_APP) && patch -Np1 -i 
$(DIR_PATCHES)/$(THISAPP)_helper-protocol.patch
        cd $(DIR_APP) && patch -Np1 -i 
$(DIR_PATCHES)/$(THISAPP)_stdout-always.patch
        cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(THISAPP)_db_v4_up.patch
        cd $(DIR_APP) && patch -Np1 -i 
$(DIR_PATCHES)/$(THISAPP)_remove-debug-logging.patch
@@ -103,7 +104,7 @@
        # Fix 'yyunput' and 'input' defined but not used
        cd $(DIR_APP) && sed -i 's/ignore  /%option noinput\n%option 
nounput\n&/' src/sg.l
        # add additional version info
-       cd $(DIR_APP) && sed -i 's:#define VERSION\(.*\):#define VERSION\1 \" 
\(IPCop patchlevel 5\)\":g' src/version.h
+       cd $(DIR_APP) && sed -i 's:#define VERSION\(.*\):#define VERSION\1 \" 
\(IPCop patchlevel 2\)\":g' src/version.h
 
        # Use --with-db, so /usr/local does not appear for db
        cd $(DIR_APP) && ./configure --prefix=/usr \

Added: ipcop/trunk/src/patches/squidGuard-1.5-beta_helper-protocol.patch
===================================================================
--- ipcop/trunk/src/patches/squidGuard-1.5-beta_helper-protocol.patch           
                (rev 0)
+++ ipcop/trunk/src/patches/squidGuard-1.5-beta_helper-protocol.patch   
2014-04-22 15:18:27 UTC (rev 7494)
@@ -0,0 +1,125 @@
+
+From Jeffries Amos http://bugs.squid-cache.org/show_bug.cgi?id=3978#c5
+
+--- squidGuard-1.5-beta.orig/src/main.c        2013-12-12 11:47:31.000000000 
+1300
++++ squidGuard-1.5-beta.orig/src/main.c        2013-12-12 11:50:38.000000000 
+1300
+@@ -185,7 +185,7 @@ 
+       sgReloadConfig();
+       }
+       if(failsafe_mode) {
+-      puts("");
++      puts("ERR message=\"squidGuard failsafe mode\"");
+       fflush(stdout);
+       if(sig_hup){
+           sgReloadConfig();
+@@ -194,7 +194,7 @@ 
+       }
+       if(parseLine(buf,&squidInfo) != 1){
+       sgLogError("ERROR: Error parsing squid line: %s",buf);
+-      puts("");
++      puts("BH message=\"squidGuard error parsing squid line\"");
+       }
+         else {
+       src = Source;
+@@ -206,14 +206,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 {
+@@ -228,6 +228,10 @@ 
+           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);
+             /* sgLogDebug("DEBUG: %s %s/%s %s 
%s\n",redirect,squidInfo.src,squidInfo.srcDomain,squidInfo.ident,squidInfo.method);
  */
+           break;
+         }
+--- squidGuard-1.5-beta.orig/src/main.c.in     2013-12-12 11:47:31.000000000 
+1300
++++ squidGuard-1.5-beta.orig/src/main.c.in     2013-12-12 11:53:18.000000000 
+1300
+@@ -185,7 +185,7 @@ 
+       sgReloadConfig();
+       }
+       if(failsafe_mode) {
+-      puts("");
++      puts("ERR message=\"squidGuard failsafe mode\"");
+       fflush(stdout);
+       if(sig_hup){
+           sgReloadConfig();
+@@ -194,7 +194,7 @@ 
+       }
+       if(parseLine(buf,&squidInfo) != 1){
+       sgLogError("ERROR: Error parsing squid line: %s",buf);
+-      puts("");
++      puts("BH message=\"squidGuard error parsing squid line\"");
+       }
+         else {
+       src = Source;
+@@ -206,14 +206,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 {
+@@ -225,9 +225,11 @@ 
+             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);
++
+             /* sgLogDebug("DEBUG: %s %s/%s %s 
%s\n",redirect,squidInfo.src,squidInfo.srcDomain,squidInfo.ident,squidInfo.method);
  */
+           break;
+         }
+--- squidGuard-1.5-beta.orig/src/sgDiv.c       2013-12-12 11:47:31.000000000 
+1300
++++ squidGuard-1.5-beta.orig/src/sgDiv.c       2013-12-12 11:48:36.000000000 
+1300
+@@ -782,7 +782,7 @@ 
+   }
+   sgLogError("ERROR: Going into emergency mode");
+   while(fgets(buf, MAX_BUF, stdin) != NULL){
+-    puts("");
++    puts("ERR");
+     fflush(stdout);
+   }
+   sgLogError("ERROR: Ending emergency mode, stdin empty");
+--- squidGuard-1.5-beta.orig/src/sgDiv.c.in    2013-12-12 11:47:31.000000000 
+1300
++++ squidGuard-1.5-beta.orig/src/sgDiv.c.in    2013-12-12 11:48:36.000000000 
+1300
+@@ -782,7 +782,7 @@ 
+   }
+   sgLogError("ERROR: Going into emergency mode");
+   while(fgets(buf, MAX_BUF, stdin) != NULL){
+-    puts("");
++    puts("ERR");
+     fflush(stdout);
+   }
+   sgLogError("ERROR: Ending emergency mode, stdin empty");

Modified: ipcop/trunk/src/patches/squidGuard-1.5-beta_stdout-always.patch
===================================================================
--- ipcop/trunk/src/patches/squidGuard-1.5-beta_stdout-always.patch     
2014-04-22 10:07:27 UTC (rev 7493)
+++ ipcop/trunk/src/patches/squidGuard-1.5-beta_stdout-always.patch     
2014-04-22 15:18:27 UTC (rev 7494)
@@ -31,48 +31,29 @@
      case 'c':
        configFile = optarg;
        break;
-@@ -206,14 +210,19 @@
+@@ -206,7 +210,12 @@
          acl = sgAclCheckSource(src);
          if((redirect = sgAclAccess(src,acl,&squidInfo)) == NULL){
            if(src == NULL || src->cont_search == 0){
--            puts(""); 
 +            if (globalFullStdout) {
-+              fprintf(stdout, "%s %s/%s %s %s\n", squidInfo.origraw, 
squidInfo.src, squidInfo.srcDomain, squidInfo.ident, squidInfo.method);
++              puts(buf);
 +            }
 +            else {
-+              puts("");
+             puts("ERR");
 +            }
              break;
            } else
              if(src->next != NULL){
+@@ -222,7 +223,12 @@
                src = src->next;
                continue;
              } else {
--              puts("");
-+              puts("");  /* TODO: do we need to patch this line, with what ? 
*/
++            if (globalFullStdout) {
++              puts(buf);
++            }
++            else {
+               puts("ERR");
++            }
                break;
              }
          } else {
-diff -Nur a/src/sgDiv.c.in b/src/sgDiv.c.in
---- a/src/sgDiv.c.in   2010-09-08 13:57:18.000000000 +0200
-+++ b/src/sgDiv.c.in   2013-06-03 21:43:02.000000000 +0200
-@@ -100,6 +100,8 @@
-   
-   field = strtok(line,"\t ");
-   /*field holds each fetched url*/
-+  /* remember real raw url in case everything is ok an we want to stdout it */
-+  strcpy(s->origraw,field);  
-   /* Let's first decode the url and then test it. Fixes bug2. */
-   HTUnEscape(field);
- 
-diff -Nur a/src/sg.h.in b/src/sg.h.in
---- a/src/sg.h.in      2010-09-08 13:57:18.000000000 +0200
-+++ b/src/sg.h.in      2013-05-31 13:00:50.000000000 +0200
-@@ -164,6 +164,7 @@
-   int  dot;  /* true if domain is in dot notation */
-   char url[MAX_BUF];
-   char orig[MAX_BUF];
-+  char origraw[MAX_BUF];
-   char surl[MAX_BUF]; 
-   char furl[MAX_BUF];
-   char *strippedurl;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
_______________________________________________
Ipcop-svn mailing list
Ipcop-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipcop-svn

Reply via email to