Clamav-Fixes.

Clamavctrl gebaut & Initscript geschrieben.


git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@513 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
ms
2007-05-01 22:04:01 +00:00
parent b94abc417e
commit f7ff12a357
5 changed files with 92 additions and 1 deletions

View 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

View 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)

View File

@@ -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

View 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 $@

View File

@@ -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;
}