diff --git a/README.md b/README.md index 94c6d52..7399c48 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # squidguard +SquidGuard is an ultrafast and free filter, redirector and access controller for Squid. + diff --git a/squidGuard-1.4-cgi_it.patch b/squidGuard-1.4-cgi_it.patch new file mode 100644 index 0000000..8e55f0d --- /dev/null +++ b/squidGuard-1.4-cgi_it.patch @@ -0,0 +1,43 @@ +diff -Nru squidGuard-1.4.orig//samples/babel.it squidGuard-1.4/samples/babel.it +--- squidGuard-1.4.orig//samples/babel.it 1970-01-01 01:00:00.000000000 +0100 ++++ squidGuard-1.4/samples/babel.it 2011-04-28 14:01:34.281659208 +0200 +@@ -0,0 +1,20 @@ ++Unknown=sconosciuto ++Title=403 Accesso negato ++Msg=L'accesso a questo sito è bloccato. ++Tabclientname=Nome del Client ++Tabcaption=Informazioni aggiuntive: ++TabIP=Indirizzo del Client ++Tabclientuser=Utente ++Tabclientgroup=Gruppo ++Taburl=URL ++Tabtargetgroup=Gruppo target ++msgproxymaster=Se credi che questo sia un errore, invia this page a ++msgrefresh=Potrebbe essere necessario usare il pulsante <Ricarica> del browser o premere <Shift>+<Ricarica> per rimuovere questo messaggio dopo aver modificato la regola di accesso. ++msgtimerefresh=Potrebbe essere necessario usare il pulsante <Ricarica> del browser o premere <Shift>+<Ricarica> per rimuovere questo messaggio dopo la transizione da un orario con restrizioni. ++msgunknown=Accesso negato perchè il client ` sconosciuto a $proxy. ++msginaddr=La navigazione usando indirizzi IP è bloccata dalle politiche di accesso alla rete. ++msgalternatives=Sono state trovate le seguenti possibili alternative: ++msgnoalternatives=Non ` stato trovato un dominio alternativo per il server. ++msgreferermaster=Invia una segnalazione all'amministratore della rete chiedendo di correggere i link che puntano a $url nel referer con le alternative corrette mostrate sopra. ++msgwebmaster=Per favore chiedi al webmaster di quel server il nome del dominio corretto. ++msgdeflang=Questo messaggio è in Italiano perchè il tuo browser ha "it" in testa alla lista delle lingue preferite tra quelle supportate da questo programma oppure la lingua impostata non è supportata da questo programma. Le lingue supportate sono: +diff -Nru squidGuard-1.4.orig//samples/squidGuard.cgi.in squidGuard-1.4/samples/squidGuard.cgi.in +--- squidGuard-1.4.orig//samples/squidGuard.cgi.in 2008-12-23 22:08:35.000000000 +0100 ++++ squidGuard-1.4/samples/squidGuard.cgi.in 2011-04-28 14:02:54.735856781 +0200 +@@ -57,12 +57,13 @@ + # + # CONFIGURABLE OPTIONS: + # +-# (Currently: "en", "fr", "de", "es", "nl", "no") ++# (Currently: "en", "de", "es", "fr", "it", "nl", "no") + @supported = ( + "en (English), ", +- "fr (Français), ", + "de (Deutsch), ", + "es (Español), ", ++ "fr (Français), ", ++ "it (Italiano), ", + "nl (Nederlands), ", + "no (Norsk)." + ); diff --git a/squidGuard-1.4-configdir.patch b/squidGuard-1.4-configdir.patch new file mode 100644 index 0000000..a672322 --- /dev/null +++ b/squidGuard-1.4-configdir.patch @@ -0,0 +1,12 @@ +diff -Nru squidGuard-1.4.orig//src/sg.h.in squidGuard-1.4/src/sg.h.in +--- squidGuard-1.4.orig//src/sg.h.in 2011-04-28 13:27:17.434060406 +0200 ++++ squidGuard-1.4/src/sg.h.in 2011-04-28 13:28:06.358510843 +0200 +@@ -79,7 +79,7 @@ + #define WARNING_LOGFILE "squidGuard.log" + #define ERROR_LOGFILE "squidGuard.error" + +-#define DEFAULT_CONFIGFILE "@prefix@/squidGuard/squidGuard.conf" ++#define DEFAULT_CONFIGFILE "@sysconfdir@/squidGuard/squidGuard.conf" + #define DEFAULT_LOGDIR "@prefix@/squidGuard/log" + #define DEFAULT_DBHOME "@prefix@/squidGuard/db" + #define EXEC_PROGRAM "@prefix@/bin/squidGuard" diff --git a/squidGuard-1.4-patch-20091015.patch b/squidGuard-1.4-patch-20091015.patch new file mode 100644 index 0000000..39373cd --- /dev/null +++ b/squidGuard-1.4-patch-20091015.patch @@ -0,0 +1,44 @@ +--- src/sgLog.c 2007-11-16 17:58:32.000000000 +0100 ++++ squidGuard-1.4-patch-20091015/sgLog.c 2009-10-15 21:25:14.000000000 +0200 +@@ -2,7 +2,7 @@ + By accepting this notice, you agree to be bound by the following + agreements: + +- This software product, squidGuard, is copyrighted (C) 1998-2007 ++ This software product, squidGuard, is copyrighted (C) 1998-2009 + by Christine Kronberg, Shalla Secure Services. All rights reserved. + + This program is free software; you can redistribute it and/or modify it +@@ -55,8 +55,8 @@ + char msg[MAX_BUF]; + va_list ap; + VA_START(ap, format); +- if(vsprintf(msg, format, ap) > (MAX_BUF - 1)) +- fprintf(stderr,"overflow in vsprintf (sgLog): %s",strerror(errno)); ++ if(vsnprintf(msg, MAX_BUF, format, ap) > (MAX_BUF - 1)) ++ fprintf(stderr,"overflow in vsnprintf (sgLog): %s",strerror(errno)); + va_end(ap); + date = niso(0); + if(globalDebug || log == NULL) { +@@ -87,8 +87,8 @@ + char msg[MAX_BUF]; + va_list ap; + VA_START(ap, format); +- if(vsprintf(msg, format, ap) > (MAX_BUF - 1)) +- sgLogFatalError("overflow in vsprintf (sgLogError): %s",strerror(errno)); ++ if(vsnprintf(msg, MAX_BUF, format, ap) > (MAX_BUF - 1)) ++ sgLog(globalErrorLog, "overflow in vsnprintf (sgLogError): %s",strerror(errno)); + va_end(ap); + sgLog(globalErrorLog,"%s",msg); + } +@@ -104,8 +104,8 @@ + char msg[MAX_BUF]; + va_list ap; + VA_START(ap, format); +- if(vsprintf(msg, format, ap) > (MAX_BUF - 1)) +- return; ++ if(vsnprintf(msg, MAX_BUF, format, ap) > (MAX_BUF - 1)) ++ sgLog(globalErrorLog, "overflow in vsnprintf (sgLogError): %s",strerror(errno)); + va_end(ap); + sgLog(globalErrorLog,"%s",msg); + sgEmergency(); diff --git a/squidGuard-1.4-patch-20091019.patch b/squidGuard-1.4-patch-20091019.patch new file mode 100644 index 0000000..ada3f91 --- /dev/null +++ b/squidGuard-1.4-patch-20091019.patch @@ -0,0 +1,70 @@ +--- src/sg.h.in 2007-11-16 17:58:32.000000000 +0100 ++++ squidGuard-1.4-20091019/sg.h.in 2009-10-19 21:25:23.000000000 +0200 +@@ -73,7 +73,7 @@ + #define REQUEST_TYPE_REDIRECT 2 + #define REQUEST_TYPE_PASS 3 + +-#define MAX_BUF 4096 ++#define MAX_BUF 12288 + + #define DEFAULT_LOGFILE "squidGuard.log" + #define WARNING_LOGFILE "squidGuard.log" +--- src/sgDiv.c 2008-03-12 21:41:53.000000000 +0100 ++++ squidGuard-1.4-20091019/sgDiv.c.in 2009-10-19 21:26:04.000000000 +0200 +@@ -94,6 +94,7 @@ + int i = 0; + char c; + int report_once = 1; ++ int trailingdot = 0; + size_t strsz; + int ndx = 0; + +@@ -132,7 +133,7 @@ + { + /* in case this is a '://' skip over it, but try to not read past EOS */ + if(3 <= strsz-ndx) { +- if(':' == p[ndx] && '/' == p[ndx+1] && '/' == p[ndx+2]) { ++ if(':' == p[ndx] && '/' == p[ndx+1] && '/' == p[ndx+2] && '\0' != p[ndx+3]) { + ndx+=3; /* 3 == strlen("://"); */ + } + } +@@ -144,10 +145,20 @@ + strncpy(p+ndx,p+ndx+1, sz); + p[ndx+sz] = '\0'; + if(1 == report_once) { +- sgLogError("Warning: Possible bypass attempt. Found multiple slashes where only one is expected: %s", s->orig); ++ @NOLOG1@ sgLogError("Warning: Possible bypass attempt. Found multiple slashes where only one is expected: %s", s->orig); @NOLOG2@ + report_once--; + } + } ++ else if ('.' == p[ndx] && '/' == p[ndx+1] && trailingdot == 0) { ++ /* If the domain has trailing dot, remove (problem found with squid 3.0 stable1-5) */ ++ /* if this char is a dot and the next char is a slash, then shift the rest of the string left one char */ ++ /* We do this only the first time it is encountered. */ ++ trailingdot++; ++ size_t sz = strlen(p+ndx+1); ++ strncpy(p+ndx,p+ndx+1, sz); ++ p[ndx+sz] = '\0'; ++ @NOLOG1@ sgLogError("Warning: Possible bypass attempt. Found a trailing dot in the domain name: %s", s->orig); @NOLOG2@ ++ } + else + { + /* increment the string indexer */ +@@ -734,7 +745,7 @@ + p++; + break; + case 'u': /* Requested URL */ +- strcat(buf, req->orig); ++ strncat(buf, req->orig, 2048); + p++; + break; + default: +@@ -766,7 +777,7 @@ + fprintf( stderr, " ****************\n"); + fprintf( stderr, "FAILURE! Check your log file for problems with the database files!\n" ); + fprintf( stderr, " ****************\n"); +- exit(1); ++ exit(4); + } + } + sgLogError("Going into emergency mode"); diff --git a/squidGuard.cgi b/squidGuard.cgi new file mode 100644 index 0000000..10f0342 --- /dev/null +++ b/squidGuard.cgi @@ -0,0 +1,900 @@ +#!/usr/bin/perl +# +# Explain to the user that the URL is blocked and by which rule set +# +# By Pål Baltzersen 1999 (pal.baltzersen@ost.eltele.no) +# French texts thanks to Fabrice Prigent (fabrice.prigent@univ-tlse1.fr) +# Dutch texts thanks to Anneke Sicherer-Roetman (sicherer@sichemsoft.nl) +# German texts thanks to Buergernetz Pfaffenhofen (http://www.bn-paf.de/filter/) +# +# The last version may be found anytime at: +# http://ftp.ost.eltele.no/pub/www/proxy/squidGuard/contrib/ +# + +# By accepting this notice, you agree to be bound by the following +# agreements: +# +# This software product, squidGuard, is copyrighted (C) 1999 by ElTele +# Øst AS, Oslo, Norway, with all rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License (version 2) as +# published by the Free Software Foundation. It is distributed in the +# hope that it will be useful, but WITHOUT ANY WARRANTY; without even +# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License (GPL) for more details. +# +# You should have received a copy of the GNU General Public License +# (GPL) along with this program. + +use strict; +use Socket; +# +# GLOBAL VALUES: +# +my ($clientaddr,$clientname,$clientuser,$clientgroup,$targetgroup,$url); +my ($lang,@supported,$image,$redirect,$autoinaddr,$proxy,$proxymaster); +my (%msgconf,%title,%logo,%msg,%tab,%word); +my ($protocol,$address,$port,$path,$refererhost,$referer); +sub msginit(); +sub getpreferedlang(@); +sub parsequery($); +sub status($); +sub redirect($); +sub content($); +sub expires($); +sub title($); +sub terminator(); +sub msg($$); +sub table($$@); +sub href($); +sub gethostnames($); +sub spliturl($); +sub showhtml($); +sub showimage($$$); +sub showinaddr($$$$$); + +# +# CONFIGURABLE OPTIONS: +# +@supported = ( # "en", "fr", "de", "nl", "no" etc. + "en (English),", + "fr (Français),", + "de (Deutsch),", + "nl (Nederlands),", + "no (norsk)." + ); +$image = "/images/blocked.gif"; # RELATIVE TO DOCUMENT_ROOT +$redirect = ""; # "" TO AVOID REDIRECTION +$proxy = "proxy.ost.eltele.no"; # +$proxymaster = "blacklist\@squidguard.org"; # +$autoinaddr = 2; # 0|1|2; + # 0 TO NOT REDIRECT + # 1 TO AUTORESOLVE & REDIRECT IF UNIQUE + # 2 TO AUTORESOLVE & REDIRECT TO FIRST NAME +# +# CONFIGURABLE MESSAGES: +# +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +# !!! NOTE1: ALLWAYS ESCAPE EMBEDDED VARIABLES (I.E. \$var) !!! +# !!! IF YOU DON'T YOU MAY OPEN A SECURITY HOLE !!! +# !!! NOTE2: TRIPLE ESCAPE EMBEDDED `\', `"', `$', `@', `%' and `&' !!! +# !!! (I.E. \\\\, \\\", \\\$, \\\@, \\\&) !!! +# !!! NOTE3: ESCAPE OTHER SPECIAL INLINE CHARACTERS !!! +# !!! (I.E. \;, \') !!! +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +# +sub msginit() { + ($clientaddr,$clientname,$clientuser,$clientgroup,$targetgroup,$url) + = parsequery($ENV{"QUERY_STRING"}); + ($protocol,$address,$port,$path) = spliturl($url); + $lang = getpreferedlang(@supported); + + %word->{"unknown"}->{"en"} # THE WORD "unknown" + = "unknown"; # --------- "" --------- + %word->{"unknown"}->{"fr"} # "unknown" IN FRENCH + = "inconnu"; # + %word->{"unknown"}->{"de"} # "unknown" IN GERMAN + = "unbekannt"; # + %word->{"unknown"}->{"nl"} # "unknown" IN DUTCH + = "onbekend"; # + %word->{"unknown"}->{"no"} # "unknown" IN NORWEGIAN + = "ukjent"; # + + %title->{"default"}->{"en"} # THE DEFAULT TITLE + = [ "403 Forbidden" ]; # --------- "" --------- + %title->{"default"}->{"fr"} # --------- "" --------- + = [ "403 Interdit" ]; # --------- "" --------- + %title->{"default"}->{"de"} # --------- "" --------- + = [ "403 Verboten" ]; # --------- "" --------- + %title->{"default"}->{"nl"} # --------- "" --------- + = [ "403 Verboden" ]; # --------- "" --------- + %title->{"default"}->{"no"} # --------- "" --------- + = [ "403 Sperret" ]; # --------- "" --------- + + %msgconf->{"default"} # THE "default" MESSAGE CONFIG + # (USED WHEN NO OTHER MSGS APPLIES): + = [ "msg:H1:default", # SHOW MSG "default" AS

(DEFINED BELOW) + "tab:R,C,L:info" # SHOW "info" AS & COLUMNS ALIGNED R,C,L + . ":clientaddr" # AND WITH THESE ELEMENTS (DEFINED BELOW) + . ":clientname" # --------- "" --------- "" --------- + . ":clientuser" # --------- "" --------- "" --------- + . ":clientgroup" # --------- "" --------- "" --------- + . ":url" # --------- "" --------- "" --------- + . ":targetgroup", # --------- "" --------- "" --------- + "msg:P:proxymaster", # SHOW "proxymaster" AS

(DEFINED BELOW) + "msg:P:refresh" # SHOW "refresh" AS

(DEFINED BELOW) + ]; + + %msgconf->{"unknown"} # THE "unknown" CLIENT MESSAGE CONFIG: + = [ "msg:H1:unknown", # SHOW "unknown" AS

(DEFINED BELOW) + "tab:R,C,L:info" # SHOW "info" AS

& COLUMNS ALIGNED R,C,L + . ":clientaddr" # AND WITH THESE ELEMENTS (DEFINED BELOW) + . ":clientname" # --------- "" --------- "" --------- + . ":clientuser" # --------- "" --------- "" --------- + . ":clientgroup", # --------- "" --------- "" --------- + "msg:P:proxymaster", # SHOW "proxymaster" AS

(DEFINED BELOW) + "msg:P:refresh" # SHOW "refresh" AS

(DEFINED BELOW) + ]; + %msgconf->{%word->{"unknown"}->{$lang}} + = %msgconf->{"unknown"}; + + %msgconf->{"in-addr"} # THE MESSAGE CONFIG FOR THE "in-addr" DEST GROUP: + = [ "msg:H1:alternatives", # SHOW "alternatives" AS

(DEFINED BELOW) + "alternatives", # SHOW THE ALTERNATIV DOMAIN ADDRESSES + "referermaster", # SHOW "referermaster" (DEFINED BELOW) + "msg:P:refresh" # SHOW "refresh" AS

(DEFINED BELOW) + ]; + + %msgconf->{"noalternatives"} # DITTO WHEN THERE ARE NO DOMAIN ADDRESS ALTERNATIVES: + = [ "msg:H1:in-addr", # SHOW "in-addr" AS

(DEFINED BELOW) + "tab:R,C,L:info" # SHOW "info" AS

& COLUMNS ALIGNED R,C,L + . ":clientaddr" # AND WITH THESE ELEMENTS (DEFINED BELOW) + . ":clientname" # --------- "" --------- "" --------- + . ":clientuser" # --------- "" --------- "" --------- + . ":clientgroup" # --------- "" --------- "" --------- + . ":domainurl" # --------- "" --------- "" --------- + . ":targetgroup", # --------- "" --------- "" --------- + "msg:H3:noalternatives", # SHOW "noalternatives" AS

(DEFINED BELOW) + "msg:P:webmaster", # SHOW "webmaster" AS

(DEFINED BELOW) + "msg:P:refresh" # SHOW "refresh" AS

(DEFINED BELOW) + ]; + + %msg->{"default"}->{"en"} # THE MSG TEXT "default" IN "en" (ENGLISH): + = [ "Access to this site is blocked" ]; # + %msg->{"default"}->{"fr"} # THE MSG TEXT "default" IN "fr" (FRENCH): + = [ "L\'accès à ce site est bloqué" ]; # + %msg->{"default"}->{"de"} # THE MSG TEXT "default" IN "de" (GERMAN): + = [ "Zugriff verweigert" ]; # + %msg->{"default"}->{"nl"} # THE MSG TEXT "default" IN "nl" (DUTCH): + = [ "De toegang is geblokkeerd" ]; # + %msg->{"default"}->{"no"} # THE MSG TEXT "default" IN "no" (NORWEGIAN): + = [ "Siden er sperret" ]; # + + # THE "info" TABLE IN "en" (ENGLISH): + %tab->{"info"}->{"caption"}->{"en"} # THE "info" TABLE'S TITLE: + = [ "Additional information:" ]; # + %tab->{"info"}->{"clientaddr"}->{"en"} # THE "clientaddr" MSG OPTION: + = [ "Client address", "=", "\$clientaddr" ];# + %tab->{"info"}->{"clientname"}->{"en"} # THE "clientname" MSG OPTION: + = [ "Client name", "=", "\$clientname" ]; # + %tab->{"info"}->{"clientuser"}->{"en"} # THE "clientuser" MSG OPTION: + = [ "Client user", "=", "\$clientuser" ]; # + %tab->{"info"}->{"clientgroup"}->{"en"} # THE "clientgroup" MSG OPTION: + = [ "Client group", "=", "\$clientgroup" ]; # + %tab->{"info"}->{"url"}->{"en"} # THE "url" MSG OPTION: + = [ "URL", "=", "\$url" ]; # + %tab->{"info"}->{"domainurl"}->{"en"} # THE "domainurl" MSG OPTION: + = [ "URL", "=", "\$protocol://\$address\$port\$path" ]; + %tab->{"info"}->{"targetgroup"}->{"en"} # THE "targetgroup" MSG OPTION: + = [ "Target group", "=", "\$targetgroup" ]; # + + %tab->{"info"}->{"caption"}->{"fr"} # DITTO IN "fr" (FRENCH): + = [ "Information complémentaire:" ]; # --------- "" --------- + %tab->{"info"}->{"clientaddr"}->{"fr"} # --------- "" --------- + = [ "Adresse de la machine", "=", "\$clientaddr" ]; + %tab->{"info"}->{"clientname"}->{"fr"} # --------- "" --------- + = [ "Nom de la machine", "=", "\$clientname" ]; + %tab->{"info"}->{"clientuser"}->{"fr"} # --------- "" --------- + = [ "Utilisateur", "=", "\$clientuser" ]; # --------- "" --------- + %tab->{"info"}->{"clientgroup"}->{"fr"} # --------- "" --------- + = [ "Groupe", "=", "\$clientgroup" ]; # --------- "" --------- + %tab->{"info"}->{"url"}->{"fr"} # --------- "" --------- + = [ "URL", "=", "\$url" ]; # --------- "" --------- + %tab->{"info"}->{"domainurl"}->{"fr"} # --------- "" --------- + = [ "URL", "=", "\$protocol://\$address\$port\$path" ]; + %tab->{"info"}->{"targetgroup"}->{"fr"} # --------- "" --------- + = [ "Groupe cible", "=", "\$targetgroup" ]; # --------- "" --------- + + %tab->{"info"}->{"caption"}->{"de"} # DITTO IN "de" (GERMAN): + = [ "Zusatzinformationen:" ]; # --------- "" --------- + %tab->{"info"}->{"clientaddr"}->{"de"} # --------- "" --------- + = [ "IP-Adresse", "=", "\$clientaddr" ]; # --------- "" --------- + %tab->{"info"}->{"clientname"}->{"de"} # --------- "" --------- + = [ "Rechnername", "=", "\$clientname" ]; # --------- "" --------- + %tab->{"info"}->{"clientuser"}->{"de"} # --------- "" --------- + = [ "Benutzer", "=", "\$clientuser" ]; # --------- "" --------- + %tab->{"info"}->{"clientgroup"}->{"de"} # --------- "" --------- + = [ "Gruppe", "=", "\$clientgroup" ]; # --------- "" --------- + %tab->{"info"}->{"url"}->{"de"} # --------- "" --------- + = [ "URL", "=", "\$url" ]; # --------- "" --------- + %tab->{"info"}->{"domainurl"}->{"de"} # --------- "" --------- + = [ "URL", "=", "\$protocol://\$address\$port\$path" ]; + %tab->{"info"}->{"targetgroup"}->{"de"} # --------- "" --------- + = [ "Klassifizierung", "=", "\$targetgroup" ]; + + %tab->{"info"}->{"caption"}->{"nl"} # DITTO IN "nl" (DUTCH): + = [ "Extra informatie:" ]; # --------- "" --------- + %tab->{"info"}->{"clientaddr"}->{"nl"} # --------- "" --------- + = [ "Computeradres", "=", "\$clientaddr" ]; # --------- "" --------- + %tab->{"info"}->{"clientname"}->{"nl"} # --------- "" --------- + = [ "Computernaam", "=", "\$clientname" ]; # --------- "" --------- + %tab->{"info"}->{"clientuser"}->{"nl"} # --------- "" --------- + = [ "Gebruiker", "=", "\$clientuser" ]; # --------- "" --------- + %tab->{"info"}->{"clientgroup"}->{"nl"} # --------- "" --------- + = [ "Groep", "=", "\$clientgroup" ]; # --------- "" --------- + %tab->{"info"}->{"url"}->{"nl"} # --------- "" --------- + = [ "URL", "=", "\$url" ]; # --------- "" --------- + %tab->{"info"}->{"domainurl"}->{"nl"} # --------- "" --------- + = [ "URL", "=", "\$protocol://\$address\$port\$path" ]; + %tab->{"info"}->{"targetgroup"}->{"nl"} # --------- "" --------- + = [ "Doelgroep", "=", "\$targetgroup" ]; # --------- "" --------- + + %tab->{"info"}->{"caption"}->{"no"} # DITTO IN "no" (NORWEGIAN): + = [ "Tilleggsinformasjon:" ]; # --------- "" --------- + %tab->{"info"}->{"clientaddr"}->{"no"} # --------- "" --------- + = [ "Klientadresse", "=", "\$clientaddr" ]; # --------- "" --------- + %tab->{"info"}->{"clientname"}->{"no"} # --------- "" --------- + = [ "Klientnavn", "=", "\$clientname" ]; # --------- "" --------- + %tab->{"info"}->{"clientuser"}->{"no"} # --------- "" --------- + = [ "Brukerident", "=", "\$clientuser" ]; # --------- "" --------- + %tab->{"info"}->{"clientgroup"}->{"no"} # --------- "" --------- + = [ "Klientgruppe", "=", "\$clientgroup" ]; # --------- "" --------- + %tab->{"info"}->{"url"}->{"no"} # --------- "" --------- + = [ "URL", "=", "\$url" ]; # --------- "" --------- + %tab->{"info"}->{"domainurl"}->{"no"} # --------- "" --------- + = [ "URL", "=", "\$protocol://\$address\$port\$path" ]; + %tab->{"info"}->{"targetgroup"}->{"no"} # --------- "" --------- + = [ "Målkategori", "=", "\$targetgroup" ]; # --------- "" --------- + + %msg->{"proxymaster"}->{"en"} + = [ "If you think this is an error, send this page to", + "\$proxymaster" ]; + %msg->{"proxymaster"}->{"fr"} + = [ "Si vous pensez qu\'il s\'agit d\'une erreur, envoyez cette page à", + "\$proxymaster" ]; + %msg->{"proxymaster"}->{"de"} + = [ "Falls ein Fehler vorliegt schicken Sie die Adresse dieser Seite bitte an", + "\$proxymaster" ]; + %msg->{"proxymaster"}->{"nl"} + = [ "Als u denkt dat dit onjuist is, zend deze bladzijde aan", + "\$proxymaster" ]; + %msg->{"proxymaster"}->{"no"} + = [ "Om du mener dette er feil, så send denne siden til", + "\$proxymaster" ]; + + %msg->{"refresh"}->{"en"} + = [ "You may need to use the browser's \<\;Reload\>\; button
", + "or even \<\;Keyboard Shift\>\;+\<\;Browser Reload\>\;
", + "to get rid of this page after an access rule change" ]; + %msg->{"refresh"}->{"fr"} + = [ "Vous avez peut-être besoin d\'utiliser le bouton \<\;Recharger\>\;
", + "ou même \<\;Shift\>\;+\<\;Recharger\>\;
", + "après un changement de règles" ]; + %msg->{"refresh"}->{"de"} + = [ "Nach einer Änderung der Zugriffsrechte müssen Sie evtl. die Seite
", + "mit dem \<\;Aktualisieren\>\; bzw. \<\;Neu laden\>\; Button
", + "des Browsers oder sogar mit \<\;Strg\>\;+\<\;F5\>\;
", + "erneut laden lassen." ]; + %msg->{"refresh"}->{"nl"} + = [ "U moet waarschijnlijk de browser's \<\;Reload\>\; knop gebruiken
", + "of zelfs \<\;Shift\>\;+\<\;Reload\>\;
", + "na een verandering in de squidGuard regels" ]; + %msg->{"refresh"}->{"no"} + = [ "Du kan trenge å bruke browserens \<\;Reload\>\; knapp
", + "eller til og med", + "\<\;Tastatur Shift\>\;+\<\;Browser Reload\>\;
", + "for å bli kvitt denne siden etter endring i adgangskontrollen" ]; + + %msg->{"timerefresh"}->{"en"} + = [ "You may need to use the browser's \<\;Reload\>\; button
", + "or even \<\;Keyboard Shift\>\;+\<\;Browser Reload\>\;
", + "to get rid of this page after transition from
", + "a time zone with access restrictions" ]; + %msg->{"timerefresh"}->{"fr"} + = [ "Vous avez peut-être besoin d\'utiliser le bouton \<\;Recharger\>\;
", + "ou même \<\;Shift\>\;+\<\;Recharger\>\;
", + "après un changement de zone temporelle d\'interdiction" ]; + %msg->{"timerefresh"}->{"de"} + = [ "Nach dem Wechsel in eine erlaubte Zeitperiode müssen Sie evtl. die Seite
", + "mit dem \<\;Aktualisieren\>\; bzw. \<\;Neu laden\>\; Button des Browsers
", + "oder sogar mit \<\;Strg\>\;+\<\;F5\>\; erneut laden lassen." ]; + %msg->{"timerefresh"}->{"nl"} + = [ "U moet waarschijnlijk de browser's \<\;Reload\>\; knop gebruiken
", + "of zelfs \<\;Shift\>\;+\<\;Reload\>\;
", + "na beeindiging van een periode met beperkingen" ]; + %msg->{"timerefresh"}->{"no"} + = [ "Du kan trenge å bruke browserens \<\;Reload\>\; knapp
", + "eller til og med", + "\<\;Tastatur Shift\>\;+\<\;Browser Reload\>\;
", + "for å bli kvitt denne siden ved overgang fra", + "et tidsrom med sperring" ]; + + %msg->{"unknown"}->{"en"} + = [ "Access denied because
", + "your clienten is
", + "unknown to \$proxy"]; + %msg->{"unknown"}->{"fr"} + = [ "Accès interdit car
", + "votre client est
", + "inconnu de \$proxy"]; + %msg->{"unknown"}->{"de"} + = [ "Zugriff verweigert,
", + "da Ihr Rechner bei
", + "\$proxy unbekannt ist."]; + %msg->{"unknown"}->{"nl"} + = [ "Toegand geweigerd omdat
", + "uw client niet
", + "bekend is bij \$proxy"]; + %msg->{"unknown"}->{"no"} + = [ "Adgang nektes fordi
", + "denne klienten ikke er
", + "definert på \$proxy" ]; + + %msg->{"in-addr"}->{"en"} + = [ "Surfing on plain IP-addresses
", + "is denied from this client
", + "for security reasons" ]; + %msg->{"in-addr"}->{"fr"} + = [ "Naviguer sur des adresses IP
", + "est refusé à cette machine
", + "pour des raisons de sécurité" ]; + %msg->{"in-addr"}->{"de"} + = [ "Die direkte Verwendung von IP-Adressen
", + "ist von diesem Rechner aus Sicherheitsgünden
", + "nicht erlaubt." ]; + %msg->{"in-addr"}->{"nl"} + = [ "Surfen naar harde IP adressen
", + "wordt op deze client geweigerd
", + "om veiligheidsredenen" ]; + %msg->{"in-addr"}->{"no"} + = [ "Av sikkerhetsgrunner er
", + "surfing på IP-adresser
", + "ikke tillatt fra denne klienten" ]; + + %msg->{"alternatives"}->{"en"} + = [ "The following possible alternatives were found:" ]; + %msg->{"alternatives"}->{"fr"} + = [ "Les alternatives suivantes sont possibles:" ]; + %msg->{"alternatives"}->{"de"} + = [ "Die folgenden Alternativen wurden gefunden:" ]; + %msg->{"alternatives"}->{"nl"} + = [ "De volgende alternatieven zijn mogelijk:" ]; + %msg->{"alternatives"}->{"no"} + = [ "Følgende mulige alternativer ble funnet:" ]; + + %msg->{"noalternatives"}->{"en"} + = [ "No alternative domainname were found
", + "for the server \$address" ]; + %msg->{"noalternatives"}->{"fr"} + = [ "Aucun nom de domaine alternatif n\'a été
", + "trouvé pour le serveur \$address" ]; + %msg->{"noalternatives"}->{"de"} + = [ "Es konnte kein alternativer Domainname für den
", + "Server \$address gefunden werden" ]; + %msg->{"noalternatives"}->{"nl"} + = [ "Geen alternatieve domeinnaam gevonden
", + "voor de server \$address" ]; + %msg->{"noalternatives"}->{"no"} + = [ "Finner ingen alternative domenenavn
", + " for serveren \$address" ]; + + %msg->{"referermaster"}->{"en"} + = [ "Send complaints to the", + "webmaster
", + "of \$referer
", + "and ask him to correct the link(s) that points to \$url
", + "in \$referer,
", + "with the supposedly correct alternative above" ]; + %msg->{"referermaster"}->{"fr"} + = [ "Envoyez les demandes au", + "webmaster
", + "de \$referer
", + "et demandez lui corriger les liens qui pointent sur \$url
", + "dans \$referer,
", + "avec l\'alternative (supposée correcte) suivante" ]; + %msg->{"referermaster"}->{"de"} + = [ "Benachrichtigen Sie den", + "Webmaster
", + "von \$referer
", + "und bitten Sie ihn die auf \$url verweisenden Links
", + "in \$referer,
", + "auf die vermutlich korrekte oben angezeigte Alternative zu setzen." ]; + %msg->{"referermaster"}->{"nl"} + = [ "Zend klachten aan", + "webmaster
", + "de \$referer
", + "en vraag deze de link te verbeteren die verwijst naar \$url
", + "op \$referer,
", + "met het waarschijnlijk correcte alternatief" ]; + %msg->{"referermaster"}->{"no"} + = [ "Send evt. klager til", + "webmaster
", + "for \$referer
", + "og be ham rette linken(e) som peker til \$url
", + "i \$referer,
", + "med det antatt korrekte alternativet over" ]; + + %msg->{"webmaster"}->{"en"} + = [ "Send complaints to the webmaster", + "for \$protocol://\$address
", + "and request for a domainname to the server" ]; + %msg->{"webmaster"}->{"fr"} + = [ "Envoyez les demandes au webmaster", + "pour \$protocol://\$address
", + "et demandez un nom de domaine pour le serveur" ]; + %msg->{"webmaster"}->{"de"} + = [ "Fragen Sie den Webmaster", + "von \$protocol://\$address
", + "nach einem Domainnamen für den Server" ]; + %msg->{"webmaster"}->{"nl"} + = [ "Stuur klachten aan de webmaster", + "voor \$protocol://\$address
", + "en vraag om een domeinnaam voor de server" ]; + %msg->{"webmaster"}->{"no"} + = [ "Send evt. klager til webmaster", + "for \$protocol://\$address
", + "og anmod om å få knyttet serveren til et domenenavn" ]; + + %msg->{"deflang"}->{"en"} + = [ "This message is in English because \\\"en\\\"", + "is the first supported language
", + "of those your browser is set up", + "to report as prefered.
", + "Supported languages are:", + @supported ]; + %msg->{"deflang"}->{"fr"} + = [ "Ce message est en français car \\\"fr\\\"", + "est la première langue supportée
", + "parmi celles que votre navigateur signale comme", + "préférée.
", + "Les langues supportées sont:", + @supported ]; + %msg->{"deflang"}->{"de"} + = [ "Dieser Text erscheint in Deutsch, \\\"de\\\"", + "da Ihr Browser dies als bevorzugte
", + "(erste) Sprache einstellt hat.
", + "Unterstützte Sprachen:", + @supported ]; + %msg->{"deflang"}->{"nl"} + = [ "Deze melding is in het Nederlands want \\\"nl\\\"", + "is de eerst ondersteunde taal
", + "van de talen die uw browser ondersteunt.", + "
", + "De ondersteunde talen zijn:", + @supported ]; + %msg->{"deflang"}->{"no"} + = [ "Denne meldingen er på norsk fordi \\\"no\\\"", + "er det første støttede sproget
", + "av de din nettleser er satt opp til", + "å rapportere som foretrukket.
", + "Støttede sprog er:", + @supported ]; + + %logo->{"default"}->{"url"} + = "http://www.squidguard.org/images/squidGuard.gif"; + %logo->{"default"}->{"href"} + = "http://www.squidguard.org/"; + + %logo->{"default"}->{"url"} + = "http://info.ost.eltele.no/images/eto.small.gif"; + %logo->{"default"}->{"href"} + = "http://www.ost.eltele.no/"; +} +# +# END OF CONFIGURABLE OPTIONS +# + +# +# SUBROUTINES: +# + +# +# RETURN THE FIRST SUPPORTED LANGUAGE OF THE BROWSERS PREFERRED OR THE +# DEFAULT: +# +sub getpreferedlang(@) { + my @supported = @_; + my @languages = split(/\s*,\s*/,$ENV{"HTTP_ACCEPT_LANGUAGE"}) if(defined($ENV{"HTTP_ACCEPT_LANGUAGE"})); + my $lang; + my $supp; + push(@languages,$supported[0]); + for $lang (@languages) { + $lang =~ s/\s.*//; + for $supp (@supported) { + $supp =~ s/\s.*//; + return($lang) if ($lang eq $supp); + } + } +} + +# +# PARSE THE QUERY_STRING FOR KNOWN KEYS: +# +sub parsequery($) { + my $query = shift; + my $clientaddr = %word->{"unknown"}->{$lang}; + my $clientname = %word->{"unknown"}->{$lang}; + my $clientuser = %word->{"unknown"}->{$lang}; + my $clientgroup = %word->{"unknown"}->{$lang}; + my $targetgroup = %word->{"unknown"}->{$lang}; + my $url = %word->{"unknown"}->{$lang}; + if (defined($query)) { + while ($query =~ /^\&?([^\&=]+)=\"([^\"]*)\"(.*)/ || $query =~ /^\&?([^\&=]+)=([^\&=]*)(.*)/) { + my $key = $1; + my $value = $2; + $value = %word->{"unknown"}->{$lang} unless(defined($value) && $value && $value ne "unknown"); + $query = $3; + if ($key =~ /^(clientaddr|clientname|clientuser|clientgroup|targetgroup|url)$/) { + eval "\$$key = \$value"; + } + if ($query =~ /^url=(.*)/) { + $url = $1; + last; + } + } + } + return($clientaddr,$clientname,$clientuser,$clientgroup,$targetgroup,$url); +} + +# +# PRINT HTTP STATUS HEARER: +# +sub status($) { + my $status = shift; + print "Status: $status\n"; +} + +# +# PRINT HTTP LOCATION HEARER: +# +sub redirect($) { + my $location = shift; + print "Location: $location\n"; +} + +# +# PRINT HTTP CONTENT-TYPE HEARER: +# +sub content($) { + my $contenttype = shift; + print "Content-Type: $contenttype\n"; +} + +# +# PRINT HTTP LAST-MODIFIED AND EXPIRES HEARER: +# +sub expires($) { + my $ttl = shift; + my $time = time; + my @day = ("Sun","Mon","Tue","Wed","Thu","Fri","Sat"); + my @month = ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"); + my ($sec,$min,$hour,$mday,$mon,$year,$wday) = gmtime($time); + printf "Last-Modified: %s, %d %s %d", $day[$wday],$mday,$month[$mon],$year+1900; + printf " %02d:%02d:%02d GMT\n", $hour,$min,$sec; + ($sec,$min,$hour,$mday,$mon,$year,$wday) = gmtime($time+$ttl); + printf "Expires: %s, %d %s %d", $day[$wday],$mday,$month[$mon],$year+1900; + printf " %02d:%02d:%02d GMT\n", $hour,$min,$sec; +} + +# +# PRINT THE INITIAL HTML TAGS FOR HTML, HEAD, TITLE BODY AND H1: +# +sub title($) { + my $msgid = shift; + my $defl = $supported[0]; + my $text; + $defl =~ s/\s.*//; + print "\n\n"; + print " \n \n"; + if (defined($msg{$msgid}{$lang})) { + for $text (@{$title{$msgid}{$lang}}) { + eval "\$text = \"$text\""; + print " $text\n"; + } + } else { + for $text (@{$title{"default"}{$lang}}) { + eval "\$text = \"$text\""; + print " $text\n"; + } + } + print " \n \n"; + print " \n"; + print "

\n"; + print " \n"; + print " \n"; + print " \n"; + print " \n"; + if ($lang eq $defl && defined($msg{"deflang"}{$lang})) { + print " \n"; + print " \n"; + print " \n"; + } + print "
\n"; + print " \n"; + print " \n \n"; + if (defined($msg{$msgid}{$lang})) { + for $text (@{$title{$msgid}{$lang}}) { + eval "\$text = \"$text\""; + print " $text\n"; + } + } else { + for $text (@{$title{"default"}{$lang}}) { + eval "\$text = \"$text\""; + print " $text\n"; + } + } + print " \n \n"; + print " \n"; + print " \n"; + if (defined($logo{$msgid}{"url"})) { + print " \n"; + } else { + print " SRC=\"$logo{\"default\"}{\"url\"}\" BORDER=0 ALIGN=TOP>\n"; + } + print "
\n"; + print " \n"; + print " \n"; + for $text (@{$msg{"deflang"}{$lang}}) { + eval "\$text = \"$text\""; + print " $text\n"; + } + print " \n"; + print " \n"; + print "
\n"; +} + +# +# PRINT THE ENDING HTML TAGS FOR BODY AND HTML: +# +sub terminator() { + print " \n\n"; +} + +# +# PRINT A MESSAGE WITH THE SPECIFIED TYPE (P,H1,H2,..): +# +sub msg($$) { + my ($type,$msgid) = @_; + my $text; + print " <$type ALIGN=CENTER>\n"; + if (defined($msg{$msgid}{$lang})) { + for $text (@{$msg{$msgid}{$lang}}) { + eval "\$text = \"$text\""; + print " $text\n"; + } + } else { + print " ERROR: missing message \"$msgid\"\n"; + } + print " \n"; +} + +# +# PRINT A TABLE WITH THE SPECIFIED FORMAT: +# +sub table($$@) { + my @format = split(/,/,shift); + my $table = shift; + my $cols = @format; + my @msgids = @_; + my $msgid; + my $text; + my %type; + %type->{"L"} = [ "", "" ]; + %type->{"C"} = [ "", "" ]; + %type->{"R"} = [ "", "" ]; + %type->{"l"} = [ "", "" ]; + %type->{"c"} = [ "", "" ]; + %type->{"r"} = [ "", "" ]; + print " \n"; + if (defined($tab{$table})) { + if (defined($tab{$table}{"caption"}{$lang})) { + #print " \n"; + } + for $msgid (@msgids) { + print " \n"; + if (defined($tab{$table}{$msgid}{$lang})) { + my $i = 0; + for $text (@{$tab{$table}{$msgid}{$lang}}) { + eval "\$text = \"$text\""; + print " $type{$format[$i]}[0]\n"; + print " $text\n"; + print " $type{$format[$i]}[1]\n"; + $i++; + } + } else { + print " $type{$format[0]}[0]\n"; + print " ERROR: missing table message \"$msgid\"\n"; + print " $type{$format[0]}[1]\n"; + } + print " \n"; + } + } else { + print " \n"; + print " \n"; + print " \n"; + } + print "
\n"; + print "
\n"; + print " \n"; + for $text (@{$tab{$table}{"caption"}{$lang}}) { + eval "\$text = \"$text\""; + print " $text\n"; + } + print " \n"; + #print " \n"; + print "
\n"; + print " ERROR: missing message \"$msgid\"\n"; + print "
\n"; +} + +# +# PRINT A LINK HREF: +# +sub href($) { + my $href = shift; + print "$href"; +} + +# +# REVERSE LOOKUP AND RETURN NAMES: +# +sub gethostnames($) { + my $address = shift; + my ($name,$aliases) = gethostbyaddr(inet_aton($address), AF_INET); + my @names; + if (defined($name)) { + push(@names,$name); + if (defined($aliases) && $aliases) { + for(split(/\s+/,$aliases)) { + next unless(/\./); + push(@names,$_); + } + } + } + return(@names); +} + +# +# SPLIT AN URL INTO PROTOCOL, ADDRESS, PORT AND PATH: +# +sub spliturl($) { + my $url = shift; + my $protocol = ""; + my $address = ""; + my $port = ""; + my $path = ""; + $url =~ /^([^\/:]+):\/\/([^\/:]+)(:\d*)?(.*)/; + $protocol = $1 if(defined($1)); + $address = $2 if(defined($2)); + $port = $3 if(defined($3)); + $path = $4 if(defined($4)); + return($protocol,$address,$port,$path); +} + +# +# SHOW THE CONFIGURED MESSAGE AS HTML: +# +sub showhtml($) { + my $msgid = shift; + status("403 Forbidden"); + content("text/html"); + expires(0); + title($msgid); + $msgid = "default" unless(defined($msgconf{$msgid})); + if (defined($msgconf{$msgid})) { + print " \n"; + for (@{$msgconf{$msgid}}) { + my @config = split(/:/); + my $type = shift(@config); + if ($type eq "msg") { + msg($config[0],$config[1]); + } elsif ($type eq "tab") { + table(shift(@config),shift(@config),@config); + } + } + } else { + print "

ERROR: missing msgconf for \"$msgid\"

\n"; + } + terminator(); +} + +# +# SEND OUT AN IMAGE: +# +sub showimage($$$) { + my ($type,$file,$redirect) = @_; + content("image/$type"); + expires(300); + redirect($redirect) if($redirect); + print "\n"; + open(GIF, "$ENV{\"DOCUMENT_ROOT\"}$file"); + print ; + close(GIF) +} + +# +# SHOW THE INADDR ALERNATIVES WITH OPTIONAL ATOREDIRECT: +# +sub showinaddr($$$$$) { + my ($targetgroup,$protocol,$address,$port,$path) = @_; + my $msgid = $targetgroup; + my @names = gethostnames($address); + if($autoinaddr == 2 && @names || $autoinaddr && @names==1) { + status("301 Moved Permanently"); + redirect("$protocol://$names[0]$port$path"); + } elsif (@names>1) { + status("300 Multiple Choices"); + } elsif (@names) { + status("301 Moved Permanently"); + } else { + status("404 Not Found"); + } + if ($path =~ /\.(gif|jpg|jpeg|mp3|mpg|mpeg|avi|mov)$/i) { + showimage("gif",$image,$redirect); + } elsif (@names) { + content("text/html"); + expires(0); + title($msgid); + $msgid = "in-addr" unless(defined($msgconf{$msgid})); + if (defined($msgconf{$msgid})) { + print " \n"; + for (@{$msgconf{$msgid}}) { + my @config = split(/:/); + my $type = shift(@config); + if ($type eq "msg") { + msg($config[0],$config[1]); + } elsif ($type eq "tab") { + table(shift(@config),shift(@config),@config); + } elsif ($type eq "alternatives") { + print " \n"; + for (@names) { + print " \n \n \n"; + } + print "
\n "; + href("$protocol://$_$port$path"); + print "\n \n
\n\n"; + if (defined($ENV{"HTTP_REFERER"}) && $ENV{"HTTP_REFERER"} =~ /:\/\/([^\/:]+)/) { + $refererhost = $1; + $referer = $ENV{"HTTP_REFERER"}; + msg("H4","referermaster"); + } + } + } + } else { + print "

ERROR: missing msgconf for \"$msgid\"

\n"; + } + terminator(); + } else { + showhtml("noalternatives"); + } +} + +# +# NOW JUST DO IT: +# +msginit(); +if ($targetgroup eq "in-addr") { + showinaddr($targetgroup,$protocol,$address,$port,$path); +} elsif ($url =~ /\.(gif|jpg|jpeg|mp3|mpg|mpeg|avi|mov)$/i) { + status("403 Forbidden"); + showimage("gif",$image,$redirect); +} else { + showhtml($clientgroup); +} +exit 0; diff --git a/squidguard-1.6.0-gcc10.patch b/squidguard-1.6.0-gcc10.patch new file mode 100644 index 0000000..fd41a0f --- /dev/null +++ b/squidguard-1.6.0-gcc10.patch @@ -0,0 +1,54 @@ +--- src/y.tab.c.bison 2020-03-08 20:05:00.750000000 +0300 ++++ src/y.tab.c.bison 2020-03-08 20:04:42.160000000 +0300 +@@ -217,7 +217,7 @@ + + #include "sgEx.h" + +-FILE *yyin, *yyout; ++extern FILE *yyin, *yyout; + char *configFile; + + int numTimeElements; +--- src/sg.h.in 2020-03-08 20:02:46.900000000 +0300 ++++ src/sg.h.in 2020-03-08 20:03:22.110000000 +0300 +@@ -115,7 +115,7 @@ + #define REDIRECT_PERMANENT "301:" + #define REDIRECT_TEMPORARILY "302:" + +-char *progname; ++extern char *progname; + + struct LogFileStat { + char *name; +@@ -337,7 +337,7 @@ + struct AclDest *next; + }; + +-int lineno; ++extern int lineno; + + char *sgParseRedirect __P((char *, struct SquidInfo *, struct Acl *, struct AclDest *)); + char *sgAclAccess __P((struct Source *, struct Acl *, struct SquidInfo *)); +--- src/main.c.in 2020-03-08 20:10:55.650000000 +0300 ++++ src/main.c.in 2020-03-08 20:11:13.590000000 +0300 +@@ -21,6 +21,9 @@ + #include + #endif + ++char *progname; ++int lineno; ++ + struct Setting *lastSetting = NULL; + struct Setting *Setting = NULL; /* linked list, Calloc */ + +--- src/sg.y.in 2020-03-08 20:14:46.180000000 +0300 ++++ src/sg.y.in 2020-03-08 20:14:57.110000000 +0300 +@@ -35,7 +35,7 @@ + + #include "sgEx.h" + +-FILE *yyin, *yyout; ++extern FILE *yyin, *yyout; + char *configFile; + + int numTimeElements; diff --git a/squidguard.spec b/squidguard.spec new file mode 100644 index 0000000..f6f8678 --- /dev/null +++ b/squidguard.spec @@ -0,0 +1,136 @@ +Name: squidguard +Version: 1.6.0 +Release: 1mamba +Summary: An ultrafast and free filter, redirector and access controller for Squid +Group: Network/Monitoring +Vendor: openmamba +Distribution: openmamba +Packager: Silvan Calarco +URL: https://web.archive.org/web/20220728071047/http://www.squidguard.org/ +Source: https://launchpad.net/debian/+archive/primary/+sourcefiles/squidguard/%{version}-1/squidguard_%{version}.orig.tar.gz +#Source: http://www.squidguard.org/Downloads/squidGuard-%{version}.tar.gz +Source3: squidGuard.cgi +Patch0: squidGuard-1.4-patch-20091015.patch +Patch1: squidGuard-1.4-patch-20091019.patch +Patch2: squidGuard-1.4-configdir.patch +Patch3: squidGuard-1.4-cgi_it.patch +Patch4: squidguard-1.6.0-gcc10.patch +License: GPL +## AUTOBUILDREQ-BEGIN +BuildRequires: glibc-devel +BuildRequires: libdb53-devel +BuildRequires: libopenldap-devel +BuildRequires: libperl +BuildRequires: perl-devel +## AUTOBUILDREQ-END +Requires(post):squid +Requires: apache +Requires: squidguard_blacklists +Provides: squidGuard +Obsoletes: squidGuard < 1.6.0 + +%description +SquidGuard is an ultrafast and free filter, redirector and access controller for Squid. + +%prep +%setup -q +#%patch0 -p0 +#%patch1 -p0 +%patch2 -p1 +#%patch3 -p1 +%patch4 -p0 -b .gcc10 + +#sed -i "s|-ldb|-ldb-4.8|" configure +./autogen.sh + +%build +%configure \ + --sysconfdir=%{_sysconfdir}/squid \ + --with-ldap \ + --with-sg-config=%{_sysconfdir}/squid/squidGuard.conf \ + --with-sg-dbhome=/var/lib/squidGuard \ + --with-sg-logdir=/var/log/squid/ + +# --with-mysql \ +# --with-db=%{_prefix} \ +# --with-db-inc=%{_includedir}/db4 \ + +%make + +cd samples +make clean +make +cd .. + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%makeoldinstall SQUIDUSER=`id -u` \ + dbhomedir=%{buildroot}/var/lib \ + configfile=%{buildroot}%{_sysconfdir}/squid/squidGuard.conf.sample + +install -D -m0755 samples/squidGuard.cgi %{buildroot}/var/www/cgi-bin/squidGuard.cgi +cp -a samples/babel.* %{buildroot}/var/www/cgi-bin/ + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%post +if [ $1 -ge 1 ]; then + grep squidGuard %{_sysconfdir}/squid/squid.conf &>/dev/null || { + cat >> %{_sysconfdir}/squid/squid.conf << _EOF +#url_rewrite_program %{_bindir}/squidGuard -c %{_sysconfdir}/squid/squidGuard.conf +#url_rewrite_children 5 +_EOF + } +# service squid status >/dev/null +# [ $? -eq 0 ] && service squid reload +fi +: + +%preun +# uninstall +if [ $1 -eq 0 ]; then + sed -i '/^url_rewrite_program .*/d' %{_sysconfdir}/squid/squid.conf + sed -i '/^url_rewrite_children .*/d' %{_sysconfdir}/squid/squid.conf + #service squid status >/dev/null + #[ $? -eq 0 ] && service squid reload +fi +: + +%files +%defattr(-,root,root) +%{_sysconfdir}/squid/squidGuard.conf.sample +%{_bindir}/squidGuard +%config(noreplace) %attr(0755,root,root) %{_localstatedir}/www/cgi-bin/squidGuard.cgi +%attr(0644,root,root) %{_localstatedir}/www/cgi-bin/babel.* + +%changelog +* Sat Nov 26 2022 Silvan Calarco 1.6.0-1mamba +- update to 1.6.0 + +* Thu Apr 28 2011 Silvan Calarco 1.4-3mamba +- added patch to find configuration file without -c parameter to work with squidclamav +- disable squid configuration by default to allow usage through icap and squidclamav +- added italian cgi translation support and restored upstream cgi + +* Tue Apr 12 2011 Silvan Calarco 1.4-2mamba +- added patches from official site +- require external blacklist package + +* Mon May 18 2009 Silvan Calarco 1.4-1mamba +- update to 1.4 + +* Thu Oct 05 2006 Davide Madrisan 1.2.0-4qilnx +- database definitions updated to 20051119 +- fixed compilation problems + +* Wed May 26 2004 Silvan Calarco 1.2.0-3qilnx +- rebuilt and correctly linked with libdb3 + +* Wed Jan 14 2004 Silvan Calarco 1.2.0-2qilnx +- changed libdir permissions from nobody.nobody to squid.squid +- database definitions updated to 20040114 + +* Tue Jun 10 2003 Silvan Calarco 1.2.0-1qilnx +- creation of squidGuard package