Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 398544 Details for
Bug 542472
=net-proxy/squidguard-1.5_beta-r1 stabilization request
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Support Squid 3.4 reply format for 1.4
squidguard-1.4-squid34.patch (text/plain), 5.02 KB, created by
drserge
on 2015-03-09 19:19:48 UTC
(
hide
)
Description:
Support Squid 3.4 reply format for 1.4
Filename:
MIME Type:
Creator:
drserge
Created:
2015-03-09 19:19:48 UTC
Size:
5.02 KB
patch
obsolete
>diff -r -U 3 squidGuard-1.4.orig/src/main.c squidGuard-1.4/src/main.c >--- squidGuard-1.4.orig/src/main.c 2008-08-30 14:27:41.000000000 +0400 >+++ squidGuard-1.4/src/main.c 2015-03-09 21:45:26.113515307 +0300 >@@ -61,6 +61,7 @@ > int passthrough = 0; > int showBar = 0; /* Do not display the progress bar. */ > char *globalCreateDb = NULL; >+int globalSquid34 = 0; > int failsafe_mode = 0; > int sig_hup = 0; > int sig_alrm = 0; >@@ -87,6 +88,8 @@ > char buf[MAX_BUF]; > char *redirect,tmp[MAX_BUF]; > char *configFile = NULL; >+ char *status = NULL, *endptr; >+ long statusl = 0; > time_t t; > #if HAVE_SIGACTION > struct sigaction act; >@@ -94,7 +97,7 @@ > gettimeofday(&start_time, NULL); > progname = argv[0]; > globalPid = getpid(); >- while ((ch = getopt(argc, argv, "hbduPC:t:c:v")) != EOF) >+ while ((ch = getopt(argc, argv, "hbdunPC:t:c:v")) != EOF) > switch (ch) { > case 'd': > globalDebug = 1; >@@ -117,6 +120,9 @@ > fprintf(stderr, "SquidGuard: %s %s\n", VERSION,db_version(NULL,NULL,NULL)); > exit(0); > break; >+ case 'n': >+ globalSquid34 = 1; >+ break; > case 't': > if((t = iso2sec(optarg)) == -1){ > fprintf(stderr,"-t dateformat error, should be yyyy-mm-ddTHH:MM:SS\n"); >@@ -175,7 +181,8 @@ > sgReloadConfig(); > } > if(failsafe_mode) { >- puts(""); >+ if (globalSquid34) puts("ERR message=\"squidGuard failsafe mode\""); >+ else puts(""); > fflush(stdout); > if(sig_hup){ > sgReloadConfig(); >@@ -184,7 +191,8 @@ > } > if(parseLine(buf,&squidInfo) != 1){ > sgLogError("Error parsing squid line: %s",buf); >- puts(""); >+ if (globalSquid34) puts("BH message=\"squidGuard error parsing squid line\""); >+ else puts(""); > } > else { > src = Source; >@@ -196,29 +204,55 @@ > acl = sgAclCheckSource(src); > if((redirect = sgAclAccess(src,acl,&squidInfo)) == NULL){ > if(src == NULL || src->cont_search == 0){ >- puts(""); >+ if (globalSquid34) puts("ERR"); >+ else puts(""); > break; > } else > if(src->next != NULL){ > src = src->next; > continue; > } else { >- puts(""); >+ if (globalSquid34) puts("ERR"); >+ else puts(""); > break; > } > } else { >- if(squidInfo.srcDomain[0] == '\0'){ >- squidInfo.srcDomain[0] = '-'; >- squidInfo.srcDomain[1] = '\0'; >- } >- if(squidInfo.ident[0] == '\0'){ >- squidInfo.ident[0] = '-'; >- squidInfo.ident[1] = '\0'; >+ if (globalSquid34) { >+ status = strsep(&redirect, ":"); >+ if (status != NULL) { >+ // trying to check the 1st colon-separeted field to be a HTTP status >+ statusl = strtol(status, &endptr, 10); >+ // if the 1st field is not an acceptable HTTP status then restore the string >+ switch (statusl) { >+ case 301: >+ case 302: >+ case 303: >+ case 307: >+ case 308: >+ break; >+ default: >+ statusl = 0; >+ redirect = status; >+ redirect[strlen(redirect)] = ':'; >+ } >+ } >+ if (statusl) fprintf(stdout, "OK status=%s url=\"%s\"\n", status, redirect); >+ else fprintf(stdout, "OK rewrite-url=\"%s\"\n", redirect); > } >- fprintf(stdout,"%s %s/%s %s %s\n",redirect,squidInfo.src, >- squidInfo.srcDomain,squidInfo.ident, >- squidInfo.method); >- /* sgLogError("%s %s/%s %s %s\n",redirect,squidInfo.src,squidInfo.srcDomain,squidInfo.ident,squidInfo.method); */ >+ else { >+ if(squidInfo.srcDomain[0] == '\0'){ >+ squidInfo.srcDomain[0] = '-'; >+ squidInfo.srcDomain[1] = '\0'; >+ } >+ if(squidInfo.ident[0] == '\0'){ >+ squidInfo.ident[0] = '-'; >+ squidInfo.ident[1] = '\0'; >+ } >+ fprintf(stdout,"%s %s/%s %s %s\n",redirect,squidInfo.src, >+ squidInfo.srcDomain,squidInfo.ident, >+ squidInfo.method); >+ /* sgLogError("%s %s/%s %s %s\n",redirect,squidInfo.src,squidInfo.srcDomain,squidInfo.ident,squidInfo.method); */ >+ } > break; > } > } /*for(;;)*/ >@@ -255,6 +289,7 @@ > fprintf(stderr, > "Usage: squidGuard [-u] [-C block] [-t time] [-c file] [-v] [-d] [-P]\n"); > fprintf(stderr, "Options:\n"); >+ fprintf(stderr, " -n : Use Squid 3.4+ reply format"); > fprintf(stderr, " -v : show version number\n"); > fprintf(stderr, " -d : all errors to stderr\n"); > fprintf(stderr, " -b : switch on the progress bar when updating the blacklists\n"); >diff -r -U 3 squidGuard-1.4.orig/src/sgDiv.c squidGuard-1.4/src/sgDiv.c >--- squidGuard-1.4.orig/src/sgDiv.c 2008-03-12 23:41:53.000000000 +0300 >+++ squidGuard-1.4/src/sgDiv.c 2015-03-09 21:48:25.937804620 +0300 >@@ -21,6 +21,8 @@ > > /* #define METEST 8; */ > >+extern int globalSquid34; >+ > #if __STDC__ > void sgHandlerSigHUP(int signal) > #else >@@ -771,7 +773,8 @@ > } > sgLogError("Going into emergency mode"); > while(fgets(buf, MAX_BUF, stdin) != NULL){ >- puts(""); >+ if (globalSquid34) puts("ERR message=\"squidGuard emergency mode\""); >+ else puts(""); > fflush(stdout); > } > sgLogError("ending emergency mode, stdin empty");
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 542472
:
398328
|
398332
| 398544 |
398546