From patchwork Mon Nov 13 21:22:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Erik Kapfer X-Patchwork-Id: 1537 Return-Path: Received: from mail01.ipfire.org (unknown [172.28.1.200]) by web02.ipfire.org (Postfix) with ESMTP id 158D160B0D for ; Mon, 13 Nov 2017 11:22:33 +0100 (CET) Received: from mail01.ipfire.org (localhost [IPv6:::1]) by mail01.ipfire.org (Postfix) with ESMTP id 36D42285D; Mon, 13 Nov 2017 11:22:31 +0100 (CET) Received: from localhost.localdomain (p5DC0BD30.dip0.t-ipconnect.de [93.192.189.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id DF9A3285D; Mon, 13 Nov 2017 11:22:28 +0100 (CET) From: Erik Kapfer 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> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510393507-15218-1-git-send-email-erik.kapfer@ipfire.org> References: <1510393507-15218-1-git-send-email-erik.kapfer@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" --- 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') { } # 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; }