Mercurial > dovecot > core-2.2
changeset 18274:bcad7792a0fc
lib-auth: auth_master_pass/user_lookup() now returns -2 for user-specific errors.
Compared to -1 which are about a more generic error with auth process
communication. If -2 is returned the lookup could still succeed for another
user.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 25 Feb 2015 15:05:22 +0200 |
parents | c2e46b4df488 |
children | c398321df8f5 |
files | src/doveadm/doveadm-auth.c src/lib-auth/auth-master.c src/lib-auth/auth-master.h |
diffstat | 3 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/doveadm/doveadm-auth.c Tue Feb 24 18:42:43 2015 +0200 +++ b/src/doveadm/doveadm-auth.c Wed Feb 25 15:05:22 2015 +0200 @@ -67,6 +67,7 @@ i_error("%s failed for %s: %s", lookup_name, input->username, fields[0]); } + ret = -1; } else if (ret == 0) { fprintf(show_field == NULL ? stdout : stderr, "%s: user %s doesn't exist\n", lookup_name,
--- a/src/lib-auth/auth-master.c Tue Feb 24 18:42:43 2015 +0200 +++ b/src/lib-auth/auth-master.c Wed Feb 25 15:05:22 2015 +0200 @@ -155,7 +155,7 @@ i_debug("user %s: Auth %s lookup returned temporary failure: %s", user, expected_reply, *args); } - return -1; + return -2; } i_error("Unknown reply: %s", cmd); return -1; @@ -511,7 +511,7 @@ p_new(pool, const char *, 1); if (ctx.return_value > 0) { i_error("Userdb lookup didn't return username"); - ctx.return_value = -1; + ctx.return_value = -2; } } else { *username_r = ctx.fields[0];
--- a/src/lib-auth/auth-master.h Tue Feb 24 18:42:43 2015 +0200 +++ b/src/lib-auth/auth-master.h Wed Feb 25 15:05:22 2015 +0200 @@ -31,9 +31,9 @@ /* Returns the auth_socket_path */ const char *auth_master_get_socket_path(struct auth_master_connection *conn); -/* Do a USER lookup. Returns -1 = error, 0 = user not found, 1 = ok. - When returning -1 and fields[0] isn't NULL, it contains an error message - that should be shown to user. */ +/* Do a USER lookup. Returns -2 = user-specific error, -1 = internal error, + 0 = user not found, 1 = ok. When returning -1 and fields[0] isn't NULL, it + contains an error message that should be shown to user. */ int auth_master_user_lookup(struct auth_master_connection *conn, const char *user, const struct auth_user_info *info, pool_t pool, const char **username_r,