From: Timo Sirainen Date: Tue, 7 Feb 2017 13:46:47 +0000 (+0200) Subject: quota: If quota_over_script is unset, skip the quota_over check. X-Git-Tag: 2.3.0.rc1~2137 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=40edfbbb81b7a76cddac2b327ed547d4feeb5e88;p=thirdparty%2Fdovecot%2Fcore.git quota: If quota_over_script is unset, skip the quota_over check. --- diff --git a/src/plugins/quota/quota.c b/src/plugins/quota/quota.c index e03a317bbd..f30c3d0fd0 100644 --- a/src/plugins/quota/quota.c +++ b/src/plugins/quota/quota.c @@ -1026,6 +1026,7 @@ int quota_transaction_commit(struct quota_transaction_context **_ctx) } 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) { @@ -1034,6 +1035,11 @@ static bool quota_over_flag_init_root(struct quota_root *root, *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); @@ -1051,7 +1057,7 @@ static bool quota_over_flag_init_root(struct quota_root *root, 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; @@ -1073,7 +1079,8 @@ static void quota_over_flag_check_root(struct quota_root *root) 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); @@ -1103,13 +1110,8 @@ static void quota_over_flag_check_root(struct quota_root *root) 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"); } }