svn commit: samba r22318 - in branches: SAMBA_3_0/source/lib SAMBA_3_0_25/source/lib

lmuelle at samba.org lmuelle at samba.org
Tue Apr 17 17:17:20 GMT 2007


Author: lmuelle
Date: 2007-04-17 17:17:19 +0000 (Tue, 17 Apr 2007)
New Revision: 22318

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=22318

Log:
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.

Modified:
   branches/SAMBA_3_0/source/lib/fault.c
   branches/SAMBA_3_0_25/source/lib/fault.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/fault.c
===================================================================
--- branches/SAMBA_3_0/source/lib/fault.c	2007-04-17 17:07:14 UTC (rev 22317)
+++ branches/SAMBA_3_0/source/lib/fault.c	2007-04-17 17:17:19 UTC (rev 22318)
@@ -161,6 +161,13 @@
 	}
 
 #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.

Modified: branches/SAMBA_3_0_25/source/lib/fault.c
===================================================================
--- branches/SAMBA_3_0_25/source/lib/fault.c	2007-04-17 17:07:14 UTC (rev 22317)
+++ branches/SAMBA_3_0_25/source/lib/fault.c	2007-04-17 17:17:19 UTC (rev 22318)
@@ -161,6 +161,13 @@
 	}
 
 #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.



More information about the samba-cvs mailing list