]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - html/cgi-bin/ovpnmain.cgi
OpenVPN: Bugfix 10352: When opening advanced server options all fields are disabled...
[people/teissler/ipfire-2.x.git] / html / cgi-bin / ovpnmain.cgi
index 58ebdf2faea0d22e0a92e9daad768381a8c2d390..a4953ffe496185991e6ecd70996160604d391258 100644 (file)
@@ -2,7 +2,7 @@
 ###############################################################################
 #                                                                             #
 # IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2007-2011  IPFire Team  <info@ipfire.org>                     #
+# Copyright (C) 2007-2013  IPFire Team  <info@ipfire.org>                     #
 #                                                                             #
 # This program is free software: you can redistribute it and/or modify        #
 # it under the terms of the GNU General Public License as published by        #
@@ -863,7 +863,7 @@ if ($cgiparams{'ACTION'} eq $Lang::tr{'save-adv-options'}) {
     }
                
     if ($cgiparams{'DHCP_DOMAIN'} ne ''){
-       unless (&General::validfqdn($cgiparams{'DHCP_DOMAIN'}) || &General::validip($cgiparams{'DHCP_DOMAIN'})) {
+       unless (&General::validdomainname($cgiparams{'DHCP_DOMAIN'}) || &General::validip($cgiparams{'DHCP_DOMAIN'})) {
                $errormessage = $Lang::tr{'invalid input for dhcp domain'};
        goto ADV_ERROR;
        }
@@ -2375,7 +2375,7 @@ ADV_ERROR:
     }
     &Header::openbox('100%', 'LEFT', $Lang::tr{'advanced server'});
     print <<END
-    <form method='post' enctype='multipart/form-data' disabled>
+    <form method='post' enctype='multipart/form-data'>
     <table width='100%' border=0>
     <tr>
        <td colspan='4'><b>$Lang::tr{'dhcp-options'}</b></td>
@@ -3498,18 +3498,25 @@ if ($cgiparams{'TYPE'} eq 'host') {
 ###
 
 if ($cgiparams{'TYPE'} eq 'net') {
-               
-    if ($cgiparams{'DEST_PORT'} eq  $vpnsettings{'DDEST_PORT'}) {
+       if ($cgiparams{'DEST_PORT'} eq  $vpnsettings{'DDEST_PORT'}) {
                        $errormessage = $Lang::tr{'openvpn destination port used'};
                        unlink ("${General::swroot}/ovpn/n2nconf/$cgiparams{'NAME'}/$cgiparams{'NAME'}.conf") or die "Removing Configfile fail: $!";
            rmdir ("${General::swroot}/ovpn/n2nconf/$cgiparams{'NAME'}") || die "Removing Directory fail: $!";
       goto VPNCONF_ERROR;                      
                }
-    
-    if ($cgiparams{'DEST_PORT'} eq  '') {
+    #Bugfix 10357
+    foreach my $key (sort keys %confighash){
+               if ( ($confighash{$key}[22] eq $cgiparams{'DEST_PORT'} && $cgiparams{'NAME'} ne $confighash{$key}[1]) || ($confighash{$key}[29] eq $cgiparams{'DEST_PORT'} && $cgiparams{'NAME'} ne $confighash{$key}[1])){
                        $errormessage = $Lang::tr{'openvpn destination port used'};
                        unlink ("${General::swroot}/ovpn/n2nconf/$cgiparams{'NAME'}/$cgiparams{'NAME'}.conf") or die "Removing Configfile fail: $!";
            rmdir ("${General::swroot}/ovpn/n2nconf/$cgiparams{'NAME'}") || die "Removing Directory fail: $!";
+      goto VPNCONF_ERROR;      
+               }
+       }
+    if ($cgiparams{'DEST_PORT'} eq  '') {
+                       $errormessage = $Lang::tr{'invalid port'};
+                       unlink ("${General::swroot}/ovpn/n2nconf/$cgiparams{'NAME'}/$cgiparams{'NAME'}.conf") or die "Removing Configfile fail: $!";
+           rmdir ("${General::swroot}/ovpn/n2nconf/$cgiparams{'NAME'}") || die "Removing Directory fail: $!";
       goto VPNCONF_ERROR;                      
                }
 
@@ -3920,7 +3927,7 @@ if ($cgiparams{'TYPE'} eq 'net') {
            }
        }
 
-        # Save the config
+    # Save the config
        my $key = $cgiparams{'KEY'};
        
        if (! $key) {
@@ -4969,19 +4976,13 @@ END
 }
 
 
-       my $disable_clientdl = "disabled='disabled'";
-       if (( $cgiparams{'ENABLED'} eq 'on') || 
-           ( $cgiparams{'ENABLED_BLUE'} eq 'on') ||
-           ( $cgiparams{'ENABLED_ORANGE'} eq 'on')){
-           $disable_clientdl = "";
-       }
        print <<END
        <td align='center'>$active</td>
                
        <form method='post' name='frm${key}a'><td align='center'>
-           <input type='image'  name='$Lang::tr{'dl client arch'}' $disable_clientdl src='/images/openvpn.png' alt='$Lang::tr{'dl client arch'}' title='$Lang::tr{'dl client arch'}' border='0' />
-           <input type='hidden' name='ACTION' value='$Lang::tr{'dl client arch'}' $disable_clientdl />
-           <input type='hidden' name='KEY' value='$key' $disable_clientdl />
+           <input type='image'  name='$Lang::tr{'dl client arch'}' src='/images/openvpn.png' alt='$Lang::tr{'dl client arch'}' title='$Lang::tr{'dl client arch'}' border='0' />
+           <input type='hidden' name='ACTION' value='$Lang::tr{'dl client arch'}' />
+           <input type='hidden' name='KEY' value='$key' />
        </td></form>
 END
        ;