Mercurial > dovecot > original-hg > dovecot-1.2
changeset 5290:9b3029f06521 HEAD
If passwd-file wasn't found, don't crash.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 11 Mar 2007 23:03:15 +0200 |
parents | f9b1c0f5bff4 |
children | 41b80786c06f |
files | src/auth/db-passwd-file.c |
diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/auth/db-passwd-file.c Sun Mar 11 21:10:02 2007 +0200 +++ b/src/auth/db-passwd-file.c Sun Mar 11 23:03:15 2007 +0200 @@ -242,7 +242,8 @@ if (errno != ENOENT) i_error("passwd-file %s: stat() failed: %m", pw->path); - passwd_file_free(pw); + if (pw->db->default_file != pw) + passwd_file_free(pw); return FALSE; } @@ -389,7 +390,7 @@ { struct passwd_file *pw; struct passwd_user *pu; - const char *username; + const char *username, *path; if (!db->vars) pw = db->default_file; @@ -412,13 +413,16 @@ t_pop(); } + t_push(); + path = t_strdup(pw->path); if (!passwd_file_sync(pw)) { + /* pw may be freed now */ auth_request_log_info(request, "passwd-file", - "no passwd file: %s", pw->path); + "no passwd file: %s", path); + t_pop(); return NULL; } - t_push(); username = !db->domain_var ? request->user : t_strcut(request->user, '@');