]> git.proxmox.com Git - pmg-api.git/blobdiff - PMG/Config.pm
fixed some typos in PMG/Config.pm
[pmg-api.git] / PMG / Config.pm
index 2667db619f2b15000f162c66111b8eda5adc7ec3..b09a856018dc172a6fd52d88f0ff8a25a4c056ce 100755 (executable)
@@ -15,7 +15,7 @@ my $defaultData = {
     propertyList => {
        type => { description => "Section type." },
        section => {
-           description => "Secion ID.",
+           description => "Section ID.",
            type => 'string', format => 'pve-configid',
        },
     },
@@ -157,7 +157,7 @@ sub properties {
            type => 'string',
        },
        clamav_heuristic_score => {
-           description => "Score for ClamaAV heuristics (Google Safe Browsing database, PhishingScanURLs, ...).",
+           description => "Score for ClamAV heuristics (Google Safe Browsing database, PhishingScanURLs, ...).",
            type => 'integer',
            minimum => 0,
            maximum => 1000,
@@ -319,7 +319,7 @@ sub properties {
            default => 'database.clamav.net',
        },
        archiveblockencrypted => {
-           description => "Wether to block encrypted archives. Mark encrypted archives as viruses.",
+           description => "Whether to block encrypted archives. Mark encrypted archives as viruses.",
            type => 'boolean',
            default => 0,
        },
@@ -947,19 +947,31 @@ PVE::INotify::register_file('mynetworks', $mynetworks_filename,
 PVE::JSONSchema::register_format(
     'tls-policy', \&pmg_verify_tls_policy);
 
+# TODO: extend to parse attributes of the policy
+my $VALID_TLS_POLICY_RE = qr/none|may|encrypt|dane|dane-only|fingerprint|verify|secure/;
 sub pmg_verify_tls_policy {
     my ($policy, $noerr) = @_;
 
-    # TODO: extend to parse attributes of the policy
-    my $valid_policy = qr/none|may|encrypt|dane|dane-only|fingerprint|verify|secure/;
-
-    if ($policy !~ /^${valid_policy}$/) {
+    if ($policy !~ /^$VALID_TLS_POLICY_RE\b/) {
           return undef if $noerr;
           die "value '$policy' does not look like a valid tls policy\n";
     }
     return $policy;
 }
 
+PVE::JSONSchema::register_format(
+    'tls-policy-strict', \&pmg_verify_tls_policy_strict);
+
+sub pmg_verify_tls_policy_strict {
+    my ($policy, $noerr) = @_;
+
+    if ($policy !~ /^$VALID_TLS_POLICY_RE$/) {
+       return undef if $noerr;
+       die "value '$policy' does not look like a valid tls policy\n";
+    }
+    return $policy;
+}
+
 sub read_tls_policy {
     my ($filename, $fh) = @_;