summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2018-07-20 15:43:35 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2018-07-20 15:43:35 -0400
commitbb3d3cb473e2ab53ee29e6f12d96a0df7a4a6b71 (patch)
treec1bda2679adff9ed0330d60220a7f26d8675a886
parent2bf849420986f2f77cfbc5a33c70ffc4a8d6dbe4 (diff)
meta-normalize-stdio: Get a little stricterHEADmaster
- require fullname to be non-empty - require the ssh key ident to look like an email
-rwxr-xr-xbin/meta-normalize-stdio9
1 files changed, 5 insertions, 4 deletions
diff --git a/bin/meta-normalize-stdio b/bin/meta-normalize-stdio
index 69d9ad6..d703741 100755
--- a/bin/meta-normalize-stdio
+++ b/bin/meta-normalize-stdio
@@ -124,7 +124,8 @@ year = lambda {|name, num|
}
# This regex is taken from http://www.w3.org/TR/html5/forms.html#valid-e-mail-address
-_email_regex = /^[a-zA-Z0-9.!\#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/
+email = restring(/^[a-zA-Z0-9.!\#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/)
+
email_list = lambda {|name, ary|
if !ary.is_a?(Array)
error "`#{name}' must be a list"
@@ -133,7 +134,7 @@ email_list = lambda {|name, ary|
if ary.first.end_with?("@parabola.nu") and ary.count >= 2
preserve = 2
end
- ary = semiordered_list(preserve, restring(_email_regex)).call(name, ary)
+ ary = semiordered_list(preserve, email).call(name, ary)
end
ary
}
@@ -158,12 +159,12 @@ shell = lambda {|name, sh|
format = unordered_map1(
{
"username" => restring(/^[a-z][a-z0-9-]*$/),
- "fullname" => string,
+ "fullname" => restring(/./), # non-empty
"email" => email_list,
"groups" => semiordered_list(1, string),
"pgp_keyid" => restring(/^[0-9A-F]{40}$/),
"pgp_revoked_keyids" => unordered_list(restring(/^[0-9A-F]{40}$/)),
- "ssh_keys" => unordered_map2(string, string),
+ "ssh_keys" => unordered_map2(email, string),
"shell" => shell,
"extra" => unordered_map1(
{