From patchwork Tue Jun 19 01:32:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Kapfer X-Patchwork-Id: 1820 Return-Path: Received: from mail01.ipfire.org (unknown [172.28.1.200]) by web02.i.ipfire.org (Postfix) with ESMTP id 0FAA8602CB for ; Mon, 18 Jun 2018 17:33:03 +0200 (CEST) Received: from mail01.i.ipfire.org (localhost [127.0.0.1]) by mail01.ipfire.org (Postfix) with ESMTP id A372510071E9; Mon, 18 Jun 2018 16:33:02 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=201801; t=1529335982; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references:list-id: list-unsubscribe:list-subscribe:list-post; bh=9fhFzkTlKgYZIW3D253cND0O8nWWMSP1VLhz1nSi4kY=; b=qsCi4QQKHlXEvO5OuiWJIY1ZCX2DxLxMH51XFgXbacaLJq6qgdFmCthENNSD3TSaP7lDv8 A5tNBM4wFf+yf9xVwa/9PY7B5K17ETLKC4xt5PFHBtDMC1RaHHCHWfcLztOLX/cnyPoS2N KWicgyR4zmXalj4LiOurLUrDIdVntqlOS70cUVqz/pJTLtTFedgV4oXFOr4a2Zuvg4qOOP dmsbwrtWn2BednAXdpY1FlnXHcbvTn1vTYFIT0NcaRsf3yLlnNgceR75zBrmYVRB3wMOF+ xu3uhg7r5wunME26nC17VTaj4Nl/dAFlKXf868xXrYYItlh6b806uLZG07BbPQ== Received: from localhost.localdomain (i59F4AD79.versanet.de [89.244.173.121]) (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 AAA05108B887; Mon, 18 Jun 2018 16:32:59 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=201801; t=1529335979; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=9fhFzkTlKgYZIW3D253cND0O8nWWMSP1VLhz1nSi4kY=; b=RsdY4aVbqs/jHWjAWPSZVKTildUThSGE867Y/YS1nlrYqWNljoikNDXMNGYyeCX19Fnhgj JekXb5nzdHGHGjdvp/f97/BaV55lmmsgsg+DfE26KPo+GYCO2Fi5/Ldi01ZpdUbNL4qwHX UsXrz4W1AkzNpz0Wp2gfrFE6vCDCUP5Psds4m4MhMWFr4tIWY/vkXe8wMq1XPOaKjUpWST siYij44P5hMZWVgtf4r2/0L1OQl/TdERypy0TXKPj56J8suWMF68S9tklKyfcTmV2uHGJ+ w/CZOgmP2Vp8xbavpPVUe3Tp2hQVmSeq8ULskQyAcp7woEFOwe5Mr1VpA7at9g== From: Erik Kapfer To: development@lists.ipfire.org Subject: [PATCH] OpenVPN: Prevent that a Roadwarrior name will be set two times Date: Mon, 18 Jun 2018 17:32:57 +0200 Message-Id: <1529335977-31444-1-git-send-email-erik.kapfer@ipfire.org> X-Mailer: git-send-email 2.7.4 Authentication-Results: mail01.ipfire.org; auth=pass smtp.auth=ummeegge smtp.mailfrom=erik.kapfer@ipfire.org X-Spamd-Result: default: False [-2.10 / 11.00]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_SOME(0.00)[]; BAYES_HAM(-3.00)[100.00%]; ARC_NA(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; MIME_GOOD(-0.10)[text/plain]; DKIM_SIGNED(0.00)[]; MID_CONTAINS_FROM(1.00)[]; RCVD_COUNT_ZERO(0.00)[0]; ASN(0.00)[asn:8881, ipnet:89.244.160.0/20, country:DE]; FROM_HAS_DN(0.00)[] X-Spam-Status: No, score=-2.10 X-Rspamd-Server: mail01.i.ipfire.org X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.15 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" Fixes bug #11307 Signed-off-by: Erik Kapfer --- html/cgi-bin/ovpnmain.cgi | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/html/cgi-bin/ovpnmain.cgi b/html/cgi-bin/ovpnmain.cgi index 947cbe9..0bc28ce 100644 --- a/html/cgi-bin/ovpnmain.cgi +++ b/html/cgi-bin/ovpnmain.cgi @@ -4180,6 +4180,16 @@ if ($cgiparams{'TYPE'} eq 'net') { } } + # Check for RW if client name is already set + if ($cgiparams{'TYPE'} eq 'host') { + foreach my $key (keys %confighash) { + if ($confighash{$key}[1] eq $cgiparams{'NAME'}) { + $errormessage = $Lang::tr{'a connection with this name already exists'}; + goto VPNCONF_ERROR; + } + } + } + # Replace empty strings with a . (my $ou = $cgiparams{'CERT_OU'}) =~ s/^\s*$/\./; (my $city = $cgiparams{'CERT_CITY'}) =~ s/^\s*$/\./;