all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH widget-toolkit 1/2] Utils: improve matching groups of ip/host regexes
Date: Thu,  1 Oct 2020 09:57:54 +0200	[thread overview]
Message-ID: <20201001075757.26446-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20201001075757.26446-1-d.csapak@proxmox.com>

we only ever want to match the whole hostname/ip, never just some part of it
and we do not want to have the ':' as part of the port

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/Utils.js | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/Utils.js b/src/Utils.js
index 8595cce..232c97c 100644
--- a/src/Utils.js
+++ b/src/Utils.js
@@ -873,12 +873,12 @@ utilities: {
 	me.IP64_match = new RegExp("^(?:" + IPV6_REGEXP + "|" + IPV4_REGEXP + ")$");
 	me.IP64_cidr_match = new RegExp("^(?:" + IPV6_REGEXP + "/" + IPV6_CIDR_MASK + ")|(?:" + IPV4_REGEXP + "/" + IPV4_CIDR_MASK + ")$");
 
-	let DnsName_REGEXP = "(?:(([a-zA-Z0-9]([a-zA-Z0-9\\-]*[a-zA-Z0-9])?)\\.)*([A-Za-z0-9]([A-Za-z0-9\\-]*[A-Za-z0-9])?))";
+	let DnsName_REGEXP = "(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\\-]*[a-zA-Z0-9])?)\\.)*(?:[A-Za-z0-9](?:[A-Za-z0-9\\-]*[A-Za-z0-9])?))";
 	me.DnsName_match = new RegExp("^" + DnsName_REGEXP + "$");
 
-	me.HostPort_match = new RegExp("^(" + IPV4_REGEXP + "|" + DnsName_REGEXP + ")(:\\d+)?$");
-	me.HostPortBrackets_match = new RegExp("^\\[(?:" + IPV6_REGEXP + "|" + IPV4_REGEXP + "|" + DnsName_REGEXP + ")\\](:\\d+)?$");
-	me.IP6_dotnotation_match = new RegExp("^" + IPV6_REGEXP + "(\\.\\d+)?$");
+	me.HostPort_match = new RegExp("^(" + IPV4_REGEXP + "|" + DnsName_REGEXP + ")(?::(\\d+))?$");
+	me.HostPortBrackets_match = new RegExp("^\\[(" + IPV6_REGEXP + "|" + IPV4_REGEXP + "|" + DnsName_REGEXP + ")\\](?::(\\d+))?$");
+	me.IP6_dotnotation_match = new RegExp("^(" + IPV6_REGEXP + ")(?:\\.(\\d+))?$");
 	me.Vlan_match = /^vlan(\\d+)/;
 	me.VlanInterface_match = /(\\w+)\\.(\\d+)/;
     },
-- 
2.20.1





  reply	other threads:[~2020-10-01  7:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-01  7:57 [pbs-devel] [PATCH widget-toolkit/proxmox-backup] improve ipv6/ports for remotes gui Dominik Csapak
2020-10-01  7:57 ` Dominik Csapak [this message]
2020-10-01  8:10   ` [pbs-devel] applied: [PATCH widget-toolkit 1/2] Utils: improve matching groups of ip/host regexes Dietmar Maurer
2020-10-01  7:57 ` [pbs-devel] [PATCH widget-toolkit 2/2] Toolkit: add HostPort vtype Dominik Csapak
2020-10-01  7:57 ` [pbs-devel] [PATCH proxmox-backup 1/2] ui: RemoteView: improve host columns Dominik Csapak
2020-10-01  8:12   ` [pbs-devel] applied: " Dietmar Maurer
2020-10-01  7:57 ` [pbs-devel] [PATCH proxmox-backup 2/2] ui: RemoteEdit: remove port field and parse it from host field Dominik Csapak

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=20201001075757.26446-2-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal