From a26b7e87b4157cfa800f9bcd8c4c044462d21268 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 21 Sep 2010 18:04:30 +0100 Subject: [PATCH] lib-storage: If user->error is set during initialization, fail user creation. --- src/lib-storage/mail-user.c | 5 +++++ src/lib-storage/mail-user.h | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib-storage/mail-user.c b/src/lib-storage/mail-user.c index 44a66db9b6..1f71cd0e83 100644 --- a/src/lib-storage/mail-user.c +++ b/src/lib-storage/mail-user.c @@ -114,6 +114,11 @@ int mail_user_init(struct mail_user *user, const char **error_r) user->initialized = TRUE; hook_mail_user_created(user); + + if (user->error != NULL) { + *error_r = t_strdup(user->error); + return -1; + } return 0; } diff --git a/src/lib-storage/mail-user.h b/src/lib-storage/mail-user.h index 894dcf8bc3..ab782afa3c 100644 --- a/src/lib-storage/mail-user.h +++ b/src/lib-storage/mail-user.h @@ -23,7 +23,8 @@ struct mail_user { const char *service; struct ip_addr *local_ip, *remote_ip; const struct var_expand_table *var_expand_table; - /* error during initialization */ + /* If non-NULL, fail the user initialization with this error. + This could be set by plugins that need to fail the initialization. */ const char *error; const struct setting_parser_info *set_info; -- 2.47.3