dovecot-2.1: lmtp: Make core dumping work also after the first m...

dovecot at dovecot.org dovecot at dovecot.org
Sat Jan 21 00:28:03 EET 2012


details:   http://hg.dovecot.org/dovecot-2.1/rev/d5ba2d63ed6d
changeset: 13977:d5ba2d63ed6d
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Jan 21 00:27:52 2012 +0200
description:
lmtp: Make core dumping work also after the first mail delivery.

diffstat:

 src/lmtp/commands.c |  5 +++++
 src/lmtp/main.c     |  4 +++-
 src/lmtp/main.h     |  2 +-
 3 files changed, 9 insertions(+), 2 deletions(-)

diffs (55 lines):

diff -r 54e74090fb42 -r d5ba2d63ed6d src/lmtp/commands.c
--- a/src/lmtp/commands.c	Fri Jan 20 22:12:48 2012 +0200
+++ b/src/lmtp/commands.c	Sat Jan 21 00:27:52 2012 +0200
@@ -11,6 +11,7 @@
 #include "ostream.h"
 #include "istream-dot.h"
 #include "safe-mkstemp.h"
+#include "restrict-access.h"
 #include "master-service.h"
 #include "rfc822-parser.h"
 #include "message-date.h"
@@ -706,6 +707,10 @@
 		   lose e.g. config connection and need to reconnect to it. */
 		if (seteuid(0) < 0)
 			i_fatal("seteuid(0) failed: %m");
+		/* enable core dumping again. we need to chdir also to
+		   root-owned directory to get core dumps. */
+		restrict_access_allow_coredumps(TRUE);
+		(void)chdir(base_dir);
 	}
 }
 
diff -r 54e74090fb42 -r d5ba2d63ed6d src/lmtp/main.c
--- a/src/lmtp/main.c	Fri Jan 20 22:12:48 2012 +0200
+++ b/src/lmtp/main.c	Sat Jan 21 00:27:52 2012 +0200
@@ -25,7 +25,7 @@
 #define IS_STANDALONE() \
         (getenv(MASTER_IS_PARENT_ENV) == NULL)
 
-const char *dns_client_socket_path;
+const char *dns_client_socket_path, *base_dir;
 struct mail_storage_service_ctx *storage_service;
 
 static void client_connected(struct master_service_connection *conn)
@@ -107,6 +107,8 @@
 		}
 	}
 
+	if (t_get_current_dir(&base_dir) < 0)
+		i_fatal("getcwd() failed: %m");
 	drop_privileges();
 	master_service_init_finish(master_service);
 	master_service_init_log(master_service,
diff -r 54e74090fb42 -r d5ba2d63ed6d src/lmtp/main.h
--- a/src/lmtp/main.h	Fri Jan 20 22:12:48 2012 +0200
+++ b/src/lmtp/main.h	Sat Jan 21 00:27:52 2012 +0200
@@ -1,7 +1,7 @@
 #ifndef MAIN_H
 #define MAIN_H
 
-extern const char *dns_client_socket_path;
+extern const char *dns_client_socket_path, *base_dir;
 extern struct mail_storage_service_ctx *storage_service;
 
 void listener_client_destroyed(void);


More information about the dovecot-cvs mailing list