else if (ret == 0)
i_info("User no longer exists, skipping");
} T_END;
- if (ret < 0)
+ if (ret == -1)
break;
if (doveadm_verbose) {
if (++user_idx % interval == 0) {
if (userdb_fields != NULL) {
auth_user_fields_parse(userdb_fields, temp_pool, &reply);
if (user_reply_handle(user, &reply, error_r) < 0)
- ret = -1;
+ ret = -2;
}
pool_unref(&temp_pool);
/* load per-user plugins */
- mail_storage_service_load_modules(ctx, user_info, user->user_set);
+ if (ret > 0) {
+ mail_storage_service_load_modules(ctx, user_info,
+ user->user_set);
+ }
*user_r = user;
return ret;
or _all_init(). */
void mail_storage_service_init_settings(struct mail_storage_service_ctx *ctx,
const struct mail_storage_service_input *input);
-/* Returns 1 if ok, 0 if user wasn't found, -1 if error. */
+/* Returns 1 if ok, 0 if user wasn't found, -1 if fatal error,
+ -2 if user had invalid settings. */
int mail_storage_service_lookup(struct mail_storage_service_ctx *ctx,
const struct mail_storage_service_input *input,
struct mail_storage_service_user **user_r,
struct mail_user *mail_user;
struct expire_env *env;
bool testrun;
+ bool userdb_lookup_failed;
};
static int expire_init_user(struct expire_context *ctx, const char *user)
if (ret <= 0) {
if (ret < 0 || ctx->testrun)
i_error("%s", errstr);
- return ret;
+ if (ret == -1) {
+ /* the next userdb lookup is most likely
+ going to fail too */
+ ctx->userdb_lookup_failed = TRUE;
+ }
+ return ret < 0 ? -1 : 0;
}
if (mail_user_set_plugin_getenv(ctx->mail_user->set, "expire") == NULL)
} T_END;
if (ret < 0) {
+ if (ctx.userdb_lookup_failed)
+ break;
/* failed to update */
} else if (next_expire == 0) {
/* no more messages or mailbox deleted */
t_strdup_printf("script(%s): ", input.username));
service_ctx = mail_storage_service_init(master_service, NULL, flags);
- if (mail_storage_service_lookup(service_ctx, &input, &user, &error) < 0)
+ if (mail_storage_service_lookup(service_ctx, &input, &user, &error) <= 0)
i_fatal("%s", error);
mail_storage_service_restrict_setenv(service_ctx, user);