]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lmtp: Make core dumping work also after the first mail delivery.
authorTimo Sirainen <tss@iki.fi>
Fri, 20 Jan 2012 22:27:52 +0000 (00:27 +0200)
committerTimo Sirainen <tss@iki.fi>
Fri, 20 Jan 2012 22:27:52 +0000 (00:27 +0200)
src/lmtp/commands.c
src/lmtp/main.c
src/lmtp/main.h

index 9a22841b494cdc76b4ec0b94dbfabc76bb691333..7d073d2f7975244c81ca20cc3a561db3cc6102f2 100644 (file)
@@ -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 @@ client_input_data_write_local(struct client *client, struct istream *input)
                   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);
        }
 }
 
index b375a887117f9e342ee9b44bb7793d7b48aea249..305e90a6a5a2366f5a4c4df4418964bb218b6fe5 100644 (file)
@@ -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 @@ int main(int argc, char *argv[])
                }
        }
 
+       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,
index 9aae739ce9940f3c0ed4494741436b361d2e0b67..8547032466d9ed0c9c2ffd399235567a0ef4b114 100644 (file)
@@ -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);