if (user->remote_ip != NULL)
info.remote_ip = *user->remote_ip;
- if (mail_user_auth_master_conn == NULL)
- return 0;
-
userdb_pool = pool_alloconly_create("userdb lookup", 2048);
ret = auth_master_user_lookup(mail_user_auth_master_conn,
user->username, &info, userdb_pool,
return user->_home != NULL ? 1 : 0;
}
- ret = mail_user_userdb_lookup_home(user);
- if (ret < 0)
+ if (mail_user_auth_master_conn == NULL) {
+ /* no userdb connection. we can only use mail_home setting. */
+ user->_home = user->set->mail_home;
+ } else if ((ret = mail_user_userdb_lookup_home(user)) < 0) {
+ /* userdb lookup failed */
return -1;
-
- if (ret > 0 && user->_home == NULL && *user->set->mail_home != '\0') {
- /* no home in userdb, fallback to mail_home setting */
+ } else if (ret == 0) {
+ /* user doesn't exist */
+ user->nonexistent = TRUE;
+ } else if (user->_home == NULL && *user->set->mail_home != '\0') {
+ /* no home returned by userdb lookup, fallback to mail_home
+ setting. */
user->_home = user->set->mail_home;
}
user->home_looked_up = TRUE;
/* Module-specific contexts. See mail_storage_module_id. */
ARRAY_DEFINE(module_contexts, union mail_user_module_context *);
+ /* User doesn't exist (as reported by userdb lookup when looking
+ up home) */
+ unsigned int nonexistent:1;
/* Either home is set or there is no home for the user. */
unsigned int home_looked_up:1;
/* User is an administrator. Allow operations not normally allowed