dovecot-2.0: doveadm auth: Return with exit code 0 if auth succe...

dovecot at dovecot.org dovecot at dovecot.org
Wed May 26 21:20:08 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/5a875b6a5982
changeset: 11385:5a875b6a5982
user:      Timo Sirainen <tss at iki.fi>
date:      Wed May 26 19:20:04 2010 +0100
description:
doveadm auth: Return with exit code 0 if auth succeeded, 1 if failed, others if error.

diffstat:

 src/doveadm/doveadm-auth.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (48 lines):

diff -r 5e7ca577e23a -r 5a875b6a5982 src/doveadm/doveadm-auth.c
--- a/src/doveadm/doveadm-auth.c	Wed May 26 19:19:20 2010 +0100
+++ b/src/doveadm/doveadm-auth.c	Wed May 26 19:20:04 2010 +0100
@@ -19,6 +19,7 @@
 	const char *username;
 	const char *password;
 	struct auth_user_info info;
+	bool success;
 };
 
 static int
@@ -65,13 +66,14 @@
 	auth_master_deinit(&conn);
 	return ret == 0 ? 1 : 0;
 }
+
 static void
 auth_callback(struct auth_client_request *request ATTR_UNUSED,
 	      enum auth_request_status status,
 	      const char *data_base64 ATTR_UNUSED,
 	      const char *const *args, void *context)
 {
-	const struct authtest_input *input = context;
+	struct authtest_input *input = context;
 
 	if (!io_loop_is_running(current_ioloop))
 		return;
@@ -81,8 +83,10 @@
 
 	if (status < 0)
 		printf("passdb: %s auth failed\n", input->username);
-	else
+	else {
+		input->success = TRUE;
 		printf("passdb: %s auth succeeded\n", input->username);
+	}
 
 	if (*args != NULL) {
 		printf("extra fields:\n");
@@ -194,6 +198,8 @@
 		input.password = argv[optind] != NULL ? argv[optind] :
 			t_askpass("Password: ");
 		if (cmd_auth_input(auth_socket_path, &input) < 0)
+			exit(FATAL_DEFAULT);
+		if (!input.success)
 			exit(1);
 	} else {
 		bool first = TRUE;


More information about the dovecot-cvs mailing list