Timectrl geschrieben.
authorms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Sat, 12 May 2007 11:32:08 +0000 (11:32 +0000)
committerms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Sat, 12 May 2007 11:32:08 +0000 (11:32 +0000)
.svnignore hinzugefuegt.

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

.svnignore [new file with mode: 0644]
config/rootfiles/common/misc-progs
doc/language_issues.de
doc/language_issues.en
html/cgi-bin/time.cgi
src/misc-progs/Makefile
src/misc-progs/restartntpd.c [deleted file]
src/misc-progs/timecheckctrl.c [deleted file]
src/misc-progs/timectrl.c [new file with mode: 0644]

diff --git a/.svnignore b/.svnignore
new file mode 100644 (file)
index 0000000..40a1b37
--- /dev/null
@@ -0,0 +1,12 @@
+## svn propset svn:ignore -F .svnignore .
+*.iso
+*.md5
+*.tgz
+.config
+.svnignore
+build
+cache
+ccache
+packages
+svn_status
+log
index 4f4a498..08c4feb 100644 (file)
@@ -10,8 +10,7 @@ usr/local/bin/openvpnctrl
 usr/local/bin/qosctrl
 usr/local/bin/rebuildhosts
 usr/local/bin/redctrl
-usr/local/bin/restartapplejuice
-usr/local/bin/restartntpd
+#usr/local/bin/restartapplejuice
 usr/local/bin/restartsnort
 usr/local/bin/restartssh
 usr/local/bin/restartsyslogd
@@ -24,5 +23,5 @@ usr/local/bin/setportfw
 usr/local/bin/setxtaccess
 usr/local/bin/smartctrl
 usr/local/bin/squidctrl
-usr/local/bin/timecheckctrl
+usr/local/bin/timectrl
 usr/local/bin/upnpctrl
index 963d398..cc06b6a 100644 (file)
@@ -199,6 +199,9 @@ WARNING: translation string unused: missing gz
 WARNING: translation string unused: modulation
 WARNING: translation string unused: mount
 WARNING: translation string unused: nat-traversal
+WARNING: translation string unused: net address
+WARNING: translation string unused: net config type
+WARNING: translation string unused: net config type help
 WARNING: translation string unused: network configuration
 WARNING: translation string unused: network status information
 WARNING: translation string unused: new optionsfw later
index 26200f7..46b90d6 100644 (file)
@@ -213,6 +213,9 @@ WARNING: translation string unused: modulation
 WARNING: translation string unused: monthly firewallhits
 WARNING: translation string unused: mount
 WARNING: translation string unused: nat-traversal
+WARNING: translation string unused: net address
+WARNING: translation string unused: net config type
+WARNING: translation string unused: net config type help
 WARNING: translation string unused: network configuration
 WARNING: translation string unused: network status information
 WARNING: translation string unused: new optionsfw later
index 7fef11f..689f988 100644 (file)
@@ -124,6 +124,7 @@ ERROR:
        if ($timesettings{'ENABLENTP'} eq 'on' && $timesettings{'VALID'} eq 'yes')
        {
                system ('/usr/bin/touch', "${General::swroot}/time/enable");
+               system ('/usr/local/bin/timectrl enable >/dev/null 2>&1');
                &General::log($Lang::tr{'ntp syncro enabled'});
                unlink "${General::swroot}/time/counter";
                if ($timesettings{'UPDATE_METHOD'} eq 'periodically')
@@ -147,10 +148,11 @@ ERROR:
                unlink "${General::swroot}/time/enable";
                unlink "${General::swroot}/time/settimenow";
                unlink "${General::swroot}/time/allowclients"; # DPC added to 1.3.1
+               system ('/usr/local/bin/timectrl disable >/dev/null 2>&1');
                &General::log($Lang::tr{'ntp syncro disabled'})
        }
        if (! $errormessage) {
-               system ('/usr/local/bin/restartntpd'); # DPC added to 1.3.1
+               system ('/usr/local/bin/timectrl restart >/dev/null 2>&1'); # DPC added to 1.3.1
        }
 }
 
@@ -160,7 +162,7 @@ $timesettings{'ACTION'} = &Header::cleanhtml ($timesettings{'ACTION'});
 if ($timesettings{'ACTION'} eq $Lang::tr{'set time now'} && $timesettings{'ENABLENTP'} eq 'on')
 {
        system ('/usr/bin/touch', "${General::swroot}/time/settimenow");
-       system ('/usr/local/bin/timecheckctrl >& /dev/null');
+       system ('/usr/local/bin/timecheck >& /dev/null');
 }
 
 &General::readhash("${General::swroot}/time/settings", \%timesettings);
index 75e8f63..c28fd6a 100644 (file)
@@ -6,9 +6,9 @@ COMPILE=$(CC) $(CFLAGS)
 PROGS = iowrap
 SUID_PROGS = setdmzholes setportfw setfilters setxtaccess \
        squidctrl restartssh ipfirereboot setaliases \
-       ipsecctrl restartntpd dhcpctrl restartsnort \
+       ipsecctrl timectrl dhcpctrl restartsnort \
        restartapplejuice rebuildhosts \
-       restartsyslogd logwatch openvpnctrl timecheckctrl \
+       restartsyslogd logwatch openvpnctrl \
        restartwireless getipstat qosctrl launch-ether-wake \
        redctrl extrahdctrl sambactrl upnpctrl tripwirectrl \
        smartctrl clamavctrl
@@ -63,6 +63,9 @@ smartctrl: smartctrl.c setuid.o ../install+setup/libsmooth/varval.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 $@
+       
+timectrl: timectrl.c setuid.o ../install+setup/libsmooth/varval.o
+       $(COMPILE) -I../install+setup/libsmooth/ timectrl.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 $@
@@ -106,8 +109,5 @@ restartwireless: restartwireless.c setuid.o ../install+setup/libsmooth/varval.o
 ipsecctrl: ipsecctrl.c setuid.o ../install+setup/libsmooth/varval.o
        $(COMPILE) -I../install+setup/libsmooth/ ipsecctrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@
 
-timecheckctrl: timecheckctrl.c setuid.o ../install+setup/libsmooth/varval.o
-       $(COMPILE) -I../install+setup/libsmooth/ timecheckctrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@
-
 getipstat: getipstat.c setuid.o ../install+setup/libsmooth/varval.o
        $(COMPILE) -I../install+setup/libsmooth/ getipstat.c setuid.o ../install+setup/libsmooth/varval.o -o $@
diff --git a/src/misc-progs/restartntpd.c b/src/misc-progs/restartntpd.c
deleted file mode 100644 (file)
index 416f5ce..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/* IPFire helper program - restartntpd
- *
- * Starts or stops the ntpd daemon
- * 
- */
-         
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include "setuid.h"
-
-
-int main(void)
-{
-       int fd = -1;
-       int enable = 0;
-
-       if (!(initsetuid()))
-               exit(1);
-       
-       safe_system("/etc/rc.d/init.d/ntp stop 2>&1 >/dev/null");
-       sleep(3);
-
-       if ((fd = open(CONFIG_ROOT "/time/allowclients", O_RDONLY)) != -1)
-       {
-               close(fd);
-               enable = 1;
-       }
-
-       if (enable)
-       {
-               safe_system("/etc/rc.d/init.d/ntp start 2>&1 >/dev/null");
-       }
-       return 0;
-}
diff --git a/src/misc-progs/timecheckctrl.c b/src/misc-progs/timecheckctrl.c
deleted file mode 100644 (file)
index f661783..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/* SmoothWall helper program - smoothiedeath
- *
- * 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
- * starting shutdown.
- * 
- * $Id: ipcopdeath.c,v 1.2 2003/12/11 10:57:34 riddles Exp $
- * 
- */
-         
-#include <stdlib.h>
-#include "setuid.h"
-
-int main(void)
-{
-       if (!(initsetuid()))
-               exit(1);
-       
-       safe_system("/usr/local/bin/timecheck");
-       
-       return 0;
-}
diff --git a/src/misc-progs/timectrl.c b/src/misc-progs/timectrl.c
new file mode 100644 (file)
index 0000000..7c9fa59
--- /dev/null
@@ -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 <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\ntimectrl (start|stop|restart)\n\n");
+               exit(1);
+       }
+
+       if (strcmp(argv[1], "start") == 0) {
+               safe_system("/etc/rc.d/init.d/ntpd start");
+       } else if (strcmp(argv[1], "stop") == 0) {
+               safe_system("/etc/rc.d/init.d/ntpd stop");
+       } else if (strcmp(argv[1], "restart") == 0) {
+               safe_system("/etc/rc.d/init.d/ntpd restart");
+       } else if (strcmp(argv[1], "enable") == 0) {
+               safe_system("ln -fs ../init.d/ntpd /etc/rc.d/rc3.d/S26ntpd >/dev/null 2>&1");
+               safe_system("ln -fs ../init.d/ntpd /etc/rc.d/rc0.d/K46ntpd >/dev/null 2>&1");
+               safe_system("ln -fs ../init.d/ntpd /etc/rc.d/rc6.d/K46ntpd >/dev/null 2>&1");
+               safe_system("/etc/rc.d/init.d/ntpd start");
+       } else if (strcmp(argv[1], "disable") == 0) {
+               safe_system("/etc/rc.d/init.d/ntpd stop");
+               safe_system("rm -f /etc/rc.d/rc*.d/*ntpd >/dev/null 2>&1");
+       } else {
+               fprintf(stderr, "\nBad argument given.\n\ntimectrl (start|stop|restart)\n\n");
+               exit(1);
+       }
+
+       return 0;
+}