From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id B1FD662C87 for ; Wed, 28 Oct 2020 11:05:10 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A2DF01DA61 for ; Wed, 28 Oct 2020 11:05:10 +0100 (CET) Received: from dev.dominic.proxmox.com (212-186-127-178.static.upcbusiness.at [212.186.127.178]) by firstgate.proxmox.com (Proxmox) with ESMTP id B37C21DA3E for ; Wed, 28 Oct 2020 11:05:08 +0100 (CET) Received: by dev.dominic.proxmox.com (Postfix, from userid 0) id 82C24209B2; Wed, 28 Oct 2020 11:05:08 +0100 (CET) From: =?UTF-8?q?Dominic=20J=C3=A4ger?= To: pve-devel@lists.proxmox.com Date: Wed, 28 Oct 2020 11:04:53 +0100 Message-Id: <20201028100454.313122-2-d.jaeger@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201028100454.313122-1-d.jaeger@proxmox.com> References: <20201028100454.313122-1-d.jaeger@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 1 AWL -0.361 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods KHOP_HELO_FCRDNS 0.4 Relay HELO differs from its IP's reverse DNS NO_DNS_FOR_FROM 0.379 Envelope sender has no MX or A DNS records SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [json-schema.org, ietf.org, jsonschema.pm] Subject: [pve-devel] [PATCH pve-common 2/3 v2] Make configid regex public X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Oct 2020 10:05:10 -0000 Signed-off-by: Dominic Jäger --- v1->v2: Didn't exist src/PVE/JSONSchema.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm index e8d7395..29ada5b 100644 --- a/src/PVE/JSONSchema.pm +++ b/src/PVE/JSONSchema.pm @@ -21,6 +21,8 @@ parse_property_string register_standard_option ); +our $CONFIGID_RE = qr/[a-z][a-z0-9_-]+/i; + # Note: This class implements something similar to JSON schema, but it is not 100% complete. # see: http://tools.ietf.org/html/draft-zyp-json-schema-02 # see: http://json-schema.org/ @@ -177,7 +179,7 @@ register_format('pve-configid', \&pve_verify_configid); sub pve_verify_configid { my ($id, $noerr) = @_; - if ($id !~ m/^[a-z][a-z0-9_-]+$/i) { + if ($id !~ m/^$CONFIGID_RE$/) { return undef if $noerr; die "invalid configuration ID '$id'\n"; } -- 2.20.1