dovecot-2.0: script: Close extra fds before executing post-login...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Dec 14 03:48:49 EET 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/484be10242a7
changeset: 10471:484be10242a7
user: Timo Sirainen <tss at iki.fi>
date: Sun Dec 13 20:47:38 2009 -0500
description:
script: Close extra fds before executing post-login script.
diffstat:
1 file changed, 10 insertions(+), 1 deletion(-)
src/util/script.c | 11 ++++++++++-
diffs (28 lines):
diff -r 20d54d23785a -r 484be10242a7 src/util/script.c
--- a/src/util/script.c Sun Dec 13 20:26:31 2009 -0500
+++ b/src/util/script.c Sun Dec 13 20:47:38 2009 -0500
@@ -30,7 +30,7 @@ static void client_connected(const struc
struct mail_storage_service_input input;
struct mail_storage_service_user *user;
char buf[1024];
- unsigned int i;
+ unsigned int i, socket_count;
int fd = -1;
ssize_t ret;
@@ -106,6 +106,15 @@ static void client_connected(const struc
if (dup2(conn->fd, SCRIPT_COMM_FD) < 0)
i_fatal("dup2() failed: %m");
}
+
+ /* close all listener sockets */
+ socket_count = master_service_get_socket_count(master_service);
+ for (i = 0; i < socket_count; i++) {
+ if (close(MASTER_LISTEN_FD_FIRST + i) < 0)
+ i_error("close(listener) failed: %m");
+ }
+ if (close(MASTER_STATUS_FD) < 0)
+ i_error("close(status) failed: %m");
(void)execvp(exec_args[0], exec_args);
i_fatal("execvp(%s) failed: %m", exec_args[0]);
More information about the dovecot-cvs
mailing list