struct mail_storage *storage = box->storage;
struct mail_namespace *ns;
struct mailbox_metadata metadata;
+ struct dict_settings set;
const char *error;
if (mailbox_get_metadata(box, MAILBOX_METADATA_GUID, &metadata) < 0)
return -1;
}
- if (dict_init(storage->set->mail_attribute_dict,
- DICT_DATA_TYPE_STRING,
- storage->user->username,
- storage->user->set->base_dir,
- &storage->_shared_attr_dict, &error) < 0) {
+ memset(&set, 0, sizeof(set));
+ set.username = storage->user->username;
+ set.base_dir = storage->user->set->base_dir;
+ if (mail_user_get_home(storage->user, &set.home_dir) <= 0)
+ set.home_dir = NULL;
+ if (dict_init_full(storage->set->mail_attribute_dict, &set,
+ &storage->_shared_attr_dict, &error) < 0) {
mail_storage_set_critical(storage,
"mail_attribute_dict: dict_init(%s) failed: %s",
storage->set->mail_attribute_dict, error);
struct mail_user_vfuncs *v = user->vlast;
struct last_login_user *luser;
struct dict *dict;
+ struct dict_settings set;
struct dict_transaction_context *trans;
const char *dict_value, *key_name, *error;
if (dict_value == NULL)
return;
- if (dict_init(dict_value, DICT_DATA_TYPE_STRING, user->username,
- user->set->base_dir, &dict, &error) < 0) {
+ memset(&set, 0, sizeof(set));
+ set.username = user->username;
+ set.base_dir = user->set->base_dir;
+ if (mail_user_get_home(user, &set.home_dir) <= 0)
+ set.home_dir = NULL;
+ if (dict_init_full(dict_value, &set, &dict, &error) < 0) {
i_error("last_login_dict: dict_init(%s) failed: %s",
dict_value, error);
return;
const char **error_r)
{
struct dict_quota_root *root = (struct dict_quota_root *)_root;
+ struct dict_settings set;
const char *username, *p, *error;
p = args == NULL ? NULL : strchr(args, ':');
/* FIXME: we should use 64bit integer as datatype instead but before
it can actually be used don't bother */
- if (dict_init(args, DICT_DATA_TYPE_STRING, username,
- _root->quota->user->set->base_dir, &root->dict,
- &error) < 0) {
+ memset(&set, 0, sizeof(set));
+ set.username = username;
+ set.base_dir = _root->quota->user->set->base_dir;
+ if (mail_user_get_home(_root->quota->user, &set.home_dir) <= 0)
+ set.home_dir = NULL;
+ if (dict_init_full(args, &set, &root->dict, &error) < 0) {
*error_r = t_strdup_printf("dict_init(%s) failed: %s", args, error);
return -1;
}
}
if (root->limit_set_dict == NULL) {
- if (dict_init(root->set->limit_set, DICT_DATA_TYPE_STRING,
- root->quota->user->username,
- root->quota->user->set->base_dir,
- &root->limit_set_dict, error_r) < 0)
+ struct dict_settings set;
+
+ memset(&set, 0, sizeof(set));
+ set.username = root->quota->user->username;
+ set.base_dir = root->quota->user->set->base_dir;
+ if (mail_user_get_home(root->quota->user, &set.home_dir) <= 0)
+ set.home_dir = NULL;
+ if (dict_init_full(root->set->limit_set, &set,
+ &root->limit_set_dict, error_r) < 0)
return -1;
}