public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
From: Stefan Schantl <stefan.schantl@ipfire.org>
To: development@lists.ipfire.org
Subject: [PATCH] ovpnmain.cgi: Validate CCDNet name when renaming it.
Date: Tue, 28 Jan 2020 11:51:50 +0100	[thread overview]
Message-ID: <20200128105150.5848-1-stefan.schantl@ipfire.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 735 bytes --]

Fixes #12282

Signed-off-by: Stefan Schantl <stefan.schantl(a)ipfire.org>
---
 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) {
-- 
2.25.0


             reply	other threads:[~2020-01-28 10:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-28 10:51 Stefan Schantl [this message]
2020-01-28 15:33 ` Michael Tremer
     [not found] <36112b13c62f8e7eea3cda466ed8520dcac14d6a.camel@ipfire.org>
2020-01-30 12:55 ` Michael Tremer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200128105150.5848-1-stefan.schantl@ipfire.org \
    --to=stefan.schantl@ipfire.org \
    --cc=development@lists.ipfire.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox