From mboxrd@z Thu Jan  1 00:00:00 1970
From: Erik Kapfer <erik.kapfer@ipfire.org>
To: development@lists.ipfire.org
Subject: [PATCH] - Added "'TYPE' net" to N2N section since it can only be
 changed there. - 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.
Date: Mon, 13 Nov 2017 11:22:22 +0100
Message-ID: <1510568542-13444-1-git-send-email-erik.kapfer@ipfire.org>
In-Reply-To: <1510393507-15218-1-git-send-email-erik.kapfer@ipfire.org>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============4966511088126751304=="
List-Id: <development.lists.ipfire.org>

--===============4966511088126751304==
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

---
 html/cgi-bin/ovpnmain.cgi | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/html/cgi-bin/ovpnmain.cgi b/html/cgi-bin/ovpnmain.cgi
index 8f45f04..9c383f7 100644
--- a/html/cgi-bin/ovpnmain.cgi
+++ b/html/cgi-bin/ovpnmain.cgi
@@ -4040,11 +4040,13 @@ if ($cgiparams{'TYPE'} eq 'net') {
 	}
=20
 	# Check that OpenSSL maximum of valid days won=C2=B4t be exceeded
-	if (length($cgiparams{'DAYS_VALID'}) > 6) {
-		$errormessage =3D $Lang::tr{'invalid input for valid till days'};
-		unlink ("${General::swroot}/ovpn/n2nconf/$cgiparams{'NAME'}/$cgiparams{'NA=
ME'}.conf") or die "Removing Configfile fail: $!";
-		rmdir ("${General::swroot}/ovpn/n2nconf/$cgiparams{'NAME'}") || die "Remov=
ing Directory fail: $!";
-		goto VPNCONF_ERROR;
+	if ($cgiparams{'TYPE'} eq 'net') {
+		if ($cgiparams{'DAYS_VALID'} > '999999') {
+			$errormessage =3D $Lang::tr{'invalid input for valid till days'};
+			unlink ("${General::swroot}/ovpn/n2nconf/$cgiparams{'NAME'}/$cgiparams{'N=
AME'}.conf") or die "Removing Configfile fail: $!";
+			rmdir ("${General::swroot}/ovpn/n2nconf/$cgiparams{'NAME'}") || die "Remo=
ving Directory fail: $!";
+			goto VPNCONF_ERROR;
+		}
 	}
=20
 	if ($cgiparams{'ENABLED'} !~ /^(on|off)$/) {
@@ -4230,7 +4232,7 @@ if ($cgiparams{'TYPE'} eq 'net') {
 	    }
=20
 		# Check that OpenSSL maximum of valid days won=C2=B4t be exceeded
-		if (length($cgiparams{'DAYS_VALID'}) > 6) {
+		if ($cgiparams{'DAYS_VALID'} > '999999') {
 			$errormessage =3D $Lang::tr{'invalid input for valid till days'};
 			goto VPNCONF_ERROR;
 		}
--=20
2.7.4


--===============4966511088126751304==--