summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorLars Müller <lmuelle@samba.org>2007-04-17 17:17:19 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:19:26 -0500
commitffc03ada718225e93a6ec85f25838ac35598c0b0 (patch)
tree10cfecd907c55da58d34fd2ca28086e1c759b29a /source3
parent123e721590ef604bfd7fc1a07aaed3bdefa5f16f (diff)
downloadsamba-ffc03ada718225e93a6ec85f25838ac35598c0b0.tar.gz
samba-ffc03ada718225e93a6ec85f25838ac35598c0b0.tar.bz2
samba-ffc03ada718225e93a6ec85f25838ac35598c0b0.zip
r22318: If we're running as non root we might not be able to dump the core file
to the corepath. Even the chdir() will fail if the LOGFILEBASE path is set 0700. If the currrent user doesn't have the permission to create the core file we end with: unable to change to <LOGFILEBASE> refusing to dump core The alternative would be to change the permissions of the directory. But taht would not ensure core dumps are working out of the box. (This used to be commit 0814a3acbe0fe40badf88690ab61d8ad106419d6)
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/fault.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source3/lib/fault.c b/source3/lib/fault.c
index b214d9027e..26b48a80cd 100644
--- a/source3/lib/fault.c
+++ b/source3/lib/fault.c
@@ -161,6 +161,13 @@ void dump_core_setup(const char *progname)
}
#if DUMP_CORE
+ /* If we're running as non root we might not be able to dump the core
+ * file to the corepath. There must not be an unbecome_root() before
+ * we call abort(). */
+ if (getuid() != 0) {
+ become_root();
+ }
+
if (*corepath != '\0') {
/* The chdir might fail if we dump core before we finish
* processing the config file.