if (*username == '\0')
username = _root->quota->user->username;
- if (_root->quota->set->debug) {
- i_debug("dict quota: user=%s, uri=%s, noenforcing=%d",
- username, args, _root->no_enforcing ? 1 : 0);
- }
+ e_debug(_root->quota->event,
+ "dict quota: user=%s, uri=%s, noenforcing=%d",
+ username, args, _root->no_enforcing ? 1 : 0);
/* FIXME: we should use 64bit integer as datatype instead but before
it can actually be used don't bother */
dict_set(dt, DICT_QUOTA_CURRENT_BYTES_PATH, dec2str(bytes));
dict_set(dt, DICT_QUOTA_CURRENT_COUNT_PATH, dec2str(count));
- if (root->root.quota->set->debug) {
- i_debug("dict quota: Quota recalculated: "
- "count=%"PRIu64" bytes=%"PRIu64, count, bytes);
- }
+ e_debug(root->root.quota->event, "dict quota: Quota recalculated: "
+ "count=%"PRIu64" bytes=%"PRIu64, count, bytes);
dict_transaction_commit_async(&dt, NULL, NULL);
*value_r = want_bytes ? bytes : count;
timeout_remove(&root->to_update);
if (dict_quota_count(root, TRUE, &value, &error)
<= QUOTA_GET_RESULT_INTERNAL_ERROR)
- i_error("quota-dict: Recalculation failed: %s", error);
+ e_error(root->root.quota->event,
+ "quota-dict: Recalculation failed: %s", error);
}
static void dict_quota_update_callback(const struct dict_commit_result *result,
if (root->to_update == NULL)
root->to_update = timeout_add_short(0, dict_quota_recalc_timeout, root);
} else if (result->ret < 0) {
- i_error("dict quota: Quota update failed: %s "
+ e_error(root->root.quota->event,
+ "dict quota: Quota update failed: %s "
"- Quota is now desynced", result->error);
}
}
i_free(root);
}
-static struct fs_quota_mountpoint *fs_quota_mountpoint_get(const char *dir)
+static struct fs_quota_mountpoint *
+fs_quota_mountpoint_get(struct quota *quota, const char *dir)
{
struct fs_quota_mountpoint *mount;
struct mountpoint point;
if (mount_type_is_nfs(mount)) {
if (strchr(mount->device_path, ':') == NULL) {
- i_error("quota-fs: %s is not a valid NFS device path",
+ e_error(quota->event,
+ "quota-fs: %s is not a valid NFS device path",
mount->device_path);
fs_quota_mountpoint_free(mount);
return NULL;
mount->path = i_strconcat(mount->mount_path, "/quotas", NULL);
mount->fd = open(mount->path, O_RDONLY);
if (mount->fd == -1 && errno != ENOENT)
- i_error("open(%s) failed: %m", mount->path);
+ e_error(root->root.quota->event,
+ "open(%s) failed: %m", mount->path);
}
#endif
root->mount = mount;
- if (root->root.quota->set->debug) {
- i_debug("fs quota add mailbox dir = %s", dir);
- i_debug("fs quota block device = %s", mount->device_path);
- i_debug("fs quota mount point = %s", mount->mount_path);
- i_debug("fs quota mount type = %s", mount->type);
- }
+ e_debug(root->root.quota->event, "fs quota add mailbox dir = %s", dir);
+ e_debug(root->root.quota->event, "fs quota block device = %s", mount->device_path);
+ e_debug(root->root.quota->event, "fs quota mount point = %s", mount->mount_path);
+ e_debug(root->root.quota->event, "fs quota mount type = %s", mount->type);
/* if there are more unused quota roots, copy this mount to them */
roots = array_get(&root->root.quota->roots, &count);
root->storage_mount_path == NULL || root->mount != NULL)
continue;
- mount = fs_quota_mountpoint_get(root->storage_mount_path);
+ mount = fs_quota_mountpoint_get(quota, root->storage_mount_path);
if (mount != NULL) {
fs_quota_mount_init(root, mount,
root->storage_mount_path);
&dir))
mount = NULL;
else
- mount = fs_quota_mountpoint_get(dir);
+ mount = fs_quota_mountpoint_get(quota, dir);
if (mount != NULL) {
root = fs_quota_root_find_mountpoint(quota, mount);
if (root != NULL && root->mount == NULL)
path++;
}
- if (root->root.quota->set->debug) {
- i_debug("quota-fs: host=%s, path=%s, uid=%s",
- host, path, dec2str(root->uid));
- }
+ e_debug(root->root.quota->event, "quota-fs: host=%s, path=%s, uid=%s",
+ host, path, dec2str(root->uid));
/* clnt_create() polls for a while to establish a connection */
cl = clnt_create(host, RQUOTAPROG, RQUOTAVERS, "udp");
rquota_get_result(&result.getquota_rslt_u.gqr_rquota,
bytes_value_r, bytes_limit_r,
count_value_r, count_limit_r);
- if (root->root.quota->set->debug) {
- i_debug("quota-fs: uid=%s, bytes=%"PRIu64"/%"PRIu64" "
- "files=%"PRIu64"/%"PRIu64,
- dec2str(root->uid),
- *bytes_value_r, *bytes_limit_r,
- *count_value_r, *count_limit_r);
- }
+ e_debug(root->root.quota->event, "quota-fs: uid=%s, bytes=%"PRIu64"/%"PRIu64" "
+ "files=%"PRIu64"/%"PRIu64,
+ dec2str(root->uid),
+ *bytes_value_r, *bytes_limit_r,
+ *count_value_r, *count_limit_r);
return 1;
}
case Q_NOQUOTA:
- if (root->root.quota->set->debug) {
- i_debug("quota-fs: uid=%s, limit=unlimited",
- dec2str(root->uid));
- }
+ e_debug(root->root.quota->event, "quota-fs: uid=%s, limit=unlimited",
+ dec2str(root->uid));
fs_quota_root_disable(root, FALSE);
return 0;
case Q_EPERM:
host = t_strdup_until(mount->device_path, path);
path++;
- if (root->root.quota->set->debug) {
- i_debug("quota-fs: host=%s, path=%s, gid=%s",
- host, path, dec2str(root->gid));
- }
+ e_debug(root->root.quota->event, "quota-fs: host=%s, path=%s, gid=%s",
+ host, path, dec2str(root->gid));
/* clnt_create() polls for a while to establish a connection */
cl = clnt_create(host, RQUOTAPROG, EXT_RQUOTAVERS, "udp");
rquota_get_result(&result.getquota_rslt_u.gqr_rquota,
bytes_value_r, bytes_limit_r,
count_value_r, count_limit_r);
- if (root->root.quota->set->debug) {
- i_debug("quota-fs: gid=%s, bytes=%"PRIu64"/%"PRIu64" "
- "files=%"PRIu64"/%"PRIu64,
- dec2str(root->gid),
- *bytes_value_r, *bytes_limit_r,
- *count_value_r, *count_limit_r);
- }
+ e_debug(root->root.quota->event, "quota-fs: gid=%s, bytes=%"PRIu64"/%"PRIu64" "
+ "files=%"PRIu64"/%"PRIu64,
+ dec2str(root->gid),
+ *bytes_value_r, *bytes_limit_r,
+ *count_value_r, *count_limit_r);
return 1;
}
case Q_NOQUOTA:
- if (root->root.quota->set->debug) {
- i_debug("quota-fs: gid=%s, limit=unlimited",
- dec2str(root->gid));
- }
+ e_debug(root->root.quota->event, "quota-fs: gid=%s, limit=unlimited",
+ dec2str(root->gid));
fs_quota_root_disable(root, TRUE);
return 0;
case Q_EPERM:
return FALSE;
if (stat(mailbox_path, &mst) < 0) {
if (errno != ENOENT)
- i_error("stat(%s) failed: %m", mailbox_path);
+ e_error(_root->quota->event,
+ "stat(%s) failed: %m", mailbox_path);
return FALSE;
}
if (stat(root->storage_mount_path, &rst) < 0) {
- if (_root->quota->set->debug) {
- i_debug("stat(%s) failed: %m",
- root->storage_mount_path);
- }
+ e_debug(_root->quota->event, "stat(%s) failed: %m",
+ root->storage_mount_path);
return FALSE;
}
match = CMP_DEV_T(mst.st_dev, rst.st_dev);
- if (_root->quota->set->debug) {
- i_debug("box=%s mount=%s match=%s", mailbox_path,
- root->storage_mount_path, match ? "yes" : "no");
- }
+ e_debug(_root->quota->event, "box=%s mount=%s match=%s", mailbox_path,
+ root->storage_mount_path, match ? "yes" : "no");
return match;
}
/* non-imapc namespace, skip */
if ((storage->class_flags &
MAIL_STORAGE_CLASS_FLAG_NOQUOTA) == 0) {
- i_warning("quota: Namespace '%s' is not imapc, "
+ e_warning(root->root.quota->event,
+ "quota: Namespace '%s' is not imapc, "
"skipping for imapc quota",
root->imapc_ns->prefix);
}
const struct imapc_quota_refresh_root *refresh_root;
if (array_count(&refresh->roots) == 0) {
- i_error("quota: imapc didn't return any QUOTA results");
+ e_error(quota->event,
+ "quota: imapc didn't return any QUOTA results");
return;
}
/* use the first quota root for everything */
}
if ((capa & IMAPC_CAPABILITY_QUOTA) == 0) {
/* no QUOTA capability - disable quota */
- i_warning("quota: Remote IMAP server doesn't support QUOTA - disabling");
+ e_warning(root->root.quota->event,
+ "quota: Remote IMAP server doesn't support QUOTA - disabling");
root->client = NULL;
return 0;
}
/* ignore if the directory got lost, stale or if it was
actually a file and not a directory */
if (errno != ENOENT && errno != ESTALE && errno != ENOTDIR) {
- i_error("stat(%s) failed: %m", str_c(ctx->path));
+ e_error(ctx->root->root.quota->event,
+ "stat(%s) failed: %m", str_c(ctx->path));
ctx->state = 0;
}
}
perm.file_create_gid,
perm.file_create_gid_origin) < 0 &&
errno != EEXIST) {
- i_error("mkdir_parents(%s) failed: %m", dir);
+ e_error(root->root.quota->event,
+ "mkdir_parents(%s) failed: %m", dir);
return -1;
}
fd = safe_mkstemp_hostpid_group(temp_path,
perm.file_create_gid_origin);
}
if (fd == -1) {
- i_error("safe_mkstemp(%s) failed: %m", path);
+ e_error(root->root.quota->event,
+ "safe_mkstemp(%s) failed: %m", path);
return -1;
}
str_printfa(str, "\n%"PRIu64" %"PRIu64"\n",
root->total_bytes, root->total_count);
if (write_full(fd, str_data(str), str_len(str)) < 0) {
- i_error("write_full(%s) failed: %m", str_c(temp_path));
+ e_error(_root->quota->event,
+ "write_full(%s) failed: %m", str_c(temp_path));
i_close_fd(&fd);
i_unlink(str_c(temp_path));
return -1;
i_close_fd(&fd);
if (rename(str_c(temp_path), path) < 0) {
- i_error("rename(%s, %s) failed: %m", str_c(temp_path), path);
+ e_error(_root->quota->event,
+ "rename(%s, %s) failed: %m", str_c(temp_path), path);
i_unlink_if_exists(str_c(temp_path));
return -1;
}
if (unlink(root->maildirsize_path) < 0 &&
errno != ENOENT && errno != ESTALE)
- i_error("unlink(%s) failed: %m", root->maildirsize_path);
+ e_error(root->root.quota->event,
+ "unlink(%s) failed: %m", root->maildirsize_path);
}
static int maildirsize_recalculate_finish(struct maildir_quota_root *root,
/* non-maildir namespace, skip */
if ((storage->class_flags &
MAIL_STORAGE_CLASS_FLAG_NOQUOTA) == 0) {
- i_warning("quota: Namespace '%s' is not Maildir, "
+ e_warning(root->root.quota->event,
+ "Namespace '%s' is not Maildir, "
"skipping for Maildir++ quota",
root->maildirsize_ns->prefix);
}
if (errno == ESTALE) {
/* deleted/replaced already, ignore */
} else {
- i_error("write_full(%s) failed: %m",
+ e_error(root->root.quota->event,
+ "write_full(%s) failed: %m",
root->maildirsize_path);
}
} else {
if (close(root->fd) < 0) {
ret = -1;
if (errno != ESTALE)
- i_error("close(%s) failed: %m", root->maildirsize_path);
+ e_error(root->root.quota->event,
+ "close(%s) failed: %m", root->maildirsize_path);
}
root->fd = -1;
}
we wanted to do. */
} else if (root->fd == -1) {
if (maildirsize_recalculate(root, &error) < 0)
- i_error("quota-maildir: %s", error);
+ e_error(_root->quota->event,
+ "quota-maildir: %s", error);
} else if (ctx->recalculate != QUOTA_RECALCULATE_DONT) {
i_close_fd(&root->fd);
if (maildirsize_recalculate(root, &error) < 0)
- i_error("quota-maildir: %s", error);
+ e_error(_root->quota->event,
+ "quota-maildir: %s", error);
} else if (maildirsize_update(root, ctx->count_used, ctx->bytes_used) < 0) {
i_close_fd(&root->fd);
maildirsize_rebuild_later(root);
return 0;
case QUOTA_ALLOC_RESULT_TEMPFAIL:
/* Log the error, but allow saving anyway. */
- i_error("quota: Failed to check if user is under quota: %s - saving mail anyway", error);
+ e_error(qt->quota->event,
+ "quota: Failed to check if user is under quota: %s - "
+ "saving mail anyway", error);
return 0;
case QUOTA_ALLOC_RESULT_BACKGROUND_CALC:
/* Could not determine if there is enough space due to ongoing
background quota calculation, allow saving anyway. */
- i_warning("quota: Failed to check if user is under quota: %s - saving mail anyway", error);
+ e_warning(qt->quota->event,
+ "quota: Failed to check if user is under quota: %s - "
+ "saving mail anyway", error);
return 0;
default:
quota_set_storage_error(qt, t->box, ret, error);
enum quota_get_result error_res;
const char *error;
if (quota_transaction_set_limits(qt, &error_res, &error) < 0) {
- if (error_res == QUOTA_GET_RESULT_BACKGROUND_CALC)
- i_warning("quota: %s - copying mail anyway", error);
- else
- i_error("quota: %s - copying mail anyway", error);
+ if (error_res == QUOTA_GET_RESULT_BACKGROUND_CALC) {
+ e_warning(qt->quota->event,
+ "quota: %s - copying mail anyway", error);
+ } else {
+ e_error(qt->quota->event,
+ "quota: %s - copying mail anyway", error);
+ }
}
if (qbox->module_ctx.super.copy(ctx, mail) < 0)
break;
case QUOTA_ALLOC_RESULT_TEMPFAIL:
/* Log the error, but allow saving anyway. */
- i_error("quota: Failed to check if user is under quota: %s - saving mail anyway", error);
+ e_error(qt->quota->event,
+ "quota: Failed to check if user is under quota: %s - "
+ "saving mail anyway", error);
break;
case QUOTA_ALLOC_RESULT_BACKGROUND_CALC:
/* Could not determine if there is enough space due to
* ongoing background quota calculation, allow saving
* anyway. */
- i_warning("quota: Failed to check if user is under quota: %s - saving mail anyway", error);
+ e_warning(qt->quota->event,
+ "quota: Failed to check if user is under quota: %s - "
+ "saving mail anyway", error);
break;
default:
quota_set_storage_error(qt, t->box, qret, error);
enum quota_get_result error_res;
if (quota_transaction_set_limits(qt, &error_res, &error) < 0) {
if (error_res == QUOTA_GET_RESULT_BACKGROUND_CALC)
- i_warning("quota: %s - saving mail anyway", error);
+ e_warning(qt->quota->event,
+ "quota: %s - saving mail anyway", error);
else
- i_error("quota: %s - saving mail anyway", error);
+ e_error(qt->quota->event,
+ "quota: %s - saving mail anyway", error);
}
return qbox->module_ctx.super.save_begin(ctx, input);
root->ns = mail_namespace_find_prefix(namespaces,
root->ns_prefix);
if (root->ns == NULL && !silent_errors) {
- i_error("quota: Unknown namespace: %s",
+ e_error(root->quota->event,
+ "quota: Unknown namespace: %s",
root->ns_prefix);
}
}
ns = mail_namespace_find(namespaces, name);
if ((ns->flags & NAMESPACE_FLAG_UNUSABLE) != 0 &&
!silent_errors)
- i_error("quota: Unknown namespace: %s", name);
+ e_error(root->quota->event,
+ "quota: Unknown namespace: %s", name);
}
}
bytes_limit, 0);
root_set->last_mail_max_extra_bytes = root_set->grace_rule.bytes_limit;
- if (root_set->set->debug && root_set->set->initialized) {
- i_debug("Quota root %s: Recalculated relative rules with "
+ if (root_set->set->initialized) {
+ e_debug(root_set->set->event,
+ "Quota root %s: Recalculated relative rules with "
"bytes=%lld count=%lld. Now grace=%"PRIu64, root_set->name,
(long long)bytes_limit, (long long)count_limit,
root_set->last_mail_max_extra_bytes);
}
value++;
} else if (*value != '-' && relative_rule) {
- i_warning("quota root %s rule %s: "
+ e_warning(root_set->set->event, "quota root %s rule %s: "
"obsolete configuration for rule '%s' "
"should be changed to '%s=+%s'",
root_set->name, full_rule_def,
if (strcmp(p, "ignore") == 0) {
rule->ignore = TRUE;
- if (root_set->set->debug) {
- i_debug("Quota rule: root=%s mailbox=%s ignored",
- root_set->name, mailbox_mask);
- }
+ e_debug(root_set->set->event,
+ "Quota rule: root=%s mailbox=%s ignored",
+ root_set->name, mailbox_mask);
return 0;
}
quota_root_recalculate_relative_rules(root_set,
root_set->default_rule.bytes_limit,
root_set->default_rule.count_limit);
- if (root_set->set->debug) {
- const char *rule_plus =
- rule == &root_set->default_rule ? "" : "+";
-
- i_debug("Quota rule: root=%s mailbox=%s "
- "bytes=%s%lld%s messages=%s%lld%s",
- root_set->name, mailbox_mask,
- rule->bytes_limit > 0 ? rule_plus : "",
- (long long)rule->bytes_limit,
- rule->bytes_percent == 0 ? "" :
- t_strdup_printf(" (%u%%)", rule->bytes_percent),
- rule->count_limit > 0 ? rule_plus : "",
- (long long)rule->count_limit,
- rule->count_percent == 0 ? "" :
- t_strdup_printf(" (%u%%)", rule->count_percent));
- }
+ const char *rule_plus =
+ rule == &root_set->default_rule ? "" : "+";
+
+ e_debug(root_set->set->event, "Quota rule: root=%s mailbox=%s "
+ "bytes=%s%lld%s messages=%s%lld%s",
+ root_set->name, mailbox_mask,
+ rule->bytes_limit > 0 ? rule_plus : "",
+ (long long)rule->bytes_limit,
+ rule->bytes_percent == 0 ? "" :
+ t_strdup_printf(" (%u%%)", rule->bytes_percent),
+ rule->count_limit > 0 ? rule_plus : "",
+ (long long)rule->count_limit,
+ rule->count_percent == 0 ? "" :
+ t_strdup_printf(" (%u%%)", rule->count_percent));
return ret;
}
quota_root_recalculate_relative_rules(root_set,
root_set->default_rule.bytes_limit,
root_set->default_rule.count_limit);
- if (root_set->set->debug) {
- i_debug("Quota warning: bytes=%"PRId64"%s "
- "messages=%"PRId64"%s reverse=%s command=%s",
- warning->rule.bytes_limit,
- warning->rule.bytes_percent == 0 ? "" :
- t_strdup_printf(" (%u%%)", warning->rule.bytes_percent),
- warning->rule.count_limit,
- warning->rule.count_percent == 0 ? "" :
- t_strdup_printf(" (%u%%)", warning->rule.count_percent),
- warning->reverse ? "yes" : "no",
- warning->command);
- }
+ e_debug(root_set->set->event, "Quota warning: bytes=%"PRId64"%s "
+ "messages=%"PRId64"%s reverse=%s command=%s",
+ warning->rule.bytes_limit,
+ warning->rule.bytes_percent == 0 ? "" :
+ t_strdup_printf(" (%u%%)", warning->rule.bytes_percent),
+ warning->rule.count_limit,
+ warning->rule.count_percent == 0 ? "" :
+ t_strdup_printf(" (%u%%)", warning->rule.count_percent),
+ warning->reverse ? "yes" : "no",
+ warning->command);
return 0;
}
quota_rule_recalculate_relative_rules(&root_set->grace_rule,
root_set->default_rule.bytes_limit, 0);
root_set->last_mail_max_extra_bytes = root_set->grace_rule.bytes_limit;
- if (root_set->set->debug) {
- i_debug("Quota grace: root=%s bytes=%lld%s",
- root_set->name, (long long)root_set->grace_rule.bytes_limit,
- root_set->grace_rule.bytes_percent == 0 ? "" :
- t_strdup_printf(" (%u%%)", root_set->grace_rule.bytes_percent));
- }
+ e_debug(root_set->set->event, "Quota grace: root=%s bytes=%lld%s",
+ root_set->name, (long long)root_set->grace_rule.bytes_limit,
+ root_set->grace_rule.bytes_percent == 0 ? "" :
+ t_strdup_printf(" (%u%%)", root_set->grace_rule.bytes_percent));
return 0;
}
}
root_set->args = p_strdup(quota_set->pool, args);
- if (quota_set->debug) {
- i_debug("Quota root: name=%s backend=%s args=%s",
- root_set->name, backend_name, args == NULL ? "" : args);
- }
+ e_debug(quota_set->event, "Quota root: name=%s backend=%s args=%s",
+ root_set->name, backend_name, args == NULL ? "" : args);
p_array_init(&root_set->rules, quota_set->pool, 4);
p_array_init(&root_set->warning_rules, quota_set->pool, 4);
set.home_dir = NULL;
if (dict_init(root->set->limit_set, &set,
&root->limit_set_dict, &error) < 0) {
- i_error("dict_init() failed: %s", error);
+ e_error(root->quota->event,
+ "dict_init() failed: %s", error);
*client_error_r = "Internal quota limit update error";
return -1;
}
key = t_strdup_printf(QUOTA_LIMIT_SET_PATH"%s", key);
dict_set(trans, key, dec2str(value));
if (dict_transaction_commit(&trans, &error) < 0) {
- i_error("dict_transaction_commit() failed: %s", error);
+ e_error(root->quota->event,
+ "dict_transaction_commit() failed: %s", error);
*client_error_r = "Internal quota limit update error";
return -1;
}
restrict_access_init(&set.restrict_set);
- if (root->quota->set->debug)
- i_debug("quota: Executing warning: %s (because %s)", cmd, reason);
+ e_debug(root->quota->event, "quota: Executing warning: %s (because %s)", cmd, reason);
args = t_strsplit_spaces(cmd, " ");
if (last_arg != NULL) {
if (program_client_create(socket_path, args, &set, TRUE,
&pc, &error) < 0) {
- i_error("program_client_create(%s) failed: %s", socket_path,
+ e_error(root->quota->event,
+ "program_client_create(%s) failed: %s", socket_path,
error);
return;
}
if (quota_get_resource(root, "", QUOTA_NAME_STORAGE_BYTES,
&bytes_current, &bytes_limit, &error) == QUOTA_GET_RESULT_INTERNAL_ERROR) {
- i_error("Failed to get quota resource "QUOTA_NAME_STORAGE_BYTES
+ e_error(root->quota->event,
+ "Failed to get quota resource "QUOTA_NAME_STORAGE_BYTES
": %s", error);
return;
}
if (quota_get_resource(root, "", QUOTA_NAME_MESSAGES,
&count_current, &count_limit, &error) == QUOTA_GET_RESULT_INTERNAL_ERROR) {
- i_error("Failed to get quota resource "QUOTA_NAME_MESSAGES
+ e_error(root->quota->event,
+ "Failed to get quota resource "QUOTA_NAME_MESSAGES
": %s", error);
return;
}
const char *error;
if (roots[i]->backend.v.update(roots[i], ctx, &error) < 0) {
- i_error("Failed to update quota for %s: %s",
+ e_error(ctx->quota->event,
+ "Failed to update quota for %s: %s",
mailbox_name, error);
ret = -1;
}
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) {
- if (root->quota->set->debug) {
- i_debug("quota: quota_over_flag check: "
- "%s unset - skipping", name);
- }
+ e_debug(root->quota->event, "quota: quota_over_flag check: "
+ "%s unset - skipping", name);
return FALSE;
}
name = t_strconcat(root->set->set_name, "_over_flag_value", NULL);
flag_mask = mail_user_plugin_getenv(root->quota->user, name);
if (flag_mask == NULL) {
- if (root->quota->set->debug) {
- i_debug("quota: quota_over_flag check: "
- "%s unset - skipping", name);
- }
+ e_debug(root->quota->event, "quota: quota_over_flag check: "
+ "%s unset - skipping", name);
return FALSE;
}
if (root->quota->user->session_create_time +
QUOTA_OVER_FLAG_MAX_DELAY_SECS < ioloop_time) {
/* userdb's quota_over_flag lookup is too old. */
- if (root->quota->set->debug) {
- i_debug("quota: quota_over_flag check: "
- "Flag lookup time is too old - skipping");
- }
+ e_debug(root->quota->event, "quota: quota_over_flag check: "
+ "Flag lookup time is too old - skipping");
return;
}
if (root->quota->user->session_restored) {
/* we don't know whether the quota_over_script was executed
before hibernation. just assume that it was, so we don't
unnecessarily call it too often. */
- if (root->quota->set->debug) {
- i_debug("quota: quota_over_flag check: "
- "Session was already hibernated - skipping");
- }
+ e_debug(root->quota->event, "quota: quota_over_flag check: "
+ "Session was already hibernated - skipping");
return;
}
root->quota_over_flag_checked = TRUE;
&limit, &error);
if (ret == QUOTA_GET_RESULT_INTERNAL_ERROR) {
/* can't reliably verify this */
- i_error("quota: Quota %s lookup failed - can't verify quota_over_flag: %s",
+ e_error(root->quota->event,
+ "quota: Quota %s lookup failed - can't verify quota_over_flag: %s",
resources[i], error);
return;
}
- if (root->quota->set->debug) {
- i_debug("quota: quota_over_flag check: %s ret=%d value=%"PRIu64" limit=%"PRIu64,
- resources[i], ret, value, limit);
- }
+ e_debug(root->quota->event, "quota: quota_over_flag check: %s ret=%d value=%"PRIu64" limit=%"PRIu64,
+ resources[i], ret, value, limit);
if (ret == QUOTA_GET_RESULT_LIMITED && value >= limit)
cur_overquota = TRUE;
}
- if (root->quota->set->debug) {
- i_debug("quota: quota_over_flag=%d(%s) vs currently overquota=%d",
- quota_over_status ? 1 : 0,
- quota_over_flag == NULL ? "(null)" : quota_over_flag,
- cur_overquota ? 1 : 0);
- }
+ e_debug(root->quota->event, "quota: quota_over_flag=%d(%s) vs currently overquota=%d",
+ quota_over_status ? 1 : 0,
+ quota_over_flag == NULL ? "(null)" : quota_over_flag,
+ cur_overquota ? 1 : 0);
if (cur_overquota != quota_over_status) {
quota_warning_execute(root, quota_over_script, quota_over_flag,
"quota_over_flag mismatch");