From 6bdd769d60b43319a9900ca6ffe5cee0e8cca7f8 Mon Sep 17 00:00:00 2001 From: ms Date: Mon, 7 May 2007 17:20:46 +0000 Subject: [PATCH] Clamav-Update Hardwareinformationen fuer Kudzu hinzugefuegt. dhcpctrl-Datei erstellt. git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@540 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8 --- config/rootfiles/common/hwdata | 2 + config/rootfiles/common/initscripts | 1 + config/rootfiles/common/misc-progs | 2 +- html/cgi-bin/dhcp.cgi | 2 +- lfs/clamav | 6 +- src/initscripts/init.d/dhcp | 57 +++++++++++ src/misc-progs/Makefile | 6 +- src/misc-progs/dhcpctrl.c | 46 +++++++++ src/misc-progs/restartdhcp.c | 145 ---------------------------- 9 files changed, 114 insertions(+), 153 deletions(-) create mode 100644 config/rootfiles/common/hwdata create mode 100644 src/initscripts/init.d/dhcp create mode 100644 src/misc-progs/dhcpctrl.c delete mode 100644 src/misc-progs/restartdhcp.c diff --git a/config/rootfiles/common/hwdata b/config/rootfiles/common/hwdata new file mode 100644 index 000000000..30d51a2d0 --- /dev/null +++ b/config/rootfiles/common/hwdata @@ -0,0 +1,2 @@ +usr/share/hwdata/usb.ids +usr/share/hwdata/pci.ids diff --git a/config/rootfiles/common/initscripts b/config/rootfiles/common/initscripts index 5e74204ff..cbd8d774e 100644 --- a/config/rootfiles/common/initscripts +++ b/config/rootfiles/common/initscripts @@ -9,6 +9,7 @@ etc/rc.d/init.d/checkfs etc/rc.d/init.d/cleanfs etc/rc.d/init.d/connectioncheck etc/rc.d/init.d/console +etc/rc.d/init.d/dhcp etc/rc.d/init.d/fcron etc/rc.d/init.d/firewall etc/rc.d/init.d/functions diff --git a/config/rootfiles/common/misc-progs b/config/rootfiles/common/misc-progs index 6d2ed9e27..4f4a498e2 100644 --- a/config/rootfiles/common/misc-progs +++ b/config/rootfiles/common/misc-progs @@ -1,3 +1,4 @@ +usr/local/bin/dhcpctrl usr/local/bin/extrahdctrl usr/local/bin/getipstat #usr/local/bin/iowrap @@ -10,7 +11,6 @@ usr/local/bin/qosctrl usr/local/bin/rebuildhosts usr/local/bin/redctrl usr/local/bin/restartapplejuice -usr/local/bin/restartdhcp usr/local/bin/restartntpd usr/local/bin/restartsnort usr/local/bin/restartssh diff --git a/html/cgi-bin/dhcp.cgi b/html/cgi-bin/dhcp.cgi index 87134a469..6ae7253d2 100644 --- a/html/cgi-bin/dhcp.cgi +++ b/html/cgi-bin/dhcp.cgi @@ -1224,7 +1224,7 @@ sub buildconf { } } close FILE; - system '/usr/local/bin/restartdhcp'; + system '/usr/local/bin/dhcpctrl restart >/dev/null 2>&1'; } # diff --git a/lfs/clamav b/lfs/clamav index 801c2885d..27c6dde8a 100644 --- a/lfs/clamav +++ b/lfs/clamav @@ -26,7 +26,7 @@ include Config -VER = 0.90 +VER = 0.90.2 THISAPP = clamav-$(VER) DL_FILE = $(THISAPP).tar.gz @@ -44,7 +44,7 @@ objects = $(DL_FILE) $(DL_FILE) = $(DL_FROM)/$(DL_FILE) -$(DL_FILE)_MD5 = f04372e49c3c5ff3bd94bbe1fef2eaca +$(DL_FILE)_MD5 = 39d1f07a399b551b55096b6ec7325c33 install : $(TARGET) @@ -80,7 +80,7 @@ $(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 clamav.clamav /usr/share/clamav -R + chown clamav.clamav -R /usr/share/clamav/ cp -rf $(DIR_SRC)/config/clamav/* /var/ipfire/clamav/ @rm -rf $(DIR_APP) @$(POSTBUILD) diff --git a/src/initscripts/init.d/dhcp b/src/initscripts/init.d/dhcp new file mode 100644 index 000000000..3084410a0 --- /dev/null +++ b/src/initscripts/init.d/dhcp @@ -0,0 +1,57 @@ +#!/bin/sh +# Begin $rc_base/init.d/dhcp + +# Based on sysklogd script from LFS-3.1 and earlier. +# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org +# Modified for IPFire by Michael Tremer - mitch@ipfire.org + +. /etc/sysconfig/rc +. $rc_functions +eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings) + +case "$1" in + start) + iptables -F DHCPBLUEINPUT + if [ -e /var/ipfire/dhcp/enable_green ]; then + devices="${GREEN_DEV}" + fi + if [ -e /var/ipfire/dhcp/enable_blue ]; then + devices=+" ${BLUE_DEV}" + + iptables -A DHCPBLUEINPUT -p tcp --source-port 68 --destination-port 67 -i ${BLUE_DEV} -j ACCEPT > /dev/null 2>&1 + iptables -A DHCPBLUEINPUT -p udp --source-port 68 --destination-port 67 -i ${BLUE_DEV} -j ACCEPT > /dev/null 2>&1 + fi + + boot_mesg "Starting DHCP Server..." + loadproc /usr/sbin/dhcpd -q ${devices} + + chmod 644 /var/run/dhcpd.pid # Fix because silly dhcpd creates its pid with mode 640 + ;; + + stop) + boot_mesg "Stopping DHCP Server..." + killproc /usr/sbin/dhcpd + ;; + + reload) + boot_mesg "Reloading DHCP Server..." + reloadproc /usr/sbin/dhcpd + ;; + + restart) + $0 stop + sleep 1 + $0 start + ;; + + status) + statusproc /usr/sbin/dhcpd + ;; + + *) + echo "Usage: $0 {start|stop|reload|restart|status}" + exit 1 + ;; +esac + +# End $rc_base/init.d/dhcp diff --git a/src/misc-progs/Makefile b/src/misc-progs/Makefile index 7302cffd7..75e8f63fc 100644 --- a/src/misc-progs/Makefile +++ b/src/misc-progs/Makefile @@ -6,7 +6,7 @@ COMPILE=$(CC) $(CFLAGS) PROGS = iowrap SUID_PROGS = setdmzholes setportfw setfilters setxtaccess \ squidctrl restartssh ipfirereboot setaliases \ - ipsecctrl restartntpd restartdhcp restartsnort \ + ipsecctrl restartntpd dhcpctrl restartsnort \ restartapplejuice rebuildhosts \ restartsyslogd logwatch openvpnctrl timecheckctrl \ restartwireless getipstat qosctrl launch-ether-wake \ @@ -85,8 +85,8 @@ rebuildhosts: rebuildhosts.c setuid.o ../install+setup/libsmooth/varval.o restartapplejuice: restartapplejuice.c setuid.o ../install+setup/libsmooth/varval.o $(COMPILE) -I../install+setup/libsmooth/ restartapplejuice.c setuid.o ../install+setup/libsmooth/varval.o -o $@ -restartdhcp: restartdhcp.c setuid.o ../install+setup/libsmooth/varval.o - $(COMPILE) -I../install+setup/libsmooth/ restartdhcp.c setuid.o ../install+setup/libsmooth/varval.o -o $@ +dhcpctrl: dhcpctrl.c setuid.o ../install+setup/libsmooth/varval.o + $(COMPILE) -I../install+setup/libsmooth/ dhcpctrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@ restartssh: restartssh.c setuid.o ../install+setup/libsmooth/varval.o $(COMPILE) -I../install+setup/libsmooth/ restartssh.c setuid.o ../install+setup/libsmooth/varval.o -o $@ diff --git a/src/misc-progs/dhcpctrl.c b/src/misc-progs/dhcpctrl.c new file mode 100644 index 000000000..85ef709cf --- /dev/null +++ b/src/misc-progs/dhcpctrl.c @@ -0,0 +1,46 @@ +/* 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 +#include +#include +#include +#include +#include +#include "setuid.h" + +int main(int argc, char *argv[]) { + + if (!(initsetuid())) + exit(1); + + if (argc < 2) { + fprintf(stderr, "\nNo argument given.\n\ndhcpctrl (start|stop|restart|reload)\n\n"); + exit(1); + } + + if (strcmp(argv[1], "start") == 0) { + safe_system("/etc/rc.d/init.d/dhcp start"); + } else if (strcmp(argv[1], "stop") == 0) { + safe_system("/etc/rc.d/init.d/dhcp stop"); + } else if (strcmp(argv[1], "restart") == 0) { + safe_system("/etc/rc.d/init.d/dhcp restart"); + } else if (strcmp(argv[1], "reload") == 0) { + safe_system("/etc/rc.d/init.d/dhcp reload"); + } else if (strcmp(argv[1], "enable") == 0) { + safe_system("ln -fs ../init.d/dhcp /etc/rc.d/rc3.d/S30dhcp >/dev/null 2>&1"); + safe_system("ln -fs ../init.d/dhcp /etc/rc.d/rc0.d/K30dhcp >/dev/null 2>&1"); + safe_system("ln -fs ../init.d/dhcp /etc/rc.d/rc6.d/K30dhcp >/dev/null 2>&1"); + } else if (strcmp(argv[1], "disable") == 0) { + safe_system("rm -f /etc/rc.d/rc*.d/*dhcp >/dev/null 2>&1"); + } else { + fprintf(stderr, "\nBad argument given.\n\ndhcpctrl (start|stop|restart|reload)\n\n"); + exit(1); + } + + return 0; +} diff --git a/src/misc-progs/restartdhcp.c b/src/misc-progs/restartdhcp.c deleted file mode 100644 index 178a51ed8..000000000 --- a/src/misc-progs/restartdhcp.c +++ /dev/null @@ -1,145 +0,0 @@ -/* SmoothWall helper program - restartdhcp - * - * This program is distributed under the terms of the GNU General Public - * Licence. See the file COPYING for details. - * - * (c) Lawrence Manning, 2001 - * Simple program intended to be installed setuid(0) that can be used for - * restarting DHCPd. - * - * $Id: restartdhcp.c,v 1.5.2.1 2004/11/03 13:50:26 alanh Exp $ - * - */ - -#include "libsmooth.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include "setuid.h" - -int main(void) -{ - int fd = -1; - int fdblue = -1; - char buffer[STRING_SIZE]; - char blue_dev[STRING_SIZE] = "", green_dev[STRING_SIZE] = ""; - int pid; - struct keyvalue *kv = NULL; - - if (!(initsetuid())) - exit(1); - - memset(buffer, 0, STRING_SIZE); - - /* Init the keyvalue structure */ - kv=initkeyvalues(); - - /* Read in the current values */ - if (!readkeyvalues(kv, CONFIG_ROOT "/ethernet/settings")) - { - fprintf(stderr, "Cannot read ethernet settings\n"); - exit(1); - } - - if (!findkey(kv, "GREEN_DEV", green_dev)) - { - fprintf(stderr, "Cannot read GREEN_DEV\n"); - exit(1); - } - - if (!VALID_DEVICE(green_dev)) - { - fprintf(stderr, "Bad GREEN_DEV: %s\n", green_dev); - exit(1); - } - - /* Get the BLUE interface details */ - findkey(kv, "BLUE_DEV", blue_dev); - - freekeyvalues(kv); - - if ((fdblue = open(CONFIG_ROOT "/dhcp/enable_blue", O_RDONLY)) != -1) - { - close(fdblue); - if (!VALID_DEVICE(blue_dev)) - { - fprintf(stderr, "Bad BLUE_DEV: %s\n", blue_dev); - exit(1); - } - } - - if ((fd = open("/var/run/dhcpd.pid", O_RDONLY)) != -1) - { - if (read(fd, buffer, STRING_SIZE - 1) == -1) - fprintf(stderr, "Couldn't read from pid file\n"); - else - { - pid = atoi(buffer); - if (pid <= 1) - fprintf(stderr, "Bad pid value\n"); - else - { - if (kill(pid, SIGTERM) == -1) - fprintf(stderr, "Unable to send SIGTERM\n"); - else - unlink("/var/run/dhcpd.pid"); - } - } - safe_system("/bin/killall -KILL dhcpd"); - close(fd); - } - - safe_system("/sbin/iptables -F DHCPBLUEINPUT"); - - buffer[0] = '\0'; - - if ((fd = open(CONFIG_ROOT "/dhcp/enable_green", O_RDONLY)) != -1) - { - close(fd); - if ((fdblue = open(CONFIG_ROOT "/dhcp/enable_blue", O_RDONLY)) != -1) - { - close(fdblue); - - snprintf(buffer, STRING_SIZE-1, "/sbin/iptables -A DHCPBLUEINPUT -p tcp --source-port 68 --destination-port 67 -i %s -j ACCEPT > /dev/null 2>&1", blue_dev); - safe_system(buffer); - snprintf(buffer, STRING_SIZE-1, "/sbin/iptables -A DHCPBLUEINPUT -p udp --source-port 68 --destination-port 67 -i %s -j ACCEPT > /dev/null 2>&1", blue_dev); - safe_system(buffer); - snprintf(buffer, STRING_SIZE-1, "/usr/sbin/dhcpd -q %s %s", green_dev, blue_dev); - } else { - snprintf(buffer, STRING_SIZE-1, "/usr/sbin/dhcpd -q %s", green_dev); - } - safe_system(buffer); - } else { - if ((fdblue = open(CONFIG_ROOT "/dhcp/enable_blue", O_RDONLY)) != -1) - { - close(fdblue); - - snprintf(buffer, STRING_SIZE-1, "/sbin/iptables -A DHCPBLUEINPUT -p tcp --source-port 68 --destination-port 67 -i %s -j ACCEPT > /dev/null 2>&1", blue_dev); - safe_system(buffer); - snprintf(buffer, STRING_SIZE-1, "/sbin/iptables -A DHCPBLUEINPUT -p udp --source-port 68 --destination-port 67 -i %s -j ACCEPT > /dev/null 2>&1", blue_dev); - safe_system(buffer); - snprintf(buffer, STRING_SIZE-1, "/usr/sbin/dhcpd -q %s", blue_dev); - safe_system(buffer); - } - } - - if (buffer[0] != '\0') - { - /* Silly dhcpd creates pids with mode 640 */ - sleep (1); - if ((fd = open("/var/run/dhcpd.pid", 0)) == -1) - { - fprintf(stderr, "No pid file\n"); - return 1; - } - fchmod(fd, 00644); - close(fd); - } - - return 0; -} -- 2.39.2