]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
Clamav-Fixes.
authorms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Tue, 1 May 2007 22:04:01 +0000 (22:04 +0000)
committerms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Tue, 1 May 2007 22:04:01 +0000 (22:04 +0000)
Clamavctrl gebaut & Initscript geschrieben.

git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@513 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8

config/rootfiles/packages/clamav
lfs/clamav
src/initscripts/init.d/clamav [new file with mode: 0644]
src/misc-progs/Makefile
src/misc-progs/clamavctrl.c [new file with mode: 0644]

index 73ce52f7185817a826c7ddbec5acce8d35d23d10..4e9b0aa10a33039f434c35a3d89b86bbe2a32c8b 100644 (file)
@@ -27,3 +27,5 @@ usr/share/clamav/main.cvd
 #var/ipfire/clamav
 var/ipfire/clamav/clamd.conf
 var/ipfire/clamav/freshclam.conf
+etc/rc.d/init.d/clamav
+/usr/local/bin/clamavctrl
index af72c899cd7818758445288e2cb172209f762b2c..782e43a257c2b34b971517abcc642b4a40ff3043 100644 (file)
@@ -80,5 +80,6 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        cd $(DIR_APP) && ./configure --prefix=/usr --sysconfdir=/var/ipfire/clamav
        cd $(DIR_APP) && make $(MAKETUNING)
        cd $(DIR_APP) && make install
+       chown nobody.nobody /usr/share/clamav -R
        @rm -rf $(DIR_APP)
        @$(POSTBUILD)
diff --git a/src/initscripts/init.d/clamav b/src/initscripts/init.d/clamav
new file mode 100644 (file)
index 0000000..b11b8b0
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/sh
+# Begin $rc_base/init.d/clamav
+
+. /etc/sysconfig/rc
+. $rc_functions
+
+case "$1" in
+       start)
+               boot_mesg "Starting Clamav Definition Updater..."
+               loadproc /usr/bin/freshclam -d -c 10
+               
+               boot_mesg "Starting Clamav Daemon..."
+               loadproc /usr/sbin/clamd
+               ;;
+
+       stop)
+               boot_mesg "Stopping Clamav Definition Updater..."
+               killproc /usr/bin/freshclam
+               
+               boot_mesg "Stopping Clamav Daemon..."
+               killproc /usr/sbin/clamd
+               ;;
+
+       restart)
+               $0 stop
+               sleep 1
+               $0 start
+               ;;
+
+       status)
+               statusproc /usr/sbin/clamd
+               statusproc /usr/bin/freshclam
+               ;;
+
+       *)
+               echo "Usage: $0 {start|stop|restart|status}"
+               exit 1
+               ;;
+esac
+
+# End $rc_base/init.d/clamav
index 3dd951e2f7e1557e283b7432b585c3add1219716..7302cffd7c05977d406c1eeea5269ceaf0b1cf57 100644 (file)
@@ -11,7 +11,7 @@ SUID_PROGS = setdmzholes setportfw setfilters setxtaccess \
        restartsyslogd logwatch openvpnctrl timecheckctrl \
        restartwireless getipstat qosctrl launch-ether-wake \
        redctrl extrahdctrl sambactrl upnpctrl tripwirectrl \
-       smartctrl
+       smartctrl clamavctrl
 
 install : all
        install -m 755  $(PROGS) /usr/local/bin
@@ -61,6 +61,9 @@ tripwirectrl: tripwirectrl.c setuid.o ../install+setup/libsmooth/varval.o
 smartctrl: smartctrl.c setuid.o ../install+setup/libsmooth/varval.o
        $(COMPILE) -I../install+setup/libsmooth/ smartctrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@
 
+clamavctrl: clamavctrl.c setuid.o ../install+setup/libsmooth/varval.o
+       $(COMPILE) -I../install+setup/libsmooth/ clamavctrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@
+
 launch-ether-wake: launch-ether-wake.c setuid.o ../install+setup/libsmooth/varval.o
        $(COMPILE) -I../install+setup/libsmooth/ launch-ether-wake.c setuid.o ../install+setup/libsmooth/varval.o -o $@
 
diff --git a/src/misc-progs/clamavctrl.c b/src/misc-progs/clamavctrl.c
new file mode 100644 (file)
index 0000000..09f5398
--- /dev/null
@@ -0,0 +1,44 @@
+/* This file is part of the IPFire Firewall.
+ *
+ * This program is distributed under the terms of the GNU General Public
+ * Licence.  See the file COPYING for details.
+ *
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include "setuid.h"
+
+int main(int argc, char *argv[]) {
+
+       if (!(initsetuid()))
+               exit(1);
+
+       if (argc < 2) {
+               fprintf(stderr, "\nNo argument given.\n\nclamavctrl (start|stop|restart)\n\n");
+               exit(1);
+       }
+
+       if (strcmp(argv[1], "start") == 0) {
+               safe_system("/etc/rc.d/init.d/clamav start");
+       } else if (strcmp(argv[1], "stop") == 0) {
+               safe_system("/etc/rc.d/init.d/clamav stop");
+       } else if (strcmp(argv[1], "restart") == 0) {
+               safe_system("/etc/rc.d/init.d/clamav restart");
+       } else if (strcmp(argv[1], "enable") == 0) {
+               safe_system("ln -fs ../init.d/clamav /etc/rc.d/rc3.d/S20clamav >/dev/null 2>&1");
+               safe_system("ln -fs ../init.d/clamav /etc/rc.d/rc0.d/K80clamav >/dev/null 2>&1");
+               safe_system("ln -fs ../init.d/clamav /etc/rc.d/rc6.d/K80clamav >/dev/null 2>&1");
+       } else if (strcmp(argv[1], "disable") == 0) {
+               safe_system("rm -f /etc/rc.d/rc*.d/*clamav >/dev/null 2>&1");
+       } else {
+               fprintf(stderr, "\nBad argument given.\n\nclamavctrl (start|stop|restart)\n\n");
+               exit(1);
+       }
+
+       return 0;
+}