changeset 12149:7dd6ff192718

lib-storage: If user->error is set during initialization, fail user creation.
author Timo Sirainen <tss@iki.fi>
date Tue, 21 Sep 2010 18:04:30 +0100
parents c758655c6270
children 3780caa2a6f2
files src/lib-storage/mail-user.c src/lib-storage/mail-user.h
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/mail-user.c	Tue Sep 21 16:30:20 2010 +0100
+++ b/src/lib-storage/mail-user.c	Tue Sep 21 18:04:30 2010 +0100
@@ -114,6 +114,11 @@
 
 	user->initialized = TRUE;
 	hook_mail_user_created(user);
+
+	if (user->error != NULL) {
+		*error_r = t_strdup(user->error);
+		return -1;
+	}
 	return 0;
 }
 
--- a/src/lib-storage/mail-user.h	Tue Sep 21 16:30:20 2010 +0100
+++ b/src/lib-storage/mail-user.h	Tue Sep 21 18:04:30 2010 +0100
@@ -23,7 +23,8 @@
 	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;