]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Added no_userdb_lookup flag to storage service lookups.
authorTimo Sirainen <tss@iki.fi>
Mon, 18 Oct 2010 17:09:56 +0000 (18:09 +0100)
committerTimo Sirainen <tss@iki.fi>
Mon, 18 Oct 2010 17:09:56 +0000 (18:09 +0100)
src/lib-storage/mail-storage-service.c
src/lib-storage/mail-storage-service.h

index 9e5a1757ecb39c90eac06a58fa28bc8ac9febc89..49f618c7a3d47a9fc99ae535116e197fe8f1686e 100644 (file)
@@ -633,7 +633,7 @@ int mail_storage_service_read_settings(struct mail_storage_service_ctx *ctx,
        /* settings reader may exec doveconf, which is going to clear
           environment, and if we're not doing a userdb lookup we want to
           use $HOME */
-       set_input.preserve_home = 
+       set_input.preserve_home =
                (ctx->flags & MAIL_STORAGE_SERVICE_FLAG_USERDB_LOOKUP) == 0;
        set_input.use_sysexits =
                (ctx->flags & MAIL_STORAGE_SERVICE_FLAG_USE_SYSEXITS) != 0;
@@ -739,6 +739,8 @@ int mail_storage_service_lookup(struct mail_storage_service_ctx *ctx,
                                struct mail_storage_service_user **user_r,
                                const char **error_r)
 {
+       const bool userdb_lookup = !input->no_userdb_lookup &&
+               (ctx->flags & MAIL_STORAGE_SERVICE_FLAG_USERDB_LOOKUP) != 0;
        struct mail_storage_service_user *user;
        const char *username = input->username;
        const struct setting_parser_info *user_info;
@@ -775,7 +777,7 @@ int mail_storage_service_lookup(struct mail_storage_service_ctx *ctx,
        mail_storage_service_load_modules(ctx, user_info, user_set);
 
        temp_pool = pool_alloconly_create("userdb lookup", 2048);
-       if ((ctx->flags & MAIL_STORAGE_SERVICE_FLAG_USERDB_LOOKUP) != 0) {
+       if (userdb_lookup) {
                ret = service_auth_userdb_lookup(ctx, input, temp_pool,
                                                 &username, &userdb_fields,
                                                 error_r);
@@ -802,7 +804,7 @@ int mail_storage_service_lookup(struct mail_storage_service_ctx *ctx,
 
        user->user_set = settings_parser_get_list(user->set_parser)[1];
 
-       if ((ctx->flags & MAIL_STORAGE_SERVICE_FLAG_USERDB_LOOKUP) == 0) {
+       if (!userdb_lookup) {
                const char *home = getenv("HOME");
                if (home != NULL)
                        set_keyval(ctx, user, "mail_home", home);
index bd877c0fbcb964f028bf1d95736a2bd48eff6975..602d607dcda9f559dbb9327ffb1f55da0a8a4ebc 100644 (file)
@@ -41,6 +41,9 @@ struct mail_storage_service_input {
        struct ip_addr local_ip, remote_ip;
 
        const char *const *userdb_fields;
+
+       /* override MAIL_STORAGE_SERVICE_FLAG_USERDB_LOOKUP for this lookup */
+       unsigned int no_userdb_lookup:1;
 };
 
 extern struct module *mail_storage_service_modules;