dovecot-2.2: lib-storage: Added mail_storage_service_save_userdb...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Oct 29 20:09:54 EET 2012
details: http://hg.dovecot.org/dovecot-2.2/rev/fec539656811
changeset: 15343:fec539656811
user: Timo Sirainen <tss at iki.fi>
date: Mon Oct 29 20:06:53 2012 +0200
description:
lib-storage: Added mail_storage_service_save_userdb_fields()
diffstat:
src/lib-storage/mail-storage-service.c | 23 ++++++++++++++++++++++-
src/lib-storage/mail-storage-service.h | 4 ++++
2 files changed, 26 insertions(+), 1 deletions(-)
diffs (68 lines):
diff -r 5479887eb461 -r fec539656811 src/lib-storage/mail-storage-service.c
--- a/src/lib-storage/mail-storage-service.c Mon Oct 29 19:54:50 2012 +0200
+++ b/src/lib-storage/mail-storage-service.c Mon Oct 29 20:06:53 2012 +0200
@@ -60,6 +60,9 @@
const char *set_cache_module, *set_cache_service;
struct master_service_settings_cache *set_cache;
+ pool_t userdb_next_pool;
+ const char *const **userdb_next_fieldsp;
+
unsigned int debug:1;
unsigned int log_initialized:1;
};
@@ -991,7 +994,13 @@
/* load global plugins */
mail_storage_service_load_modules(ctx, user_info, user_set);
- temp_pool = pool_alloconly_create("userdb lookup", 2048);
+ if (ctx->userdb_next_pool == NULL)
+ temp_pool = pool_alloconly_create("userdb lookup", 2048);
+ else {
+ temp_pool = ctx->userdb_next_pool;
+ ctx->userdb_next_pool = NULL;
+ pool_ref(temp_pool);
+ }
if ((flags & MAIL_STORAGE_SERVICE_FLAG_USERDB_LOOKUP) != 0) {
ret = service_auth_userdb_lookup(ctx, input, temp_pool,
&username, &userdb_fields,
@@ -1001,6 +1010,7 @@
pool_unref(&user_pool);
return ret;
}
+ *ctx->userdb_next_fieldsp = userdb_fields;
} else {
userdb_fields = input->userdb_fields;
}
@@ -1055,6 +1065,17 @@
return ret;
}
+void mail_storage_service_save_userdb_fields(struct mail_storage_service_ctx *ctx,
+ pool_t pool, const char *const **userdb_fields_r)
+{
+ i_assert(pool != NULL);
+ i_assert(userdb_fields_r != NULL);
+
+ ctx->userdb_next_pool = pool;
+ ctx->userdb_next_fieldsp = userdb_fields_r;
+ *userdb_fields_r = NULL;
+}
+
int mail_storage_service_next(struct mail_storage_service_ctx *ctx,
struct mail_storage_service_user *user,
struct mail_user **mail_user_r)
diff -r 5479887eb461 -r fec539656811 src/lib-storage/mail-storage-service.h
--- a/src/lib-storage/mail-storage-service.h Mon Oct 29 19:54:50 2012 +0200
+++ b/src/lib-storage/mail-storage-service.h Mon Oct 29 20:06:53 2012 +0200
@@ -81,6 +81,10 @@
const struct mail_storage_service_input *input,
struct mail_storage_service_user **user_r,
const char **error_r);
+/* The next mail_storage_service_lookup() will save the userdb fields into the
+ given pointer, allocated from the given pool. */
+void mail_storage_service_save_userdb_fields(struct mail_storage_service_ctx *ctx,
+ pool_t pool, const char *const **userdb_fields_r);
/* Returns 0 if ok, -1 if fatal error, -2 if error is user-specific. */
int mail_storage_service_next(struct mail_storage_service_ctx *ctx,
struct mail_storage_service_user *user,
More information about the dovecot-cvs
mailing list