From a60e1c274a84da4c7c964d200d7dca7db3247271 Mon Sep 17 00:00:00 2001 From: John Supplee Date: Tue, 5 Feb 2019 01:47:39 +0200 Subject: [PATCH] Do not allow decimal points in quota sizes --- management/mailconfig.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/management/mailconfig.py b/management/mailconfig.py index 11283c78..f8c88a8a 100755 --- a/management/mailconfig.py +++ b/management/mailconfig.py @@ -428,17 +428,17 @@ def get_default_quota(env): return config.get("default-quota", '0') def validate_quota(quota): - # validate quota - quota = quota.strip().upper() + # validate quota + quota = quota.strip().upper() - if quota == "": - raise ValueError("No quota provided.") - if re.search(r"[\s,]", quota): - raise ValueError("Quotas cannot contain spaces or commas.") - if not re.match(r'^[\d\.]+[GM]?$', quota): - raise ValueError("Invalid quota.") + if quota == "": + raise ValueError("No quota provided.") + if re.search(r"[\s,.]", quota): + raise ValueError("Quotas cannot contain spaces, commas, or decimal points.") + if not re.match(r'^[\d]+[GM]?$', quota): + raise ValueError("Invalid quota.") - return quota + return quota def get_mail_password(email, env): # Gets the hashed password for a user. Passwords are stored in Dovecot's