dovecot-2.0: lib-master: Post-login scripts can now exit to prev...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jun 14 20:51:22 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/356afa6263d4
changeset: 11543:356afa6263d4
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Jun 14 18:51:17 2010 +0100
description:
lib-master: Post-login scripts can now exit to prevent user from logging in, without logging error.

diffstat:

 src/lib-master/master-login.c |  8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diffs (41 lines):

diff -r 05700fe85e22 -r 356afa6263d4 src/lib-master/master-login.c
--- a/src/lib-master/master-login.c	Mon Jun 14 16:15:57 2010 +0100
+++ b/src/lib-master/master-login.c	Mon Jun 14 18:51:17 2010 +0100
@@ -41,6 +41,7 @@
 	struct io *io;
 	struct timeout *to;
 	string_t *input;
+	char *username;
 };
 
 struct master_login {
@@ -222,6 +223,7 @@
 	if (close(pl->fd) < 0)
 		i_error("close(postlogin) failed: %m");
 	str_free(&pl->input);
+	i_free(pl->username);
 	i_free(pl);
 }
 
@@ -255,9 +257,12 @@
 
 			i_error("fd_read(%s) failed: %m",
 				login->postlogin_socket_path);
-		} else {
+		} else if (str_len(pl->input) > 0) {
 			i_error("fd_read(%s) failed: disconnected",
 				login->postlogin_socket_path);
+		} else {
+			i_info("Post-login script denied access to user %s",
+			       pl->username);
 		}
 		master_login_client_free(&pl->client);
 		master_login_postlogin_free(pl);
@@ -325,6 +330,7 @@
 
 	pl = i_new(struct master_login_postlogin, 1);
 	pl->client = client;
+	pl->username = i_strdup(auth_args[0]);
 	pl->fd = fd;
 	pl->io = io_add(fd, IO_READ, master_login_postlogin_input, pl);
 	pl->to = timeout_add(MASTER_LOGIN_POSTLOGIN_TIMEOUT_MSECS,


More information about the dovecot-cvs mailing list