From: Timo Sirainen Date: Sat, 16 Nov 2013 15:46:10 +0000 (+0200) Subject: auth: Don't crash if passwd-file is used for authentication but it has no passwords. X-Git-Tag: 2.2.8~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=83e7db71cc342bb178d03ad6875b581d8c265104;p=thirdparty%2Fdovecot%2Fcore.git auth: Don't crash if passwd-file is used for authentication but it has no passwords. --- 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);