]> git.ipfire.org Git - people/ummeegge/ipfire-2.x.git/commitdiff
- Added "'TYPE' net" to N2N section since it can only be changed there. openvpn_valid_til_days
authorErik Kapfer <erik.kapfer@ipfire.org>
Mon, 13 Nov 2017 10:10:34 +0000 (11:10 +0100)
committerErik Kapfer <erik.kapfer@ipfire.org>
Mon, 13 Nov 2017 10:10:34 +0000 (11:10 +0100)
- Check for N2N sets days valid maximum to '999999' days.
- Check for Roadwarrior sets days valid maximum to '999999' days.
- If '999999' days will be exceeded, a warning will be displayed.

html/cgi-bin/ovpnmain.cgi

index 8f45f04e0437037e7c7cc39f38247b9cef5e9c86..9c383f7100a587797cd47bd4713fa4c07c5123d8 100644 (file)
@@ -4040,11 +4040,13 @@ if ($cgiparams{'TYPE'} eq 'net') {
        }
 
        # Check that OpenSSL maximum of valid days won´t be exceeded
-       if (length($cgiparams{'DAYS_VALID'}) > 6) {
-               $errormessage = $Lang::tr{'invalid input for valid till days'};
-               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{'TYPE'} eq 'net') {
+               if ($cgiparams{'DAYS_VALID'} > '999999') {
+                       $errormessage = $Lang::tr{'invalid input for valid till days'};
+                       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{'ENABLED'} !~ /^(on|off)$/) {
@@ -4230,7 +4232,7 @@ if ($cgiparams{'TYPE'} eq 'net') {
            }
 
                # Check that OpenSSL maximum of valid days won´t be exceeded
-               if (length($cgiparams{'DAYS_VALID'}) > 6) {
+               if ($cgiparams{'DAYS_VALID'} > '999999') {
                        $errormessage = $Lang::tr{'invalid input for valid till days'};
                        goto VPNCONF_ERROR;
                }