update to squidguard-1.6.0, add -fno-common fix from gentoo

This commit is contained in:
sthen 2021-02-04 15:25:50 +00:00
parent ab6d4339bc
commit 595e32130b
12 changed files with 100 additions and 208 deletions

View File

@ -1,9 +1,12 @@
# $OpenBSD: Makefile,v 1.30 2019/07/12 20:51:05 sthen Exp $
# $OpenBSD: Makefile,v 1.31 2021/02/04 15:25:50 sthen Exp $
COMMENT = filter, redirector and access controller for Squid
DISTNAME = squidGuard-1.4
REVISION = 15
V = 1.6.0
DISTNAME = squidguard_$V
PKGNAME = squidGuard-$V
EXTRACT_SUFX = .orig.tar.gz
WRKDIST = ${WRKDIR}/squidguard-$V
CATEGORIES = www
FIX_EXTRACT_PERMISSIONS=Yes
@ -14,7 +17,7 @@ PERMIT_PACKAGE = Yes
WANTLIB = c lib/db4/db pthread
MASTER_SITES = http://www.squidguard.org/Downloads/
MASTER_SITES = ${MASTER_SITE_DEBIAN:=main/s/squidguard/}
LOCALSTATEDIR= ${BASELOCALSTATEDIR}/db/squidGuard
CONFIG_DIR = ${SYSCONFDIR}/squidguard
@ -26,9 +29,14 @@ BUILD_DEPENDS = ${RUN_DEPENDS}
CONFIGURE_ENV = CFLAGS='${CFLAGS} -I${LOCALBASE}/include' \
LDFLAGS='${LDFLAGS} -L${LOCALBASE}/lib' \
ac_cv_path_LYNX=false
CONFIGURE_STYLE = gnu
ac_cv_path_LYNX=false \
YACC=/usr/bin/yacc
CONFIGURE_STYLE = autoreconf
AUTOCONF_VERSION = 2.69
AUTOMAKE_VERSION = 1.16
AUTORECONF = ${WRKSRC}/autogen.sh
CONFIGURE_ARGS = --with-squiduser='_squid' \
--with-mysql=no \
--with-sg-logdir=/var/log/squidguard \
--with-sg-dbhome=${LOCALSTATEDIR}/db \
--with-sg-config=${CONFIG_DIR}/squidguard.conf \
@ -37,7 +45,7 @@ CONFIGURE_ARGS = --with-squiduser='_squid' \
TEST_TARGET = test
FLAVORS = ldap mysql
FLAVORS = ldap
FLAVOR ?=
.if ${FLAVOR:Mldap}
@ -48,14 +56,6 @@ CONFIGURE_ARGS += --with-ldap=yes
CONFIGURE_ARGS += --with-ldap=no
.endif
.if ${FLAVOR:Mmysql}
LIB_DEPENDS += databases/mariadb
CONFIGURE_ARGS += --with-mysql=${LOCALBASE}
WANTLIB += mysqlclient z
.else
CONFIGURE_ARGS += --with-mysql=no
.endif
pre-configure:
@perl -pi -e "s,\@prefix\@\/squidGuard/squidGuard.conf,\@cfgdir\@\/squidguard/squidguard.conf," ${WRKSRC}/src/sg.h.in
@perl -pi -e "s,\@prefix\@\/squidGuard/log,\@logdir\@\/squidGuard," ${WRKSRC}/src/sg.h.in

View File

@ -1,2 +1,2 @@
SHA256 (squidGuard-1.4.tar.gz) = BxHOYLjiu7oQe5gP7URqiN814VhLOfB5wMrlShcsUUE=
SIZE (squidGuard-1.4.tar.gz) = 1968492
SHA256 (squidguard_1.6.0.orig.tar.gz) = PeDWS38bS2neFtMWikOMjfKEGQQeD9r5RG56RZnmErU=
SIZE (squidguard_1.6.0.orig.tar.gz) = 1902233

View File

@ -0,0 +1,22 @@
$OpenBSD: patch-src_Makefile_in,v 1.1 2021/02/04 15:25:50 sthen Exp $
Index: src/Makefile.in
--- src/Makefile.in.orig
+++ src/Makefile.in
@@ -96,12 +96,16 @@ y.tab.c y.tab.h: sg.y sg.h
echo " " ; \
echo "No yacc/bison found. Copy prepared files for y.tab.h and y.tab.c over. " ; \
echo " " ; \
+ echo "cp y.tab.h.bison y.tab.h" ; \
+ echo "cp y.tab.c.bison y.tab.c" ; \
cp y.tab.h.bison y.tab.h ; \
cp y.tab.c.bison y.tab.c ; \
else \
+ echo "$(YACC) -d sg.y" ; \
$(YACC) -d sg.y ; \
fi ; \
else \
+ echo "$(YACC) -d sg.y" ; \
$(YACC) -d sg.y ; \
fi ;

View File

@ -1,55 +0,0 @@
--- src/main.c.orig Sat Aug 30 12:27:41 2008
+++ src/main.c Thu May 15 16:32:39 2014
Fix broken use of the old squid-2.5 helper protocol, see
http://bugs.squid-cache.org/show_bug.cgi?id=3978#c3
@@ -175,7 +175,7 @@ int main(argc, argv, envp)
sgReloadConfig();
}
if(failsafe_mode) {
- puts("");
+ puts("ERR message=\"squidGuard failsafe mode\"");
fflush(stdout);
if(sig_hup){
sgReloadConfig();
@@ -184,7 +184,7 @@ int main(argc, argv, envp)
}
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 @@ int main(argc, argv, envp)
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 @@ int main(argc, argv, envp)
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;
}

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-src_main_c_in,v 1.1 2021/02/04 15:25:50 sthen Exp $
Index: src/main.c.in
--- src/main.c.in.orig
+++ src/main.c.in
@@ -21,6 +21,9 @@
#include <syslog.h>
#endif
+char *progname;
+int lineno;
+
struct Setting *lastSetting = NULL;
struct Setting *Setting = NULL; /* linked list, Calloc */

View File

@ -1,31 +0,0 @@
$OpenBSD: patch-src_sgDiv_c_in,v 1.2 2014/04/25 16:35:42 sthen Exp $
First hunk:
squidGuard 1.4 patch 20091019; when constructing a redirect URL which
includes the requested URL, truncate it to make sure it's smaller than
squid's MAX_URL.
Second hunk: fix broken use of the old squid-2.5 helper protocol, see
http://bugs.squid-cache.org/show_bug.cgi?id=3978#c3
--- src/sgDiv.c.in.orig Mon Jul 14 17:02:43 2008
+++ src/sgDiv.c.in Fri Apr 25 17:25:31 2014
@@ -745,7 +745,7 @@ char *sgParseRedirect(redirect, req, acl, aclpass)
p++;
break;
case 'u': /* Requested URL */
- strcat(buf, req->orig);
+ strncat(buf, req->orig, 2048);
p++;
break;
default:
@@ -782,7 +782,7 @@ void sgEmergency ()
}
sgLogError("Going into emergency mode");
while(fgets(buf, MAX_BUF, stdin) != NULL){
- puts("");
+ puts("ERR");
fflush(stdout);
}
sgLogError("ending emergency mode, stdin empty");

View File

@ -1,48 +0,0 @@
$OpenBSD: patch-src_sgLog_c,v 1.1 2010/02/09 13:44:28 sthen Exp $
squidGuard 1.4 patch 20091015; buffer overflows.
--- src/sgLog.c.orig Fri Nov 16 16:58:32 2007
+++ src/sgLog.c Wed Feb 3 12:26:15 2010
@@ -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 @@ void sgLog(log, format, va_alist)
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 @@ void sgLogError(format, va_alist)
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 @@ void sgLogFatalError(format, va_alist)
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();

View File

@ -1,27 +1,36 @@
$OpenBSD: patch-src_sg_h_in,v 1.2 2013/08/12 20:01:49 jeremy Exp $
$OpenBSD: patch-src_sg_h_in,v 1.3 2021/02/04 15:25:50 sthen Exp $
squidGuard 1.4 patch 20091019; increase MAX_BUF above squid's MAX_URL value.
Fix segfault on 64-bit due to calling an undeclared function. The function
is supposed to return a pointer (64-bit) but when undeclared returns an int
(32-bit).
--- src/sg.h.in.orig Fri Nov 16 08:58:32 2007
+++ src/sg.h.in Mon Aug 12 02:40:28 2013
@@ -73,7 +73,7 @@ int tolower();
#define REQUEST_TYPE_REDIRECT 2
#define REQUEST_TYPE_PASS 3
-#define MAX_BUF 4096
+#define MAX_BUF 12288
#define DEFAULT_LOGFILE "squidGuard.log"
Index: src/sg.h.in
--- src/sg.h.in.orig
+++ src/sg.h.in
@@ -80,9 +80,9 @@ int tolower();
#define WARNING_LOGFILE "squidGuard.log"
@@ -412,6 +412,7 @@ char *niso __P((time_t));
struct UserQuotaInfo *setuserquota __P(());
void sgSourceUserQuota __P((char *, char *, char *));
#define ERROR_LOGFILE "squidGuard.error"
+struct UserInfo *setuserinfo();
-#define DEFAULT_CONFIGFILE "@prefix@/squidGuard/squidGuard.conf"
-#define DEFAULT_LOGDIR "@prefix@/squidGuard/log"
-#define DEFAULT_DBHOME "@prefix@/squidGuard/db"
+#define DEFAULT_CONFIGFILE "@cfgdir@/squidguard/squidguard.conf"
+#define DEFAULT_LOGDIR "@logdir@/squidGuard"
+#define DEFAULT_DBHOME "@logdir@/squidGuard/db"
#define EXEC_PROGRAM "@prefix@/bin/squidGuard"
void *sgMalloc __P((size_t));
void *sgCalloc __P((size_t, size_t));
#ifdef ACCONFIG
@@ -115,7 +115,7 @@ int tolower();
#define REDIRECT_PERMANENT "301:"
#define REDIRECT_TEMPORARILY "302:"
-char *progname;
+extern char *progname;
struct LogFileStat {
char *name;
@@ -337,7 +337,7 @@ struct AclDest {
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 *));

View File

@ -1,17 +1,14 @@
$OpenBSD: patch-src_sg_y_in,v 1.1 2009/04/09 23:53:13 sthen Exp $
--- src/sg.y.in.orig Tue Feb 17 19:49:53 2009
+++ src/sg.y.in Tue Feb 17 19:50:27 2009
@@ -22,8 +22,11 @@
extern int globalDebug;
$OpenBSD: patch-src_sg_y_in,v 1.2 2021/02/04 15:25:50 sthen Exp $
Index: src/sg.y.in
--- src/sg.y.in.orig
+++ src/sg.y.in
@@ -35,7 +35,7 @@ extern int globalSyslog;
#ifdef HAVE_LIBLDAP
-#include "lber.h"
-#include "ldap.h"
+#ifndef LDAP_DEPRECATED
+#define LDAP_DEPRECATED 1
+#endif
+#include <lber.h>
+#include <ldap.h>
#endif
#include "sgEx.h"
#ifdef HAVE_MYSQL
-FILE *yyin, *yyout;
+extern FILE *yyin, *yyout;
char *configFile;
int numTimeElements;

View File

@ -1,17 +0,0 @@
$OpenBSD: patch-src_y_tab_c_bison,v 1.2 2009/04/09 23:53:13 sthen Exp $
--- src/y.tab.c.bison.orig Tue Feb 17 19:47:27 2009
+++ src/y.tab.c.bison Tue Feb 17 19:48:25 2009
@@ -198,8 +198,11 @@
extern int globalDebug;
#ifdef HAVE_LIBLDAP
-#include "lber.h"
-#include "ldap.h"
+#ifndef LDAP_DEPRECATED
+#define LDAP_DEPRECATED 1
+#endif
+#include <lber.h>
+#include <ldap.h>
#endif
#ifdef HAVE_MYSQL

View File

@ -4,4 +4,3 @@ access to URLs, redirect trafic, etc.
Flavors:
ldap - Build with LDAP support for authentication
mysql - Build with MySQL support for authentication

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST,v 1.3 2012/04/28 10:51:44 ajacoutot Exp $
@comment $OpenBSD: PLIST,v 1.4 2021/02/04 15:25:50 sthen Exp $
@bin bin/squidGuard
share/doc/squidguard/
share/doc/squidguard/LDAPFlow.txt
@ -39,6 +39,7 @@ share/examples/squidguard/babel.es
share/examples/squidguard/babel.fr
share/examples/squidguard/babel.nl
share/examples/squidguard/babel.no
share/examples/squidguard/babel.ru
share/examples/squidguard/dest/
share/examples/squidguard/dest/README
share/examples/squidguard/dest/blacklists.tar.gz