changeset 10122:92f2dac233b0 HEAD

Allow mail_users_init() without giving socket path.
author Timo Sirainen <tss@iki.fi>
date Tue, 20 Oct 2009 20:35:17 -0400
parents cb2882c142e1
children f6257036f7ef
files src/lib-storage/mail-user.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/mail-user.c	Tue Oct 20 20:23:10 2009 -0400
+++ b/src/lib-storage/mail-user.c	Tue Oct 20 20:35:17 2009 -0400
@@ -259,6 +259,9 @@
 		return user->_home != NULL ? 1 : 0;
 	}
 
+	if (auth_master_conn == NULL)
+		return 0;
+
 	userdb_pool = pool_alloconly_create("userdb lookup", 512);
 	ret = auth_master_user_lookup(auth_master_conn, user->username,
 				      &info, userdb_pool, &username, &fields);
@@ -347,10 +350,12 @@
 
 void mail_users_init(const char *auth_socket_path, bool debug)
 {
-	auth_master_conn = auth_master_init(auth_socket_path, debug);
+	auth_master_conn = auth_socket_path == NULL ? NULL :
+		auth_master_init(auth_socket_path, debug);
 }
 
 void mail_users_deinit(void)
 {
-	auth_master_deinit(&auth_master_conn);
+	if (auth_master_conn != NULL)
+		auth_master_deinit(&auth_master_conn);
 }