From patchwork Tue Jan 28 10:51:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 2728 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 486NjM2y8Cz3xY8 for ; Tue, 28 Jan 2020 10:52:07 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail02.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 486NjK09x7z2c9; Tue, 28 Jan 2020 10:52:04 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=201909ed25519; t=1580208726; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=xG7rDEMpsJtl9yp/e6sr5Q60NbfYDCNTSjN5bW+DQH0=; b=KNF1spG3gQlX0XUCa43b4/Y4ihTs8Us0WI+WDwb54DtKQddwaa4erFKbsC9xgRSu1DoAJc qo+brx/D6ae+ssAA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=201909rsa; t=1580208726; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=xG7rDEMpsJtl9yp/e6sr5Q60NbfYDCNTSjN5bW+DQH0=; b=GK7UL90Tx683BOi4AdRt7dFH2w38ZuVn3AcYJAyw1jn15U8D1/ltok0z7sqVxIie9Y96lY tJElQEWge0tA5j/JLbi/qiP4m765IySuzVyfT8lg1ZysDtsjaJWucSBG1kAJ4kXWXM2d1u JD/SYySs4+5J8oBafWXtjOHQ03PHp0kZHl370mz6H8BipxKjmqzgQKwbY7Mu+SceDeGMnS dXpG9CzPhoR9Zm/7KJLb4weJ3HUazUiNeIkoqcmvQ1DHz39RYbyhy0eHkXZtqdLuiJjudN PeK+5twmdqLnO8HYS7i7eXyTGcc0xZUOWCUvnk4Mq29kOTYN4m7uWFcll5RtFA== Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 486NjJ17kpz2yZc; Tue, 28 Jan 2020 10:52:04 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 486NjG1nQjz2xlf for ; Tue, 28 Jan 2020 10:52:02 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 486NjF0YxPz2c9; Tue, 28 Jan 2020 10:52:00 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=201909ed25519; t=1580208721; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=xG7rDEMpsJtl9yp/e6sr5Q60NbfYDCNTSjN5bW+DQH0=; b=/EGZKHKJQnEFzO2BiV9rRSavadDptPR1xO293zYq1gydownwoSmiihodbUG+A0e5SRs7KW hgJ8B7KqoAF46eBA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=201909rsa; t=1580208721; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=xG7rDEMpsJtl9yp/e6sr5Q60NbfYDCNTSjN5bW+DQH0=; b=HOllyBdXceipJXlv7UUUAFOvbD5p79w1WtRx2kIC8FR7lbGs5uE6AR5wTyj33onghim/q9 0Bw4hFbM67RFqr63YHoOEwva6vDDEoZCL1jF2Pb8vphS6V4VZ/BT0c9qfNW3Dj+cOKP6lc qCTPUI3P0hzDopha/eWX7nNufxtmS+6zX+M6LTURmHXo7Fz41d6UYmljz7fZaeLwoF6U9C aaRuzupBzoj+Juy6PLRguzSM+rZ16zFMYOLrYeXo9JjfUcTqfW/cSAw54erhlVrKNIh1uk nxv8dJhhQ5c7th/P7dPFzYnAs4JwNH+BrjrYButavgUqj9dNWn9LfmcGEUFusg== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH] ovpnmain.cgi: Validate CCDNet name when renaming it. Date: Tue, 28 Jan 2020 11:51:50 +0100 Message-Id: <20200128105150.5848-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Authentication-Results: mail01.ipfire.org; auth=pass smtp.mailfrom=stefan.schantl@ipfire.org X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 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 #12282 Signed-off-by: Stefan Schantl --- html/cgi-bin/ovpnmain.cgi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/html/cgi-bin/ovpnmain.cgi b/html/cgi-bin/ovpnmain.cgi index e76a688fe..22a2b9905 100644 --- a/html/cgi-bin/ovpnmain.cgi +++ b/html/cgi-bin/ovpnmain.cgi @@ -490,6 +490,13 @@ sub modccdnet my $oldname=$_[1]; my %ccdconfhash=(); my %ccdhash=(); + + # Check if the new name is valid. + if(!&General::validhostname($newname)) { + $errormessage=$Lang::tr{'ccd err invalidname'}; + return; + } + &General::readhasharray("${General::swroot}/ovpn/ccd.conf", \%ccdconfhash); foreach my $key (keys %ccdconfhash) { if ($ccdconfhash{$key}[0] eq $oldname) {