]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/commitdiff
Alle Restartskripte umbenannt in CTRL Skripte
authormaniacikarus <maniacikarus@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Thu, 23 Aug 2007 10:58:00 +0000 (10:58 +0000)
committermaniacikarus <maniacikarus@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Thu, 23 Aug 2007 10:58:00 +0000 (10:58 +0000)
git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@812 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8

config/rootfiles/common/misc-progs
html/cgi-bin/backup.cgi
html/cgi-bin/logs.cgi/config.dat
html/cgi-bin/remote.cgi
html/cgi-bin/wireless.cgi
src/initscripts/init.d/network
src/misc-progs/Makefile
src/misc-progs/sshctrl.c [moved from src/misc-progs/restartssh.c with 91% similarity]
src/misc-progs/syslogdctrl.c [moved from src/misc-progs/restartsyslogd.c with 100% similarity]
src/misc-progs/wirelessctrl.c [moved from src/misc-progs/restartwireless.c with 94% similarity]
tools/finder.sh

index e9cb406606eeaed20d76956c554820c245112372..87cef398cfbc4037e4f2c25be91684bd767ad875 100644 (file)
@@ -16,8 +16,6 @@ usr/local/bin/pakfire
 usr/local/bin/qosctrl
 usr/local/bin/rebuildhosts
 usr/local/bin/redctrl
-usr/local/bin/restartssh
-usr/local/bin/restartwireless
 #usr/local/bin/sambactrl
 usr/local/bin/setdmzholes
 usr/local/bin/setportfw
@@ -25,7 +23,10 @@ usr/local/bin/setxtaccess
 usr/local/bin/smartctrl
 usr/local/bin/snortctrl
 usr/local/bin/squidctrl
+usr/local/bin/sshctrls
+usr/local/bin/syslogdctrl
 usr/local/bin/timectrl
 #usr/local/bin/tripwirectrl
 usr/local/bin/upnpctrl
-usr/local/bin/restartsyslogd
+usr/local/bin/wirelessctrl
+
index 877e6345887da05d2f7596c7373628f75fddad37..cb865495d0efad75578ee182727cc06ed57dc562 100644 (file)
@@ -58,7 +58,7 @@ elsif ( $cgiparams{'ACTION'} eq "restore" )
   print UPLOADFILE;
   }
   close UPLOADFILE;
-  system("/usr/local/bin/backupctrl restore");
+  system("/usr/local/bin/backupctrl restore >/dev/null");
 }
 
 &Header::showhttpheaders();
index 4ef89ef75e28bd56c40e49172981c2629d8ae9ca..651853b9fb15fe39e4e78f19b24fd7d7c1be615a 100644 (file)
@@ -58,7 +58,7 @@ if ($logsettings{'ACTION'} eq $Lang::tr{'save'})
   unless ($errormessage)
   {
     &General::writehash("${General::swroot}/logging/settings", \%logsettings);
-    system('/usr/local/bin/restartsyslogd') == 0
+    system('/usr/local/bin/syslogdctrl') == 0
       or $errormessage = "$Lang::tr{'bad return code'} " . $?/256;
   }
 
index 3b5916d99db1f6392dd811ef5eb9d26ed01507da..c0d25532b622ce5c963a39f1a85c103476c087ff 100644 (file)
@@ -64,15 +64,15 @@ if ( (($remotesettings{'ACTION'} eq $Lang::tr{'save'}) || ($remotesettings{'ACTI
                &General::log($Lang::tr{'ssh1 disabled'});
        }
 if ( $remotesettings{'ACTION'} eq $Lang::tr{'ssh tempstart15'} ){
-       system('/usr/local/bin/restartssh','tempstart15') == 0
+       system('/usr/local/bin/sshctrl','tempstart15') == 0
                or $errormessage = "$Lang::tr{'bad return code'} " . $?/256;
  }
 elsif ( $remotesettings{'ACTION'} eq $Lang::tr{'ssh tempstart30'} ){
-       system('/usr/local/bin/restartssh','tempstart30') == 0
+       system('/usr/local/bin/sshctrl','tempstart30') == 0
                or $errormessage = "$Lang::tr{'bad return code'} " . $?/256;
  }
 else {
-       system('/usr/local/bin/restartssh') == 0
+       system('/usr/local/bin/sshctrl') == 0
                or $errormessage = "$Lang::tr{'bad return code'} " . $?/256;
  }
 }
index 3964835cdde4666920fa5bfd7ef66b8e1fdb5800..3a37b1512ccc901f3b34a860cc669c4e714b3562 100644 (file)
@@ -124,7 +124,7 @@ ADDERROR:
                close(FILE);
                undef %cgiparams;
                &General::log($Lang::tr{'wireless config added'});
-               system('/usr/local/bin/restartwireless');
+               system('/usr/local/bin/wirelessctrl');
        }
 ADDEXIT:
 }
@@ -148,7 +148,7 @@ if ($cgiparams{'ACTION'} eq 'edit')
                }
        }
        &General::log($Lang::tr{'wireless config changed'});
-       system('/usr/local/bin/restartwireless');
+       system('/usr/local/bin/wirelessctrl');
 }
 
 if ($cgiparams{'ACTION'} eq 'remove' || $cgiparams{'ACTION'} eq 'toggle')
@@ -169,7 +169,7 @@ if ($cgiparams{'ACTION'} eq 'remove' || $cgiparams{'ACTION'} eq 'toggle')
        }
        close(FILE);
        &General::log($Lang::tr{'wireless config changed'});
-       system('/usr/local/bin/restartwireless');
+       system('/usr/local/bin/wirelessctrl');
 }
 
 
index b2302e06a18b47f9873c2a528cfd6f783d3e7fd1..a6775027eddd5e8c4e8c3db96f03734cbb89afb1 100644 (file)
@@ -42,7 +42,7 @@ init_networking() {
 
        if [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then
                boot_mesg "Setting up wireless firewall rules"
-               /usr/local/bin/restartwireless; evaluate_retval
+               /usr/local/bin/wirelessctrl; evaluate_retval
        fi
 
        /etc/rc.d/init.d/dnsmasq start
index 178099819cf2a84f4e46faa529ed65b3c096b3cd..27b472b35c8be4038eefaed27901f553b8d2fb09 100644 (file)
@@ -5,12 +5,12 @@ COMPILE=$(CC) $(CFLAGS)
 
 PROGS = iowrap
 SUID_PROGS = setdmzholes setportfw setxtaccess \
-       squidctrl restartssh ipfirereboot \
+       squidctrl sshctrl ipfirereboot \
        ipsecctrl timectrl dhcpctrl snortctrl \
        applejuicectrl rebuildhosts backupctrl \
        logwatch openvpnctrl outgoingfwctrl \
-       restartwireless getipstat qosctrl launch-ether-wake \
-       redctrl restartsyslogd extrahdctrl sambactrl upnpctrl tripwirectrl \
+       wirelessctrl getipstat qosctrl launch-ether-wake \
+       redctrl syslogdctrl extrahdctrl sambactrl upnpctrl tripwirectrl \
        smartctrl clamavctrl pakfire mpfirectrl
 
 install : all
@@ -88,8 +88,8 @@ applejuicectrl: applejuicectrl.c setuid.o ../install+setup/libsmooth/varval.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 $@
+sshctrl: sshctrl.c setuid.o ../install+setup/libsmooth/varval.o
+       $(COMPILE) -I../install+setup/libsmooth/ sshctrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@
 
 squidctrl: squidctrl.c setuid.o ../install+setup/libsmooth/varval.o
        $(COMPILE) -I../install+setup/libsmooth/ squidctrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@
@@ -97,8 +97,8 @@ squidctrl: squidctrl.c setuid.o ../install+setup/libsmooth/varval.o
 snortctrl: snortctrl.c setuid.o ../install+setup/libsmooth/varval.o
        $(COMPILE) -I../install+setup/libsmooth/ snortctrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@
 
-restartwireless: restartwireless.c setuid.o ../install+setup/libsmooth/varval.o
-       $(COMPILE) -I../install+setup/libsmooth/ restartwireless.c setuid.o ../install+setup/libsmooth/varval.o -o $@
+wirelessctrl: wirelessctrl.c setuid.o ../install+setup/libsmooth/varval.o
+       $(COMPILE) -I../install+setup/libsmooth/ wirelessctrl.c setuid.o ../install+setup/libsmooth/varval.o -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 $@
@@ -115,5 +115,5 @@ mpfirectrl: mpfirectrl.c setuid.o ../install+setup/libsmooth/varval.o
 backupctrl: backupctrl.c setuid.o ../install+setup/libsmooth/varval.o
        $(COMPILE) -I../install+setup/libsmooth/ backupctrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@
 
-restartsyslogd: restartsyslogd.c setuid.o ../install+setup/libsmooth/varval.o
-       $(COMPILE) -I../install+setup/libsmooth/ restartsyslogd.c setuid.o ../install+setup/libsmooth/varval.o -o $@
+syslogdctrl: syslogdctrl.c setuid.o ../install+setup/libsmooth/varval.o
+       $(COMPILE) -I../install+setup/libsmooth/ syslogdctrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@
similarity index 91%
rename from src/misc-progs/restartssh.c
rename to src/misc-progs/sshctrl.c
index 40ef2159e08957fc9bb99f8b929953b1de7d5158..b747421dea0c5df5e4e021e7fa46d43430539972 100644 (file)
@@ -1,4 +1,4 @@
-/* SmoothWall helper program - restartssh
+/* SmoothWall helper program - sshctrl
  *
  * This program is distributed under the terms of the GNU General Public
  * Licence.  See the file COPYING for details.
@@ -7,7 +7,7 @@
  * Simple program intended to be installed setuid(0) that can be used for
  * restarting SSHd. 
  * 
- * $Id: restartssh.c,v 1.3 2003/12/11 10:57:34 riddles Exp $
+ * $Id: sshctrl.c,v 1.3 2003/12/11 10:57:34 riddles Exp $
  * 
  */
 
 int main(int argc, char *argv[])
 {
        if (strcmp(argv[1], "tempstart15") == 0) {
-                     safe_system("/usr/local/bin/restartssh");
+                     safe_system("/usr/local/bin/sshctrl");
           sleep(5);
                                        unlink("/var/ipfire/remote/enablessh");
                                        safe_system("cat /var/ipfire/remote/settings | sed 's/ENABLE_SSH=on/ENABLE_SSH=off/' > /var/ipfire/remote/settings2 && mv /var/ipfire/remote/settings2 /var/ipfire/remote/settings");
-                     safe_system("sleep 900 && /usr/local/bin/restartssh &");
+                     safe_system("sleep 900 && /usr/local/bin/sshctrl &");
        }
   else if (strcmp(argv[1], "tempstart30") == 0) {
-                     safe_system("/usr/local/bin/restartssh");
+                     safe_system("/usr/local/bin/sshctrl");
           sleep(5);
                                        unlink("/var/ipfire/remote/enablessh");
                                        safe_system("cat /var/ipfire/remote/settings | sed 's/ENABLE_SSH=on/ENABLE_SSH=off/' > /var/ipfire/remote/settings2 && mv /var/ipfire/remote/settings2 /var/ipfire/remote/settings");
-                     safe_system("sleep 1800 && /usr/local/bin/restartssh &");
+                     safe_system("sleep 1800 && /usr/local/bin/sshctrl &");
        } else {
        int fd, config_fd, rc, pid;
        char buffer[STRING_SIZE], command[STRING_SIZE] = "/bin/sed -e '";
@@ -53,7 +53,7 @@ int main(int argc, char *argv[])
        }
 
        /* By using O_CREAT with O_EXCL open() will fail if the file already exists,
-        * this prevents 2 copies of restartssh both trying to edit the config file
+        * this prevents 2 copies of sshctrl both trying to edit the config file
         * at once. It also prevents race conditions, but these shouldn't be
         * possible as /etc/ssh/ should only be writable by root anyhow
         */
similarity index 94%
rename from src/misc-progs/restartwireless.c
rename to src/misc-progs/wirelessctrl.c
index 79b519df44bb9500fe47693db732a55800c117e7..51f3f254d20e4ad6776fb6229479014d4d874212 100644 (file)
-/* IPCop helper program - restartwireless\r
- *\r
- * This program is distributed under the terms of the GNU General Public\r
- * Licence.  See the file COPYING for details.\r
- *\r
- * (c) Alan Hourihane, 2003\r
- * \r
- * $Id: restartwireless.c,v 1.2.2.5 2005/07/11 10:56:47 franck78 Exp $\r
- *\r
- */\r
-\r
-#include "libsmooth.h"\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <unistd.h>\r
-#include <fcntl.h>\r
-#include <string.h>\r
-#include <sys/types.h>\r
-#include <sys/stat.h>\r
-#include <signal.h>\r
-#include "setuid.h"\r
-\r
-FILE *fd = NULL;\r
-char blue_dev[STRING_SIZE] = "";\r
-char command[STRING_SIZE];\r
-\r
-void exithandler(void)\r
-{\r
-       if(strlen(blue_dev))\r
-       {\r
-               snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSINPUT -i %s -j LOG_DROP", blue_dev);\r
-               safe_system(command);\r
-               snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -i %s -j LOG_DROP", blue_dev);\r
-               safe_system(command);\r
-       }\r
-\r
-       if (fd)\r
-               fclose(fd);\r
-}\r
-\r
-int main(void)\r
-{\r
-       char green_dev[STRING_SIZE] = "";\r
-       char buffer[STRING_SIZE];\r
-       char *index, *ipaddress, *macaddress, *enabled;\r
-       struct keyvalue *kv = NULL;\r
-\r
-       if (!(initsetuid()))\r
-               exit(1);\r
-\r
-       /* flush wireless iptables */\r
-       safe_system("/sbin/iptables -F WIRELESSINPUT > /dev/null 2> /dev/null");\r
-       safe_system("/sbin/iptables -F WIRELESSFORWARD > /dev/null 2> /dev/null");\r
-\r
-       memset(buffer, 0, STRING_SIZE);\r
-\r
-       /* Init the keyvalue structure */\r
-       kv=initkeyvalues();\r
-\r
-       /* Read in the current values */\r
-       if (!readkeyvalues(kv, CONFIG_ROOT "/ethernet/settings"))\r
-       {\r
-               fprintf(stderr, "Cannot read ethernet settings\n");\r
-               exit(1);\r
-       }\r
-\r
-       /* Get the GREEN interface details */\r
-       if(!findkey(kv, "GREEN_DEV", green_dev))\r
-       {\r
-               fprintf(stderr, "Cannot read GREEN_DEV\n");\r
-               exit(1);\r
-       }\r
-       if (!VALID_DEVICE(green_dev))\r
-       {\r
-               fprintf(stderr, "Bad GREEN_DEV: %s\n", green_dev);\r
-               exit(1);\r
-       }\r
-       /* Get the BLUE interface details */\r
-       if(!findkey(kv, "BLUE_DEV", blue_dev))\r
-       {\r
-               fprintf(stderr, "Cannot read BLUE_DEV\n");\r
-               exit(1);\r
-       }\r
-       if (strlen(blue_dev) && !VALID_DEVICE(blue_dev))\r
-       {\r
-               fprintf(stderr, "Bad BLUE_DEV: %s\n", blue_dev);\r
-               exit(1);\r
-       }\r
-       if(! strlen(blue_dev) > 0)\r
-       {\r
-               fprintf(stderr, "No BLUE interface\n");\r
-               exit(0);\r
-       }\r
-\r
-       /* register exit handler to ensure the block rule is always present */\r
-       atexit(exithandler);\r
-\r
-       if (!(fd = fopen(CONFIG_ROOT "/wireless/config", "r")))\r
-       {\r
-               exit(0);\r
-       }\r
-       while (fgets(buffer, STRING_SIZE, fd))\r
-       {\r
-               buffer[strlen(buffer) - 1] = 0;\r
-\r
-               index = strtok(buffer, ",");\r
-               ipaddress = strtok(NULL, ",");\r
-               macaddress = strtok(NULL, ",");\r
-               enabled = strtok(NULL, ",");\r
-\r
-               if (!strncmp(enabled, "on", 2)) {\r
-               \r
-                       /* both specified, added security */\r
-                       if ((strlen(macaddress) == 17) && \r
-                           (VALID_IP(ipaddress))) {\r
-                               snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSINPUT -m mac --mac-source %s -s %s -i %s -j ACCEPT", macaddress, ipaddress, blue_dev);\r
-                               safe_system(command);\r
-                               snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -m mac --mac-source %s -s %s -i %s -o ! %s -j ACCEPT", macaddress, ipaddress, blue_dev, green_dev);\r
-                               safe_system(command);\r
-                               snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -m mac --mac-source %s -s %s -i %s -j DMZHOLES", macaddress, ipaddress, blue_dev);\r
-                               safe_system(command);\r
-                       } else {\r
-\r
-                               /* correctly formed mac address is 17 chars */\r
-                               if (strlen(macaddress) == 17) {\r
-                                       snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSINPUT -m mac --mac-source %s -i %s -j ACCEPT", macaddress, blue_dev);\r
-                                       safe_system(command);\r
-                                       snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -m mac --mac-source %s -i %s -o ! %s -j ACCEPT", macaddress, blue_dev, green_dev);\r
-                                       safe_system(command);\r
-                                       snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -m mac --mac-source %s -i %s -j DMZHOLES", macaddress, blue_dev);\r
-                                       safe_system(command);\r
-                               }\r
-\r
-                               if (VALID_IP(ipaddress)) {\r
-                                       snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSINPUT -s %s -i %s -j ACCEPT", ipaddress, blue_dev);\r
-                                       safe_system(command);\r
-                                       snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -s %s -i %s -o ! %s -j ACCEPT", ipaddress, blue_dev, green_dev);\r
-                                       safe_system(command);\r
-                                       snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -s %s -i %s -j DMZHOLES", ipaddress, blue_dev);\r
-                                       safe_system(command);\r
-                               }\r
-                       }\r
-               }\r
-       }\r
-\r
-       return 0;\r
-}\r
+/* IPCop helper program - wirelessctrl
+ *
+ * This program is distributed under the terms of the GNU General Public
+ * Licence.  See the file COPYING for details.
+ *
+ * (c) Alan Hourihane, 2003
+ * 
+ * $Id: wirelessctrl.c,v 1.2.2.5 2005/07/11 10:56:47 franck78 Exp $
+ *
+ */
+
+#include "libsmooth.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <signal.h>
+#include "setuid.h"
+
+FILE *fd = NULL;
+char blue_dev[STRING_SIZE] = "";
+char command[STRING_SIZE];
+
+void exithandler(void)
+{
+       if(strlen(blue_dev))
+       {
+               snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSINPUT -i %s -j LOG_DROP", blue_dev);
+               safe_system(command);
+               snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -i %s -j LOG_DROP", blue_dev);
+               safe_system(command);
+       }
+
+       if (fd)
+               fclose(fd);
+}
+
+int main(void)
+{
+       char green_dev[STRING_SIZE] = "";
+       char buffer[STRING_SIZE];
+       char *index, *ipaddress, *macaddress, *enabled;
+       struct keyvalue *kv = NULL;
+
+       if (!(initsetuid()))
+               exit(1);
+
+       /* flush wireless iptables */
+       safe_system("/sbin/iptables -F WIRELESSINPUT > /dev/null 2> /dev/null");
+       safe_system("/sbin/iptables -F WIRELESSFORWARD > /dev/null 2> /dev/null");
+
+       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);
+       }
+
+       /* Get the GREEN interface details */
+       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 */
+       if(!findkey(kv, "BLUE_DEV", blue_dev))
+       {
+               fprintf(stderr, "Cannot read BLUE_DEV\n");
+               exit(1);
+       }
+       if (strlen(blue_dev) && !VALID_DEVICE(blue_dev))
+       {
+               fprintf(stderr, "Bad BLUE_DEV: %s\n", blue_dev);
+               exit(1);
+       }
+       if(! strlen(blue_dev) > 0)
+       {
+               fprintf(stderr, "No BLUE interface\n");
+               exit(0);
+       }
+
+       /* register exit handler to ensure the block rule is always present */
+       atexit(exithandler);
+
+       if (!(fd = fopen(CONFIG_ROOT "/wireless/config", "r")))
+       {
+               exit(0);
+       }
+       while (fgets(buffer, STRING_SIZE, fd))
+       {
+               buffer[strlen(buffer) - 1] = 0;
+
+               index = strtok(buffer, ",");
+               ipaddress = strtok(NULL, ",");
+               macaddress = strtok(NULL, ",");
+               enabled = strtok(NULL, ",");
+
+               if (!strncmp(enabled, "on", 2)) {
+               
+                       /* both specified, added security */
+                       if ((strlen(macaddress) == 17) && 
+                           (VALID_IP(ipaddress))) {
+                               snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSINPUT -m mac --mac-source %s -s %s -i %s -j ACCEPT", macaddress, ipaddress, blue_dev);
+                               safe_system(command);
+                               snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -m mac --mac-source %s -s %s -i %s -o ! %s -j ACCEPT", macaddress, ipaddress, blue_dev, green_dev);
+                               safe_system(command);
+                               snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -m mac --mac-source %s -s %s -i %s -j DMZHOLES", macaddress, ipaddress, blue_dev);
+                               safe_system(command);
+                       } else {
+
+                               /* correctly formed mac address is 17 chars */
+                               if (strlen(macaddress) == 17) {
+                                       snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSINPUT -m mac --mac-source %s -i %s -j ACCEPT", macaddress, blue_dev);
+                                       safe_system(command);
+                                       snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -m mac --mac-source %s -i %s -o ! %s -j ACCEPT", macaddress, blue_dev, green_dev);
+                                       safe_system(command);
+                                       snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -m mac --mac-source %s -i %s -j DMZHOLES", macaddress, blue_dev);
+                                       safe_system(command);
+                               }
+
+                               if (VALID_IP(ipaddress)) {
+                                       snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSINPUT -s %s -i %s -j ACCEPT", ipaddress, blue_dev);
+                                       safe_system(command);
+                                       snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -s %s -i %s -o ! %s -j ACCEPT", ipaddress, blue_dev, green_dev);
+                                       safe_system(command);
+                                       snprintf(command, STRING_SIZE-1, "/sbin/iptables -A WIRELESSFORWARD -s %s -i %s -j DMZHOLES", ipaddress, blue_dev);
+                                       safe_system(command);
+                               }
+                       }
+               }
+       }
+
+       return 0;
+}
index 8022cb0a49909941b1a5874044665405b700bc9e..a88f0a7767e54dd6fbf8942bd0dde88aadb9bb80 100644 (file)
@@ -10,9 +10,9 @@ echo -n "Output to file? (y/n): " ;read jn
 
 if [ "$jn" = "y" ]; then
        echo "Creating log file $name"
-       find $wo  -type f   | xargs  grep -in  "$was" > $name
+       find $wo  -type f   | xargs  grep -in  "$was" 2>/dev/null | grep -v ".svn" | grep -v "ChangeLog" | grep -v "/serv/ipfire/branches/ipcop-1.4" | grep -v "/serv/ipfire/tags/beta0" > $name 
 else
-       find $wo  -type f   | xargs  grep -in  "$was"
+       find $wo  -type f   | xargs  grep -in  "$was" 2>/dev/null | grep -v ".svn" | grep -v "ChangeLog" | grep -v "/serv/ipfire/branches/ipcop-1.4" | grep -v "/serv/ipfire/tags/beta0"
 fi
 
 if [ -d $name ]; then