"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/plugins/quota/quota.c" between
dovecot-2.3.7.2.tar.gz and dovecot-2.3.8.tar.gz

About: Dovecot is an IMAP and POP3 server, written with security primarily in mind.

quota.c  (dovecot-2.3.7.2):quota.c  (dovecot-2.3.8)
skipping to change at line 941 skipping to change at line 941
return 0; return 0;
ctx->limits_set = TRUE; ctx->limits_set = TRUE;
mailbox_name = mailbox_get_vname(ctx->box); mailbox_name = mailbox_get_vname(ctx->box);
/* use quota_grace only for LDA/LMTP */ /* use quota_grace only for LDA/LMTP */
use_grace = (ctx->box->flags & MAILBOX_FLAG_POST_SESSION) != 0; use_grace = (ctx->box->flags & MAILBOX_FLAG_POST_SESSION) != 0;
ctx->no_quota_updates = TRUE; ctx->no_quota_updates = TRUE;
/* find the lowest quota limits from all roots and use them */ /* find the lowest quota limits from all roots and use them */
roots = array_get(&ctx->quota->roots, &count); roots = array_get(&ctx->quota->roots, &count);
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
if (!quota_root_is_visible(roots[i], ctx->box) || /* make sure variables get initialized */
(roots[i]->no_enforcing && ctx->auto_updating)) bytes_limit = count_limit = 0;
if (!quota_root_is_visible(roots[i], ctx->box))
continue; continue;
else if (roots[i]->no_enforcing) { else if (roots[i]->no_enforcing) {
bytes_limit = (uint64_t)-1;
count_limit = (uint64_t)-1;
ignored = FALSE; ignored = FALSE;
} else if (quota_root_get_rule_limits(roots[i], mailbox_name, } else if (quota_root_get_rule_limits(roots[i], mailbox_name,
&bytes_limit, &count_limit, &bytes_limit, &count_limit,
&ignored, &error) < 0) { &ignored, &error) < 0) {
ctx->failed = TRUE; ctx->failed = TRUE;
*error_result_r = QUOTA_GET_RESULT_INTERNAL_ERROR; *error_result_r = QUOTA_GET_RESULT_INTERNAL_ERROR;
*error_r = t_strdup_printf( *error_r = t_strdup_printf(
"Failed to get quota root rule limits for %s: %s" , "Failed to get quota root rule limits for %s: %s" ,
mailbox_name, error); mailbox_name, error);
return -1; return -1;
} }
if (!ignored) if (!ignored)
ctx->no_quota_updates = FALSE; ctx->no_quota_updates = FALSE;
if (bytes_limit > 0) { if (bytes_limit > 0) {
ret = quota_get_resource(roots[i], mailbox_name, ret = quota_get_resource(roots[i], mailbox_name,
QUOTA_NAME_STORAGE_BYTES, QUOTA_NAME_STORAGE_BYTES,
&current, &limit, &error); &current, &limit, &error);
if (roots[i]->no_enforcing) { if (ret == QUOTA_GET_RESULT_LIMITED) {
ctx->bytes_ceil = (uint64_t)-1;
ctx->bytes_ceil2 = (uint64_t)-1;
} else if (ret == QUOTA_GET_RESULT_LIMITED) {
if (limit <= current) { if (limit <= current) {
/* over quota */ /* over quota */
ctx->bytes_ceil = 0; ctx->bytes_ceil = 0;
ctx->bytes_ceil2 = 0; ctx->bytes_ceil2 = 0;
diff = current - limit; diff = current - limit;
if (ctx->bytes_over < diff) if (ctx->bytes_over < diff)
ctx->bytes_over = diff; ctx->bytes_over = diff;
} else { } else {
diff = limit - current; diff = limit - current;
if (ctx->bytes_ceil2 > diff) if (ctx->bytes_ceil2 > diff)
skipping to change at line 1000 skipping to change at line 996
QUOTA_NAME_STORAGE_BYTES" for %s: %s", QUOTA_NAME_STORAGE_BYTES" for %s: %s",
mailbox_name, error); mailbox_name, error);
return -1; return -1;
} }
} }
if (count_limit > 0) { if (count_limit > 0) {
ret = quota_get_resource(roots[i], mailbox_name, ret = quota_get_resource(roots[i], mailbox_name,
QUOTA_NAME_MESSAGES, QUOTA_NAME_MESSAGES,
&current, &limit, &error); &current, &limit, &error);
if (roots[i]->no_enforcing) { if (ret == QUOTA_GET_RESULT_LIMITED) {
ctx->count_ceil = (uint64_t)-1;
} else if (ret == QUOTA_GET_RESULT_LIMITED) {
if (limit <= current) { if (limit <= current) {
/* over quota */ /* over quota */
ctx->count_ceil = 0; ctx->count_ceil = 0;
diff = current - limit; diff = current - limit;
if (ctx->count_over < diff) if (ctx->count_over < diff)
ctx->count_over = diff; ctx->count_over = diff;
} else { } else {
diff = limit - current; diff = limit - current;
if (ctx->count_ceil > diff) if (ctx->count_ceil > diff)
ctx->count_ceil = diff; ctx->count_ceil = diff;
skipping to change at line 1035 skipping to change at line 1029
return 0; return 0;
} }
static void quota_warning_execute(struct quota_root *root, const char *cmd, static void quota_warning_execute(struct quota_root *root, const char *cmd,
const char *last_arg, const char *reason) const char *last_arg, const char *reason)
{ {
const char *socket_path, *const *args, *error, *scheme, *ptr; const char *socket_path, *const *args, *error, *scheme, *ptr;
struct program_client_settings set = { struct program_client_settings set = {
.client_connect_timeout_msecs = 1000, .client_connect_timeout_msecs = 1000,
.debug = root->quota->user->mail_debug,
}; };
struct program_client *pc; struct program_client *pc;
restrict_access_init(&set.restrict_set); restrict_access_init(&set.restrict_set);
if (root->quota->set->debug) if (root->quota->set->debug)
i_debug("quota: Executing warning: %s (because %s)", cmd, reason) ; i_debug("quota: Executing warning: %s (because %s)", cmd, reason) ;
args = t_strsplit_spaces(cmd, " "); args = t_strsplit_spaces(cmd, " ");
if (last_arg != NULL) { if (last_arg != NULL) {
 End of changes. 5 change blocks. 
11 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)