aboutsummaryrefslogtreecommitdiff
path: root/network/squidGuard/rewrite.patch
blob: 878a2af16752af83f49a54dfe037fc28f37da3ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
--- 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");