dovecot-2.2: lib-auth: auth_master_pass/user_lookup() now return...

dovecot at dovecot.org dovecot at dovecot.org
Wed Feb 25 13:10:18 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/bcad7792a0fc
changeset: 18274:bcad7792a0fc
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Feb 25 15:05:22 2015 +0200
description:
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.

diffstat:

 src/doveadm/doveadm-auth.c |  1 +
 src/lib-auth/auth-master.c |  4 ++--
 src/lib-auth/auth-master.h |  6 +++---
 3 files changed, 6 insertions(+), 5 deletions(-)

diffs (48 lines):

diff -r c2e46b4df488 -r bcad7792a0fc src/doveadm/doveadm-auth.c
--- 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,
diff -r c2e46b4df488 -r bcad7792a0fc src/lib-auth/auth-master.c
--- 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];
diff -r c2e46b4df488 -r bcad7792a0fc src/lib-auth/auth-master.h
--- 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,


More information about the dovecot-cvs mailing list