Mercurial > dovecot > core-2.2
changeset 21522:4e92ddc813fa
quota: If quota_over_script is unset, skip the quota_over check.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Tue, 07 Feb 2017 15:46:47 +0200 |
parents | bfc81bb63199 |
children | 71833cb3c478 |
files | src/plugins/quota/quota.c |
diffstat | 1 files changed, 11 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/quota/quota.c Tue Feb 07 15:44:20 2017 +0200 +++ b/src/plugins/quota/quota.c Tue Feb 07 15:46:47 2017 +0200 @@ -1021,6 +1021,7 @@ } static bool quota_over_flag_init_root(struct quota_root *root, + const char **quota_over_script_r, const char **quota_over_flag_r, bool *status_r) { @@ -1029,6 +1030,11 @@ *quota_over_flag_r = NULL; *status_r = FALSE; + name = t_strconcat(root->set->set_name, "_over_script", NULL); + *quota_over_script_r = mail_user_plugin_getenv(root->quota->user, name); + if (*quota_over_script_r == NULL) + return FALSE; + /* e.g.: quota_over_flag_value=TRUE or quota_over_flag_value=* */ name = t_strconcat(root->set->set_name, "_over_flag_value", NULL); flag_mask = mail_user_plugin_getenv(root->quota->user, name); @@ -1046,7 +1052,7 @@ static void quota_over_flag_check_root(struct quota_root *root) { - const char *name, *overquota_script, *quota_over_flag; + const char *quota_over_script, *quota_over_flag; const char *const *resources; unsigned int i; uint64_t value, limit; @@ -1068,7 +1074,8 @@ return; } root->quota_over_flag_checked = TRUE; - if (!quota_over_flag_init_root(root, "a_over_flag, "a_over_status)) + if (!quota_over_flag_init_root(root, "a_over_script, + "a_over_flag, "a_over_status)) return; resources = quota_root_get_resources(root); @@ -1098,13 +1105,8 @@ cur_overquota ? 1 : 0); } if (cur_overquota != quota_over_status) { - name = t_strconcat(root->set->set_name, "_over_script", NULL); - overquota_script = mail_user_plugin_getenv(root->quota->user, name); - if (overquota_script != NULL) { - quota_warning_execute(root, overquota_script, - quota_over_flag, - "quota_over_flag mismatch"); - } + quota_warning_execute(root, quota_over_script, quota_over_flag, + "quota_over_flag mismatch"); } }