From 83e7db71cc342bb178d03ad6875b581d8c265104 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sat, 16 Nov 2013 17:46:10 +0200 Subject: [PATCH] auth: Don't crash if passwd-file is used for authentication but it has no passwords. --- src/auth/passdb-passwd-file.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/auth/passdb-passwd-file.c b/src/auth/passdb-passwd-file.c index 24ed2b8cfe..c2c8c82772 100644 --- a/src/auth/passdb-passwd-file.c +++ b/src/auth/passdb-passwd-file.c @@ -28,16 +28,14 @@ static void passwd_file_save_results(struct auth_request *request, string_t *str; char **p; - *crypted_pass_r = pu->password; + *crypted_pass_r = pu->password != NULL ? pu->password : ""; *scheme_r = password_get_scheme(crypted_pass_r); if (*scheme_r == NULL) *scheme_r = request->passdb->passdb->default_pass_scheme; /* save the password so cache can use it */ - if (*crypted_pass_r != NULL) { - auth_request_set_field(request, "password", - *crypted_pass_r, *scheme_r); - } + auth_request_set_field(request, "password", + *crypted_pass_r, *scheme_r); if (pu->extra_fields != NULL) { str = t_str_new(512); -- 2.47.3