]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - config/firewall/convert-xtaccess
Merge branch 'next' of ssh://git.ipfire.org/pub/git/ipfire-2.x into next
[people/teissler/ipfire-2.x.git] / config / firewall / convert-xtaccess
index d86c445afc2067b905f93181e0977c28543d6e97..d11e09c7c6622fa7d982ba6b2aca625a67eaa61f 100755 (executable)
@@ -28,7 +28,7 @@ my @alias=();
 my %configinputfw=();
 require '/var/ipfire/general-functions.pl';
 my $xtaccessconfig     = "${General::swroot}/xtaccess/config";
-my $inputfwconfig = "${General::swroot}/forward/input";
+my $inputfwconfig = "${General::swroot}/firewall/input";
 my $aliasconfig        = "${General::swroot}/ethernet/aliases";
 my $field0='ACCEPT';
 my $field1='INPUTFW';
@@ -49,6 +49,17 @@ my $field28 = '';
 my $field29 = 'ALL';
 my $field30 = '';
 my $field31 = 'dnat';
+
+if (! -e "$xtaccessconfig") {
+        print "Config file for external access not found. Exiting!\n";
+        exit(1);
+}
+
+if (! -s "$xtaccessconfig") {
+        print "Empty external access configuration file. Nothing to do. Exiting...\n";
+        exit(0);
+}
+
 open(FILE, $xtaccessconfig) or die 'Unable to open config file.';
 my @current = <FILE>;
 close(FILE);
@@ -113,12 +124,12 @@ foreach my $line (@current){
        $configinputfw{$key}[5] = $field5;
        $configinputfw{$key}[6] = $field6;
        $configinputfw{$key}[7] = '';
-       $configinputfw{$key}[8] = '';
+       $configinputfw{$key}[8] = $field12;
        $configinputfw{$key}[9] = '';
        $configinputfw{$key}[10] = '';
        $configinputfw{$key}[11] = $field11;
-       $configinputfw{$key}[12] = $field12;
-       $configinputfw{$key}[13] = $field13;
+       $configinputfw{$key}[12] = '';
+       $configinputfw{$key}[13] = '';
        $configinputfw{$key}[14] = $field14;
        $configinputfw{$key}[15] = $field15;
        $configinputfw{$key}[16] = $field16;