args = t_strsplit(line, ":");
if (args[1] != NULL) {
/* at least two fields */
- passwd_file_add(pw, args[0], args[1], args+2);
+ const char *no_args = NULL;
+ passwd_file_add(pw, args[0], args[1],
+ pw->userdb ? args+2 : &no_args);
}
t_pop();
}
}
}
-struct passwd_file *db_passwd_file_parse(const char *path)
+struct passwd_file *db_passwd_file_parse(const char *path, int userdb)
{
struct passwd_file *pw;
pw = i_new(struct passwd_file, 1);
pw->refcount = 1;
pw->path = i_strdup(path);
+ pw->userdb = userdb;
passwd_file_open(pw);
return pw;
char *path;
time_t stamp;
int fd;
+ int userdb;
struct hash_table *users;
};
struct passwd_user *
db_passwd_file_lookup(struct passwd_file *pw, const char *user);
-struct passwd_file *db_passwd_file_parse(const char *path);
+struct passwd_file *db_passwd_file_parse(const char *path, int userdb);
void db_passwd_file_unref(struct passwd_file *pw);
#endif
{
if (passdb_pwf != NULL && strcmp(passdb_pwf->path, args) == 0) {
userdb_pwf = passdb_pwf;
- userdb_pwf->refcount++;
+ userdb_pwf->refcount++;
+
+ /* resync */
+ userdb_pwf->userdb = FALSE;
+ userdb_pwf->stamp = 0;
} else {
- userdb_pwf = db_passwd_file_parse(args);
+ userdb_pwf = db_passwd_file_parse(args, TRUE);
}
}