[debian-edu-commits] debian-edu/pkg-team/ 01/01: intial packaging draft, more work needed
Benjamin Schlüter
benni-guest at moszumanska.debian.org
Thu Sep 1 10:45:46 UTC 2016
This is an automated email from the git hooks/post-receive script.
benni-guest pushed a commit to branch master
in repository e2guardian.
commit 556d6ca42ccd77c8bfb3d9883f2a61f545525fbf
Author: Benjamin Schlüter <bschlueter at posteo.de>
Date: Thu Sep 1 12:48:41 2016 +0200
intial packaging draft, more work needed
---
debian/README.Debian | 35 +++++
debian/changelog | 5 +
debian/compat | 1 +
debian/contentregexplist | 12 ++
debian/control | 42 +++++
debian/copyright | 24 +++
debian/e2guardian.init | 91 +++++++++++
debian/e2guardian.logrotate | 10 ++
debian/patches.Dansguardian_REMOVE-LATER/00list | 9 ++
.../03_add_unconfigures.dpatch | 19 +++
.../07_fix_config_paths.dpatch | 19 +++
.../11_FixOptionContainer.cpp_on_arm.dpatch | 39 +++++
.../50_clamav095_support.dpatch | 171 +++++++++++++++++++++
.../60_add_gcc4.4_support.dpatch | 51 ++++++
.../65-fix_clamdsocket.dpatch | 19 +++
.../70-gcc4.6.dpatch | 19 +++
.../70_fix_clamav_detection | 18 +++
...ix_libcre3_max_sub_expression_allocation.dpatch | 61 ++++++++
debian/postinst | 35 +++++
debian/postrm | 9 ++
debian/prerm | 8 +
debian/rules | 39 +++++
debian/source/format | 1 +
debian/watch | 3 +
24 files changed, 740 insertions(+)
diff --git a/debian/README.Debian b/debian/README.Debian
new file mode 100644
index 0000000..cd44cbd
--- /dev/null
+++ b/debian/README.Debian
@@ -0,0 +1,35 @@
+VIRUS SCANNING WITH CLAMD
+=========================
+
+If you use dansguardian with clamd take care clamd is able
+to read the dansguardian tempfiles. Something like
+`usermod -a -G dansguardian clamav` should work.
+
+LICENSING ISSUES
+================
+Thanks to Daniel Barron <daniel at jadeb.com> for this piece of software!
+
+Although this software is released under the GPL, and is therefore free for
+anyone to use for any purpose, Daniel has made commercial licenses of this
+software available for those who require another license for their purposes.
+Please visit http://www.dansguardian.org/?page=copyright2 for details.
+
+If you use this software commercially, or if you just feel like making a
+donation, you are encouraged to make a donation to Daniel to support
+development of this software.
+
+Commercial support services are also available from Daniel for those
+needeing them. Please visit http://www.dansguardian.org/?page=pricing#CS
+for details.
+
+
+DOCUMENTATION
+=============
+Available documentation can be found at
+http://www.dansguardian.org/?page=documentation
+
+The DansGuardian FAQ is at http://www.dansguardian.org/?page=faq
+
+Some useful HOWTOs that cover specific implimentations of DansGuardian and
+caching/filtering in general can be found at
+http://www.dansguardian.org/?page=howto
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..36954a9
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+e2guardian (3.4.0.3-1) UNRELEASED; urgency=medium
+
+ * Initial release to Debian. (Closes: #XXXXXXX).
+
+ -- Benjamin Schlüter <b.schlueter at posteo.de> Sat, 31 Aug 2016 15:34:02 +0200
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/debian/contentregexplist b/debian/contentregexplist
new file mode 100644
index 0000000..c5ecad8
--- /dev/null
+++ b/debian/contentregexplist
@@ -0,0 +1,12 @@
+#Content modifying Regular Expressions
+#
+# The format is: "extended regular expression"->"replacement straight string"
+# E.g. "shit"->"censored" would replace all occurances of shit in any case.
+# Far more complicated matches are possible. See other sources for examples
+# of extended regular expressions.
+
+# These are just some weak examples. If you write any, for example, to
+# remove popups etc, please send them to author at dansguardian.org.
+
+#"<script language.*open\(.*script>"->"<!-- its gone -->"
+#"fuck|cunt|shit|arse"->"**censored**"
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..e6baf4d
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,42 @@
+Source: e2guardian
+Section: web
+Priority: optional
+Maintainer: Debian Edu Packaging Team <debian-edu-pkg-team at lists.alioth.debian.org>
+Uploaders:
+ Mike Gabriel <sunweaver at debian.org>,
+ Benjamin Schlüter <bschlueter at posteo.de>,
+Build-Depends: autotools-dev,
+ debhelper (>= 9),
+ dh-autoreconf,
+ quilt,
+ libclamav-dev (>= 0.90),
+ libpcre3-dev,
+ zlib1g-dev,
+Standards-Version: 3.9.8
+Vcs-Git: https://anonscm.debian.org/git/debian-edu/pkg-team/e2guardian.git
+Vcs-Browser: https://anonscm.debian.org/git/debian-edu/pkg-team/e2guardian.git
+Homepage: https://github.com/e2guardian/e2guardian
+
+Package: e2guardian
+Architecture: any
+Depends: adduser,
+ clamav (>= 0.80),
+ perl, ${misc:Depends},
+ ${shlibs:Depends},
+Suggests: clamav-freshclam,
+ squid,
+Description: Web content filtering (Dansguardian fork)
+ e2guardian filters the content of pages based on many methods
+ including phrase matching, PICS filtering and URL filtering. It does
+ not purely filter based on a banned list of sites.
+ .
+ It provides real-time virus scanning capabilities for content access.
+ .
+ e2guardian is designed to be completely flexible and allows you to tailor
+ the filtering to your exact needs. It can be as draconian or as
+ unobstructive as you want. The default settings are geared towards what a
+ primary school might want but e2guardian puts you in control of what you
+ want to block.
+ .
+ e2guardian requires squid or another similar caching proxy server
+ on your local network.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..cf9eaf5
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,24 @@
+This package was debianized by Jonathan Hall <jonhall at futureks.net> on
+Mon, 17 Jun 2002 21:14:35 -0500.
+
+It as downloaded from http://dansguardian.org/
+
+Upstream Author: Daniel Barron <daniel at jadeb.com>
+
+Copyright (c) 2001-2010 Daniel Barron
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program 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 for more details.
+
+You should have received a copy of the GNU General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
+St, Fifth Floor, Boston, MA 02110-1301, USA. On Debian systems, the complete
+text of the GNU General Public License, can be found in
+/usr/share/common-licenses/GPL.
diff --git a/debian/e2guardian.init b/debian/e2guardian.init
new file mode 100644
index 0000000..cc7a575
--- /dev/null
+++ b/debian/e2guardian.init
@@ -0,0 +1,91 @@
+#! /bin/sh
+# Startup script for e2guardian
+#
+# description: A web content filtering plugin for web \
+# proxies, developed to filter using lists of \
+# banned phrases, MIME types, filename \
+# extensions and PICS labling.
+# processname: e2guardian
+# pidfile: /var/run/e2guardian.pid
+# config: /etc/e2guardian/e2guardian.conf
+### BEGIN INIT INFO
+# Provides: e2guardian
+# Required-Start: $remote_fs $network $syslog
+# Required-Stop: $remote_fs $network $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Description: Starts e2guardian content proxy
+# short-description: e2guardian configuration
+### END INIT INFO
+
+#include lsb functions
+. /lib/lsb/init-functions
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/usr/sbin/e2guardian
+NAME=e2guardian
+DESC="e2guardian"
+
+CONFFILELOCATION=/etc/e2guardian/
+#BINARYLOCATION=/usr/sbin/
+#PIDDIR=/var/run/
+
+grep -q ^UNCONFIGURED ${CONFFILELOCATION}e2guardian.conf && {
+cat <<EOF
+ e2guardian has not been configured!
+ Please edit ${CONFFILELOCATION}e2guardian.conf manually then rerun
+ this script.
+EOF
+exit; }
+
+test -x $DAEMON || exit 0
+test -f ${CONFFILELOCATION}e2guardian.conf || exit 0
+
+set -e
+
+case "$1" in
+ start)
+ log_daemon_msg "Starting $DESC" "$NAME"
+ test -d /var/lock/subsys || mkdir -p /var/lock/subsys
+ start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
+ --exec $DAEMON || log_end_msg 1
+ log_end_msg 0
+ ;;
+ stop)
+ log_daemon_msg "Stopping $DESC" "$NAME"
+ start-stop-daemon --stop --quiet --retry 15 --oknodo --pidfile /var/run/$NAME.pid \
+ --exec $DAEMON || log_end_msg 1
+ log_end_msg 0
+ ;;
+ reload)
+ log_action_begin_msg "Reloading $DESC configuration..."
+ echo "Reloading $DESC configuration files."
+ start-stop-daemon --stop --signal 1 --quiet --pidfile \
+ /var/run/$NAME.pid --exec $DAEMON || log_action_end_msg 1
+ log_action_end_msg 0
+ ;;
+ restart|force-reload)
+ #
+ # If the "reload" option is implemented, move the "force-reload"
+ # option to the "reload" entry above. If not, "force-reload" is
+ # just the same as "restart".
+ #
+ log_daemon_msg "Restarting $DESC" "$NAME"
+ start-stop-daemon --stop --quiet --retry 15 --oknodo --pidfile \
+ /var/run/$NAME.pid --exec $DAEMON || log_end_msg 1
+ start-stop-daemon --start --quiet --pidfile \
+ /var/run/$NAME.pid --exec $DAEMON || log_end_msg 1
+ log_end_msg 0
+ ;;
+ status)
+ status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
+ ;;
+ *)
+ N=/etc/init.d/$NAME
+ # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
+ log_action_msg "Usage: $N {start|stop|restart|force-reload|status}" >&2
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/debian/e2guardian.logrotate b/debian/e2guardian.logrotate
new file mode 100644
index 0000000..633629b
--- /dev/null
+++ b/debian/e2guardian.logrotate
@@ -0,0 +1,10 @@
+/var/log/e2guardian/access.log {
+ rotate 5
+ daily
+ prerotate
+ invoke-rc.d e2guardian stop > /dev/null 2>&1 || true
+ endscript
+ postrotate
+ invoke-rc.d e2guardian start > /dev/null 2>&1
+ endscript
+}
diff --git a/debian/patches.Dansguardian_REMOVE-LATER/00list b/debian/patches.Dansguardian_REMOVE-LATER/00list
new file mode 100644
index 0000000..fdf0193
--- /dev/null
+++ b/debian/patches.Dansguardian_REMOVE-LATER/00list
@@ -0,0 +1,9 @@
+#03_add_unconfigures.dpatch
+#07_fix_config_paths.dpatch
+#11_FixOptionContainer.cpp_on_arm.dpatch
+#50_clamav095_support.dpatch
+#60_add_gcc4.4_support.dpatch
+#65-fix_clamdsocket.dpatch
+#70-gcc4.6.dpatch
+#70_fix_clamav_detection
+#80_fix_libcre3_max_sub_expression_allocation
diff --git a/debian/patches.Dansguardian_REMOVE-LATER/03_add_unconfigures.dpatch b/debian/patches.Dansguardian_REMOVE-LATER/03_add_unconfigures.dpatch
new file mode 100644
index 0000000..437a9b1
--- /dev/null
+++ b/debian/patches.Dansguardian_REMOVE-LATER/03_add_unconfigures.dpatch
@@ -0,0 +1,19 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 03_add_unconfigures.dpatch by Alexander Wirt <formorer at debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Don't start dansguardian if its not configured
+
+ at DPATCH@
+diff -urNad dansguardian-2.9.9.3~/configs/dansguardian.conf.in dansguardian-2.9.9.3/configs/dansguardian.conf.in
+--- dansguardian-2.9.9.3~/configs/dansguardian.conf.in 2007-11-26 13:00:06.000000000 +0100
++++ dansguardian-2.9.9.3/configs/dansguardian.conf.in 2008-03-23 09:41:22.000000000 +0100
+@@ -2,6 +2,7 @@
+
+ # **NOTE** as of version 2.7.5 most of the list files are now in dansguardianf1.conf
+
++UNCONFIGURED - Please remove this line after configuration
+
+ # Web Access Denied Reporting (does not affect logging)
+ #
+
diff --git a/debian/patches.Dansguardian_REMOVE-LATER/07_fix_config_paths.dpatch b/debian/patches.Dansguardian_REMOVE-LATER/07_fix_config_paths.dpatch
new file mode 100644
index 0000000..1df9cae
--- /dev/null
+++ b/debian/patches.Dansguardian_REMOVE-LATER/07_fix_config_paths.dpatch
@@ -0,0 +1,19 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## fix_config_paths.dpatch by Alexander Wirt <formorer at debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Fix config paths for language files
+
+ at DPATCH@
+diff -urNad dansguardian-2.9.9.3~/configs/dansguardian.conf.in dansguardian-2.9.9.3/configs/dansguardian.conf.in
+--- dansguardian-2.9.9.3~/configs/dansguardian.conf.in 2007-11-26 13:00:06.000000000 +0100
++++ dansguardian-2.9.9.3/configs/dansguardian.conf.in 2008-03-22 22:25:50.000000000 +0100
+@@ -20,7 +20,7 @@
+ # and easier to customise the access denied page.
+ # The language file is used no matter what setting however.
+ #
+-languagedir = '@DGDATADIR@/languages'
++languagedir = '@DGCONFDIR@/languages'
+
+ # language to use from languagedir.
+ language = 'ukenglish'
diff --git a/debian/patches.Dansguardian_REMOVE-LATER/11_FixOptionContainer.cpp_on_arm.dpatch b/debian/patches.Dansguardian_REMOVE-LATER/11_FixOptionContainer.cpp_on_arm.dpatch
new file mode 100644
index 0000000..e5ec907
--- /dev/null
+++ b/debian/patches.Dansguardian_REMOVE-LATER/11_FixOptionContainer.cpp_on_arm.dpatch
@@ -0,0 +1,39 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 11_FixOptionContainer.cpp_on_arm.dpatch by Alexander Wirt <formorer at debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: If you need to iterate through all lines in the
+## config file to find a field, at least don't abuse the configfile deque
+## by accessing it as if it was an array with signed index.
+## Works way better on arm, too, i.e. closes: #493047.
+
+ at DPATCH@
+diff -urNad dansguardian-2.9.9.7~/src/OptionContainer.cpp dansguardian-2.9.9.7/src/OptionContainer.cpp
+--- dansguardian-2.9.9.7~/src/OptionContainer.cpp 2008-08-18 09:57:46.000000000 +0200
++++ dansguardian-2.9.9.7/src/OptionContainer.cpp 2008-10-13 09:23:20.000000000 +0200
+@@ -662,8 +662,10 @@
+ String temp;
+ String temp2;
+ String o(option);
+- for (int i = 0; i < (signed) conffile.size(); i++) {
+- temp = conffile[i].c_str();
++ for (std::deque<std::string>::iterator i = conffile.begin(); i != conffile.end(); i++) {
++ if ((*i).empty())
++ continue;
++ temp = (*i).c_str();
+ temp2 = temp.before("=");
+ while (temp2.endsWith(" ")) { // get rid of tailing spaces before =
+ temp2.chop();
+@@ -696,8 +698,10 @@
+ String temp2;
+ String o(option);
+ std::deque<String > results;
+- for (int i = 0; i < (signed) conffile.size(); i++) {
+- temp = conffile[i].c_str();
++ for (std::deque<std::string>::iterator i = conffile.begin(); i != conffile.end(); i++) {
++ if ((*i).empty())
++ continue;
++ temp = (*i).c_str();
+ temp2 = temp.before("=");
+ while (temp2.endsWith(" ")) { // get rid of tailing spaces before =
+ temp2.chop();
diff --git a/debian/patches.Dansguardian_REMOVE-LATER/50_clamav095_support.dpatch b/debian/patches.Dansguardian_REMOVE-LATER/50_clamav095_support.dpatch
new file mode 100644
index 0000000..6156ec8
--- /dev/null
+++ b/debian/patches.Dansguardian_REMOVE-LATER/50_clamav095_support.dpatch
@@ -0,0 +1,171 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 50_clamav095_support.dpatch by Imre Gergely <gimre at narancs.net>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Adds support for clamav 0.95
+
+ at DPATCH@
+diff -urNad dansguardian-2.9.9.7~/src/contentscanners/clamav.cpp dansguardian-2.9.9.7/src/contentscanners/clamav.cpp
+--- dansguardian-2.9.9.7~/src/contentscanners/clamav.cpp 2008-06-10 12:41:41.000000000 +0300
++++ dansguardian-2.9.9.7/src/contentscanners/clamav.cpp 2009-04-19 09:47:39.000000000 +0300
+@@ -69,9 +69,11 @@
+ // virus database root node
+ // Update to support ClamAV 0.90
+ // Based on patch supplied by Aecio F. Neto
+- struct cl_engine *root;
++ struct cl_engine *engine;
++#ifndef CL_INIT_DEFAULT
+ // archive limit options
+ struct cl_limits limits;
++#endif
+
+ #ifdef HAVE_CLAMAV_SHM
+ // use POSIX shared memory
+@@ -100,7 +102,11 @@
+ // destroy plugin
+ int clamavinstance::quit()
+ {
+- cl_free(root);
++#ifdef CL_INIT_DEFAULT
++ cl_engine_free(engine);
++#else
++ cl_free(engine);
++#endif
+ return DGCS_OK;
+ }
+
+@@ -164,7 +170,11 @@
+ return DGCS_SCANERROR;
+ }
+
+- rc = cl_scandesc(fd, &vn, NULL, root, &limits, CL_SCAN_STDOPT);
++#ifdef CL_INIT_DEFAULT
++ rc = cl_scandesc(fd, &vn, NULL, engine, CL_SCAN_STDOPT);
++#else
++ rc = cl_scandesc(fd, &vn, NULL, engine, &limits, CL_SCAN_STDOPT);
++#endif
+ close(fd);
+
+ #ifdef HAVE_CLAMAV_SHM
+@@ -189,7 +199,11 @@
+ {
+ lastmessage = lastvirusname = "";
+ const char *vn = NULL;
+- int rc = cl_scanfile(filename, &vn, NULL, root, &limits, CL_SCAN_STDOPT );
++#ifdef CL_INIT_DEFAULT
++ int rc = cl_scanfile(filename, &vn, NULL, engine, CL_SCAN_STDOPT );
++#else
++ int rc = cl_scanfile(filename, &vn, NULL, engine, &limits, CL_SCAN_STDOPT );
++#endif
+ return doRC(rc, vn);
+ }
+
+@@ -220,6 +234,7 @@
+ // initialise libclamav
+ int clamavinstance::init(void* args)
+ {
++ int rc;
+ // always include these lists
+ if (!readStandardLists()) {
+ return DGCS_ERROR;
+@@ -244,18 +259,41 @@
+ return DGCS_ERROR;
+ }
+
+- // set clam's own temp dir
+- if (cv["tempdir"].length() > 0)
+- cl_settempdir(cv["tempdir"].toCharArray(), 0);
+-
+ #ifdef DGDEBUG
+ std::cout << "Scanbuffmethod: " << smethod << std::endl;
+ std::cout << "Scanbuffdir: " << memdir << std::endl;
+ std::cout << "Tempdir: " << cv["tempdir"] << std::endl;
+ #endif
+
++#ifdef CL_INIT_DEFAULT
++ if ( (rc = cl_init(CL_INIT_DEFAULT)) != CL_SUCCESS ) {
++ return DGCS_ERROR;
++ }
++ if ( !(engine = cl_engine_new()) ) {
++ return DGCS_ERROR;
++ }
++
+ // set file, recursion and compression ratio limits for scanning archives
+- root = NULL;
++ if ( (rc = cl_engine_set_num(engine, CL_ENGINE_MAX_FILES, (long long)cv["maxfiles"].toInteger())) ) {
++ return DGCS_ERROR;
++ }
++ if ( (rc = cl_engine_set_num(engine, CL_ENGINE_MAX_FILESIZE, (long long)o.max_content_filecache_scan_size + 1024 * 1024)) ) {
++ return DGCS_ERROR;
++ }
++ if ( (rc = cl_engine_set_num(engine, CL_ENGINE_MAX_RECURSION, (long long)cv["maxreclevel"].toInteger())) ) {
++ return DGCS_ERROR;
++ }
++ if ( (rc = cl_engine_set_num(engine, CL_ENGINE_MAX_SCANSIZE, (long long)cv["maxscansize"].toInteger() * 1024)) ) {
++ return DGCS_ERROR;
++ }
++// FIXME: need debug output code here
++ if (cv["tempdir"].length() > 0)
++ if ( (rc = cl_engine_set_str(engine, CL_ENGINE_TMPDIR, cv["tempdir"].toCharArray())) ) {
++ return DGCS_ERROR;
++ }
++#else
++ // set file, recursion and compression ratio limits for scanning archives
++ engine = NULL;
+ limits.maxfiles = cv["maxfiles"].toInteger();
+ limits.maxfilesize = o.max_content_filecache_scan_size + 1024 * 1024;
+ limits.maxreclevel = cv["maxreclevel"].toInteger();
+@@ -264,12 +302,35 @@
+ std::cerr << "maxfiles: " << limits.maxfiles << " maxfilesize: " << limits.maxfilesize
+ << " maxreclevel: " << limits.maxreclevel << " maxscansize: " << limits.maxscansize << std::endl;
+ #endif
++ if (cv["tempdir"].length() > 0)
++ cl_settempdir(cv["tempdir"].toCharArray(), 0);
++
++#endif
+
+ // load virus database
+- unsigned int virnum = 0;
+- int rc = cl_load(cl_retdbdir(), &root, &virnum, CL_DB_STDOPT);
++ unsigned int sigs = 0;
++#ifdef CL_INIT_DEFAULT
++ if ( (rc = cl_load(cl_retdbdir(), engine, &sigs, 0)) != CL_SUCCESS ) {
++ if (!is_daemonised)
++ std::cerr << "Error loading clamav db: " << cl_strerror(rc) << std::endl;
++ syslog(LOG_ERR, "Error loading clamav db: %s", cl_strerror(rc));
++ return DGCS_ERROR;
++ }
+ #ifdef DGDEBUG
+- std::cout << "engine: " << root << " virnum: " << virnum << std::endl;
++ std::cout << "engine: " << engine << " sigs: " << sigs << std::endl;
++#endif
++ if ( (rc = cl_engine_compile(engine)) != CL_SUCCESS ) {
++ if (!is_daemonised)
++ std::cerr << "Error preparing clamav engine: " << cl_strerror(rc) << std::endl;
++ syslog(LOG_ERR, "Error preparing clamav engine: %s", cl_strerror(rc));
++ return DGCS_ERROR;
++ }
++ return DGCS_OK;
++
++#else
++ rc = cl_load(cl_retdbdir(), &engine, &sigs, CL_DB_STDOPT);
++#ifdef DGDEBUG
++ std::cout << "engine: " << engine << " sigs: " << sigs << std::endl;
+ #endif
+ if (rc != 0) {
+ if (!is_daemonised)
+@@ -277,7 +338,7 @@
+ syslog(LOG_ERR, "Error loading clamav db: %s", cl_strerror(rc));
+ return DGCS_ERROR;
+ }
+- rc = cl_build(root);
++ rc = cl_build(engine);
+ if (rc != 0) {
+ if (!is_daemonised)
+ std::cerr << "Error building clamav db: " << cl_strerror(rc) << std::endl;
+@@ -285,4 +346,5 @@
+ return DGCS_ERROR;
+ }
+ return DGCS_OK;
++#endif
+ }
diff --git a/debian/patches.Dansguardian_REMOVE-LATER/60_add_gcc4.4_support.dpatch b/debian/patches.Dansguardian_REMOVE-LATER/60_add_gcc4.4_support.dpatch
new file mode 100644
index 0000000..a61a6e4
--- /dev/null
+++ b/debian/patches.Dansguardian_REMOVE-LATER/60_add_gcc4.4_support.dpatch
@@ -0,0 +1,51 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 60_add_gcc4.4_support.dpatch by Martin Michlmayr <tbm at cyrius.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Adds support for gcc4.4 (#505386)
+
+ at DPATCH@
+diff -urNad dansguardian-2.9.9.8~/src/contentscanners/clamav.cpp dansguardian-2.9.9.8/src/contentscanners/clamav.cpp
+--- dansguardian-2.9.9.8~/src/contentscanners/clamav.cpp 2008-06-10 11:41:41.000000000 +0200
++++ dansguardian-2.9.9.8/src/contentscanners/clamav.cpp 2009-06-14 11:28:16.000000000 +0200
+@@ -33,6 +33,7 @@
+ #include <unistd.h>
+ #include <clamav.h>
+ #include <fcntl.h>
++#include <cstdio>
+
+
+ // GLOBALS
+diff -urNad dansguardian-2.9.9.8~/src/contentscanners/commandlinescan.cpp dansguardian-2.9.9.8/src/contentscanners/commandlinescan.cpp
+--- dansguardian-2.9.9.8~/src/contentscanners/commandlinescan.cpp 2008-06-10 11:47:55.000000000 +0200
++++ dansguardian-2.9.9.8/src/contentscanners/commandlinescan.cpp 2009-06-14 11:28:16.000000000 +0200
+@@ -35,6 +35,7 @@
+ #include <sys/wait.h>
+ #include <unistd.h>
+ #include <list>
++#include <cstdio>
+
+
+ // GLOBALS
+diff -urNad dansguardian-2.9.9.8~/src/contentscanners/icapscan.cpp dansguardian-2.9.9.8/src/contentscanners/icapscan.cpp
+--- dansguardian-2.9.9.8~/src/contentscanners/icapscan.cpp 2008-06-10 11:41:51.000000000 +0200
++++ dansguardian-2.9.9.8/src/contentscanners/icapscan.cpp 2009-06-14 11:28:16.000000000 +0200
+@@ -36,6 +36,7 @@
+ #include <fcntl.h>
+ #include <unistd.h>
+ #include <netdb.h> // for gethostby
++#include <cstdio>
+
+
+ // DEFINES
+diff -urNad dansguardian-2.9.9.8~/src/downloadmanagers/fancy.cpp dansguardian-2.9.9.8/src/downloadmanagers/fancy.cpp
+--- dansguardian-2.9.9.8~/src/downloadmanagers/fancy.cpp 2008-06-10 11:41:25.000000000 +0200
++++ dansguardian-2.9.9.8/src/downloadmanagers/fancy.cpp 2009-06-14 11:28:16.000000000 +0200
+@@ -32,6 +32,7 @@
+ #include <unistd.h>
+ #include <iostream>
+ #include <math.h>
++#include <cstdio>
+
+
+ // GLOBALS
diff --git a/debian/patches.Dansguardian_REMOVE-LATER/65-fix_clamdsocket.dpatch b/debian/patches.Dansguardian_REMOVE-LATER/65-fix_clamdsocket.dpatch
new file mode 100644
index 0000000..36c3a6b
--- /dev/null
+++ b/debian/patches.Dansguardian_REMOVE-LATER/65-fix_clamdsocket.dpatch
@@ -0,0 +1,19 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 65-editconfig.dpatch by Alexander Wirt <formorer at debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Fix clamdsocket path
+
+ at DPATCH@
+diff -urNad dansguardian-2.10.1.1~/configs/contentscanners/clamdscan.conf.in dansguardian-2.10.1.1/configs/contentscanners/clamdscan.conf.in
+--- dansguardian-2.10.1.1~/configs/contentscanners/clamdscan.conf.in 2008-11-18 12:27:04.000000000 +0100
++++ dansguardian-2.10.1.1/configs/contentscanners/clamdscan.conf.in 2010-02-13 20:33:07.000000000 +0100
+@@ -1,7 +1,7 @@
+ plugname = 'clamdscan'
+
+ # edit this to match the location of your ClamD UNIX domain socket
+-#clamdudsfile = '/var/run/clamav/clamd.sock'
++clamdudsfile = '/var/run/clamav/clamd.ctl'
+
+ # If this string is set, the text it contains shall be removed from the
+ # beginning of filenames when passing them to ClamD.
diff --git a/debian/patches.Dansguardian_REMOVE-LATER/70-gcc4.6.dpatch b/debian/patches.Dansguardian_REMOVE-LATER/70-gcc4.6.dpatch
new file mode 100644
index 0000000..e9f533e
--- /dev/null
+++ b/debian/patches.Dansguardian_REMOVE-LATER/70-gcc4.6.dpatch
@@ -0,0 +1,19 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 70-gcc4.6.dpatch by Daniel T Chen <crimsun at ubuntu.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Fix FTBFS by including cstddef for size_t
+
+ at DPATCH@
+diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' dansguardian-2.10.1.1~/src/authplugins/ntlm.cpp dansguardian-2.10.1.1/src/authplugins/ntlm.cpp
+--- dansguardian-2.10.1.1~/src/authplugins/ntlm.cpp 2008-11-18 06:27:04.000000000 -0500
++++ dansguardian-2.10.1.1/src/authplugins/ntlm.cpp 2011-08-25 16:37:38.000000000 -0400
+@@ -27,6 +27,8 @@
+ #include "../FDTunnel.hpp"
+ #include "../OptionContainer.hpp"
+
++#include <cstddef>
++
+ #include <syslog.h>
+
+ #include <iconv.h>
diff --git a/debian/patches.Dansguardian_REMOVE-LATER/70_fix_clamav_detection b/debian/patches.Dansguardian_REMOVE-LATER/70_fix_clamav_detection
new file mode 100644
index 0000000..9df6b40
--- /dev/null
+++ b/debian/patches.Dansguardian_REMOVE-LATER/70_fix_clamav_detection
@@ -0,0 +1,18 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 70_fix_clamav_datection.dpatch by Dan Chen <seven.steps at gmail.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Fix clamav detection in configure.ac
+
+ at DPATCH@
+--- dansguardian-2.10.1.1.orig/configure.ac
++++ dansguardian-2.10.1.1/configure.ac
+@@ -333,7 +333,7 @@
+ CLAMAVSHM="!! Not supported on this platform !!"
+ else
+ AC_MSG_RESULT(yes)
+- PKG_CHECK_MODULES([CLAMAV],[libclamav >= 4])
++ PKG_CHECK_MODULES([CLAMAV],[libclamav >= 0.95])
+
+ AC_DEFINE([HAVE_CLAMAV],[],[Define to enable ClamAV content scanner])
+
diff --git a/debian/patches.Dansguardian_REMOVE-LATER/80_fix_libcre3_max_sub_expression_allocation.dpatch b/debian/patches.Dansguardian_REMOVE-LATER/80_fix_libcre3_max_sub_expression_allocation.dpatch
new file mode 100644
index 0000000..0f96c3a
--- /dev/null
+++ b/debian/patches.Dansguardian_REMOVE-LATER/80_fix_libcre3_max_sub_expression_allocation.dpatch
@@ -0,0 +1,61 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 80_fix_libcre3_max_sub_expression_allocation.dpatch by Russell Coker
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: libpcre3 sets reg.re_nsub to an exreme large value and dansguardian
+## DP: tries to allocate memory for all records which lets malloc fail.
+## DP: this patch limits the allocation to 1024 records. (#667664)
+
+ at DPATCH@
+diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' pkg-dansguardian~/src/RegExp.cpp pkg-dansguardian/src/RegExp.cpp
+--- pkg-dansguardian~/src/RegExp.cpp 2011-10-29 14:16:31.000000000 +0200
++++ pkg-dansguardian/src/RegExp.cpp 2012-06-23 11:02:48.821473711 +0200
+@@ -161,14 +161,17 @@
+ offsets.clear();
+ lengths.clear();
+ imatched = false;
+- regmatch_t *pmatch = new regmatch_t[reg.re_nsub + 1]; // to hold result
++ int num_sub_expressions = MAX_SUB_EXPRESSIONS;
++ if(reg.re_nsub < num_sub_expressions)
++ num_sub_expressions = reg.re_nsub;
++ regmatch_t *pmatch = new regmatch_t[num_sub_expressions + 1]; // to hold result
+ if (!pmatch) { // if it failed
+ delete[]pmatch;
+ imatched = false;
+ return false;
+ // exception?
+ }
+- if (regexec(®, pos, reg.re_nsub + 1, pmatch, 0)) { // run regex
++ if (regexec(®, pos, num_sub_expressions + 1, pmatch, 0)) { // run regex
+ delete[]pmatch;
+ imatched = false;
+ // #ifdef DGDEBUG
+@@ -182,7 +185,7 @@
+ int error = 0;
+ while (error == 0) {
+ largestoffset = 0;
+- for (i = 0; i <= (signed) reg.re_nsub; i++) {
++ for (i = 0; i <= (signed) num_sub_expressions; i++) {
+ if (pmatch[i].rm_so != -1) {
+ matchlen = pmatch[i].rm_eo - pmatch[i].rm_so;
+ submatch = new char[matchlen + 1];
+@@ -199,7 +202,7 @@
+ }
+ if (largestoffset > 0) {
+ pos += largestoffset;
+- error = regexec(®, pos, reg.re_nsub + 1, pmatch, REG_NOTBOL);
++ error = regexec(®, pos, num_sub_expressions + 1, pmatch, REG_NOTBOL);
+ } else {
+ error = -1;
+ }
+diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' pkg-dansguardian~/src/RegExp.hpp pkg-dansguardian/src/RegExp.hpp
+--- pkg-dansguardian~/src/RegExp.hpp 2011-10-29 14:16:31.000000000 +0200
++++ pkg-dansguardian/src/RegExp.hpp 2012-06-23 11:02:48.821473711 +0200
+@@ -22,6 +22,7 @@
+ #ifndef __HPP_REGEXP
+ #define __HPP_REGEXP
+
++#define MAX_SUB_EXPRESSIONS 1024
+
+ // INCLUDES
+
diff --git a/debian/postinst b/debian/postinst
new file mode 100755
index 0000000..18cf1bf
--- /dev/null
+++ b/debian/postinst
@@ -0,0 +1,35 @@
+#! /bin/sh -e
+
+if ! id -u e2guardian > /dev/null 2>&1 ; then
+ adduser --system --group \
+ --disabled-login \
+ --gecos "e2guardian User" \
+ --home /var/log/e2guardian \
+ --shell /bin/sh \
+ e2guardian
+fi
+
+e2guardian_user=`grep daemonuser /etc/e2guardian/e2guardian.conf|grep -v '^\ *#' \
+ |awk -F = '{print $2}'|tr -d \ \'`
+
+e2guardian_group=`grep daemongroup /etc/e2guardian/e2guardian.conf|grep -v '^\ *#' \
+ |awk -F = '{print $2}'|tr -d \ \'`
+
+logdir=`grep loglocation /etc/e2guardian/e2guardian.conf|grep -v '^\ *#' \
+ |awk -F = '{print $2}'|tr -d \ \'|xargs -r dirname 2>/dev/null`
+
+echo "$logdir"
+test -z "$e2guardian_user" && e2guardian_user=e2guardian
+test -z "$e2guardian_group" && e2guardian_group=e2guardian
+test -z "$logdir" && logdir=/var/log/e2guardian
+
+chown -R $e2guardian_user:$e2guardian_group $logdir
+chmod -R u+wr $logdir
+chmod u+wrx $logdir
+
+init_failed ()
+{
+ echo "WARNING: Starting e2guardian failed. Please check your configuration."
+}
+
+#DEBHELPER#
diff --git a/debian/postrm b/debian/postrm
new file mode 100755
index 0000000..c724f97
--- /dev/null
+++ b/debian/postrm
@@ -0,0 +1,9 @@
+#!/bin/sh -e
+
+if [ "$1" = "purge" ]; then
+ deluser e2guardian > /dev/null || true
+ rm -rf /var/log/e2guardian
+ rm -rf /etc/e2guardian
+fi
+
+#DEBHELPER#
diff --git a/debian/prerm b/debian/prerm
new file mode 100755
index 0000000..62aec7f
--- /dev/null
+++ b/debian/prerm
@@ -0,0 +1,8 @@
+#! /bin/sh -e
+
+init_failed ()
+{
+ echo "WARNING: Stopping e2guardian failed! Upgrade or removal may be incomplete!"
+}
+
+#DEBHELPER#
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..e26f93c
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,39 @@
+#!/usr/bin/make -f
+
+DHFLAGS=--parallel
+
+%:
+ dh $@ --with quilt $(DHFLAGS)
+
+override_dh_auto_configure: NOCONFIGURE=1 ./autogen.sh
+ dh_auto_configure $(DHFLAGS) -- \
+ --prefix=/usr \
+ --enable-clamav=yes \
+ --enable-clamd=yes \
+ --with-proxyuser=e2guardian \
+ --with-proxygroup=e2guardian \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --enable-icap=yes \
+ --enable-commandline=yes \
+ --enable-email=yes \
+ --enable-ntlm=yes \
+ --enable-trickledm=yes \
+ --mandir=\$${prefix}/share/man \
+ --infodir=\$${prefix}/share/info
+
+override_dh_auto_install:
+ dh_auto_install
+ mkdir -p debian/e2guardian/etc/e2guardian/
+ mkdir -p debian/e2guardian/usr/lib/cgi-bin/
+ mv debian/e2guardian/usr/share/e2guardian/languages/ debian/e2guardian/etc/e2guardian/
+ mv debian/e2guardian/usr/share/e2guardian/e2guardian.pl debian/e2guardian/usr/lib/cgi-bin/
+ chmod 755 debian/e2guardian/usr/lib/cgi-bin/e2guardian.pl
+ rm -rf debian/e2guardian/usr/share/e2guardian/scripts/
+ rm -f debian/e2guardian/etc/e2guardian/logrotation
+
+override_dh_installinit:
+ dh_installinit --error-handler=init_failed
+
+get-orig-source:
+ uscan --noconf --force-download --rename --download-current-version --destdir=..
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/debian/watch b/debian/watch
new file mode 100644
index 0000000..a0b3d4e
--- /dev/null
+++ b/debian/watch
@@ -0,0 +1,3 @@
+version=3
+opts=filenamemangle=s/.*\/v?([\d\.-]+)\.tar\.gz/e2guardian-$1.tar.gz/ \
+https://github.com/e2guardian/e2guardian/tags .*/archive/v?([\d\.]+).tar.gz
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-edu/pkg-team/e2guardian.git
More information about the debian-edu-commits
mailing list