dovecot-2.2: quota-status: Unknown recipients caused a crash.
dovecot at dovecot.org
dovecot at dovecot.org
Fri Apr 5 13:19:25 EEST 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/b6f69bdcf63f
changeset: 16204:b6f69bdcf63f
user: Timo Sirainen <tss at iki.fi>
date: Fri Apr 05 13:19:17 2013 +0300
description:
quota-status: Unknown recipients caused a crash.
diffstat:
src/plugins/quota/quota-status.c | 31 ++++++++++++++++++++++++++++---
1 files changed, 28 insertions(+), 3 deletions(-)
diffs (72 lines):
diff -r 9c3bf2cb62e8 -r b6f69bdcf63f src/plugins/quota/quota-status.c
--- a/src/plugins/quota/quota-status.c Fri Apr 05 12:26:57 2013 +0300
+++ b/src/plugins/quota/quota-status.c Fri Apr 05 13:19:17 2013 +0300
@@ -5,6 +5,7 @@
#include "connection.h"
#include "restrict-access.h"
#include "master-service.h"
+#include "master-service-settings.h"
#include "mail-namespace.h"
#include "mail-storage.h"
#include "mail-storage-settings.h"
@@ -27,6 +28,7 @@
static enum quota_protocol protocol;
static struct mail_storage_service_ctx *storage_service;
static struct connection_list *clients;
+static char *nouser_reply;
static void client_connected(struct master_service_connection *conn)
{
@@ -94,9 +96,7 @@
&service_user, &user, &error);
restrict_access_allow_coredumps(TRUE);
if (ret == 0) {
- value = mail_user_plugin_getenv(user, "quota_status_nouser");
- if (value == NULL)
- value = "REJECT Unknown user";
+ value = nouser_reply;
} else if (ret > 0) {
if ((ret = quota_check(user, client->size, &error)) > 0) {
/* under quota */
@@ -173,16 +173,41 @@
static void main_init(void)
{
+ struct mail_storage_service_input input;
+ const struct setting_parser_info *user_info;
+ const struct setting_parser_context *set_parser;
+ const struct mail_user_settings *user_set;
+ const char *value, *error;
+ pool_t pool;
+
clients = connection_list_init(&client_set, &client_vfuncs);
storage_service = mail_storage_service_init(master_service, NULL,
MAIL_STORAGE_SERVICE_FLAG_USERDB_LOOKUP |
MAIL_STORAGE_SERVICE_FLAG_TEMP_PRIV_DROP |
MAIL_STORAGE_SERVICE_FLAG_ENABLE_CORE_DUMPS |
MAIL_STORAGE_SERVICE_FLAG_NO_CHDIR);
+
+ memset(&input, 0, sizeof(input));
+ input.service = "quota-status";
+ input.module = "mail";
+ input.username = "";
+
+ pool = pool_alloconly_create("service all settings", 4096);
+ if (mail_storage_service_read_settings(storage_service, &input, pool,
+ &user_info, &set_parser,
+ &error) < 0)
+ i_fatal("%s", error);
+ user_set = master_service_settings_parser_get_others(master_service,
+ set_parser)[0];
+ value = mail_user_set_plugin_getenv(user_set, "quota_status_nouser");
+ nouser_reply = value != NULL ? i_strdup(value) :
+ i_strdup("REJECT Unknown user");
+ pool_unref(&pool);
}
static void main_deinit(void)
{
+ i_free(nouser_reply);
connection_list_deinit(&clients);
mail_storage_service_deinit(&storage_service);
}
More information about the dovecot-cvs
mailing list