Mercurial > dovecot > original-hg > dovecot-1.2
changeset 5134:b2070dffa074 HEAD
If looking up credentials for NULL passwords, return "scheme not available"
instead of assert-crashing.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 15 Feb 2007 13:51:33 +0200 |
parents | cbc8f65d887b |
children | 1a7359d6a774 |
files | src/auth/auth-request.c src/auth/passdb-cache.c src/auth/passdb.c |
diffstat | 3 files changed, 8 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/auth/auth-request.c Thu Feb 15 13:39:27 2007 +0200 +++ b/src/auth/auth-request.c Thu Feb 15 13:51:33 2007 +0200 @@ -489,8 +489,6 @@ password = result != PASSDB_RESULT_OK ? NULL : passdb_get_credentials(request, password, scheme); - if (password == NULL && result == PASSDB_RESULT_OK) - result = PASSDB_RESULT_SCHEME_NOT_AVAILABLE; } }
--- a/src/auth/passdb-cache.c Thu Feb 15 13:39:27 2007 +0200 +++ b/src/auth/passdb-cache.c Thu Feb 15 13:51:33 2007 +0200 @@ -116,7 +116,12 @@ *result_r = PASSDB_RESULT_OK; *password_r = list[0]; *scheme_r = password_get_scheme(password_r); - i_assert(*scheme_r != NULL); + i_assert(*scheme_r != NULL || *password_r == '\0'); + + if (*password_r == '\0') { + *password_r = NULL; + *result_r = PASSDB_RESULT_SCHEME_NOT_AVAILABLE; + } return TRUE; }
--- a/src/auth/passdb.c Thu Feb 15 13:39:27 2007 +0200 +++ b/src/auth/passdb.c Thu Feb 15 13:51:33 2007 +0200 @@ -127,9 +127,9 @@ callback(result, NULL, auth_request); return; } - i_assert(password != NULL); - password = passdb_get_credentials(auth_request, password, scheme); + password = password == NULL ? NULL : + passdb_get_credentials(auth_request, password, scheme); if (password == NULL) result = PASSDB_RESULT_SCHEME_NOT_AVAILABLE; callback(result, password, auth_request);