]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: Don't crash if passwd-file is used for authentication but it has no passwords.
authorTimo Sirainen <tss@iki.fi>
Sat, 16 Nov 2013 15:46:10 +0000 (17:46 +0200)
committerTimo Sirainen <tss@iki.fi>
Sat, 16 Nov 2013 15:46:10 +0000 (17:46 +0200)
src/auth/passdb-passwd-file.c

index 24ed2b8cfe4fd240b93c08aa134c9979a39030a6..c2c8c82772eb6e2623761da423f0a203847e9096 100644 (file)
@@ -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);