Author: jpeach Date: 2005-09-08 01:05:16 +0000 (Thu, 08 Sep 2005) New Revision: 10068
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=10068 Log: Use prctl(PR_SET_DUMPABLE) to make sure we can always leave a good looking corpse on Linux. Modified: branches/SAMBA_3_0/source/configure.in branches/SAMBA_3_0/source/smbd/server.c trunk/source/configure.in trunk/source/smbd/server.c Changeset: Modified: branches/SAMBA_3_0/source/configure.in =================================================================== --- branches/SAMBA_3_0/source/configure.in 2005-09-07 21:59:18 UTC (rev 10067) +++ branches/SAMBA_3_0/source/configure.in 2005-09-08 01:05:16 UTC (rev 10068) @@ -733,7 +733,7 @@ AC_CHECK_HEADERS(aio.h arpa/inet.h sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h rpc/nettype.h) AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h memory.h alloca.h) AC_CHECK_HEADERS(rpc/rpc.h rpcsvc/nis.h rpcsvc/ypclnt.h) -AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h) +AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h sys/prctl.h) AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h stdlib.h sys/socket.h) AC_CHECK_HEADERS(sys/un.h) AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h) @@ -1160,7 +1160,16 @@ AC_CHECK_FUNCS(pread _pread __pread pread64 _pread64 __pread64) AC_CHECK_FUNCS(pwrite _pwrite __pwrite pwrite64 _pwrite64 __pwrite64) AC_CHECK_FUNCS(open64 _open64 __open64 creat64) +AC_CHECK_FUNCS(prctl) +AC_TRY_COMPILE([ +#ifdef HAVE_SYS_PRCTL_H +#include <sys/prctl.h> +#endif +], +[int i; i = prtcl(0); ], +AC_DEFINE(HAVE_PRCTL, 1, [Whether prctl is available]),[]) + # # # Modified: branches/SAMBA_3_0/source/smbd/server.c =================================================================== --- branches/SAMBA_3_0/source/smbd/server.c 2005-09-07 21:59:18 UTC (rev 10067) +++ branches/SAMBA_3_0/source/smbd/server.c 2005-09-08 01:05:16 UTC (rev 10068) @@ -22,6 +22,10 @@ #include "includes.h" +#ifdef HAVE_SYS_PRCTL_H +#include <sys/prctl.h> +#endif + static int am_parent = 1; /* the last message the was processed */ @@ -915,6 +919,14 @@ * everything after this point is run after the fork() */ +#if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE) + /* On Linux we lose the ability to dump core when we change our user + * ID. We know how to dump core safely, so let's make sure we have our + * dumpable flag set. + */ + prctl(PR_SET_DUMPABLE, 1); +#endif + /* Initialise the password backed before the global_sam_sid to ensure that we fetch from ldap before we make a domain sid up */ Modified: trunk/source/configure.in =================================================================== --- trunk/source/configure.in 2005-09-07 21:59:18 UTC (rev 10067) +++ trunk/source/configure.in 2005-09-08 01:05:16 UTC (rev 10068) @@ -732,7 +732,7 @@ AC_CHECK_HEADERS(aio.h arpa/inet.h sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h rpc/nettype.h) AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h memory.h alloca.h) AC_CHECK_HEADERS(rpc/rpc.h rpcsvc/nis.h rpcsvc/ypclnt.h) -AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h) +AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h sys/prctl.h) AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h stdlib.h sys/socket.h) AC_CHECK_HEADERS(sys/un.h) AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h) @@ -1159,7 +1159,16 @@ AC_CHECK_FUNCS(pread _pread __pread pread64 _pread64 __pread64) AC_CHECK_FUNCS(pwrite _pwrite __pwrite pwrite64 _pwrite64 __pwrite64) AC_CHECK_FUNCS(open64 _open64 __open64 creat64) +AC_CHECK_FUNCS(prctl) +AC_TRY_COMPILE([ +#ifdef HAVE_SYS_PRCTL_H +#include <sys/prctl.h> +#endif +], +[int i; i = prtcl(0); ], +AC_DEFINE(HAVE_PRCTL, 1, [Whether prctl is available]),[]) + # # # Modified: trunk/source/smbd/server.c =================================================================== --- trunk/source/smbd/server.c 2005-09-07 21:59:18 UTC (rev 10067) +++ trunk/source/smbd/server.c 2005-09-08 01:05:16 UTC (rev 10068) @@ -22,6 +22,10 @@ #include "includes.h" +#ifdef HAVE_SYS_PRCTL_H +#include <sys/prctl.h> +#endif + static int am_parent = 1; /* the last message the was processed */ @@ -912,6 +916,14 @@ * everything after this point is run after the fork() */ +#if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE) + /* On Linux we lose the ability to dump core when we change our user + * ID. We know how to dump core safely, so let's make sure we have our + * dumpable flag set. + */ + prctl(PR_SET_DUMPABLE, 1); +#endif + /* Initialise the password backed before the global_sam_sid to ensure that we fetch from ldap before we make a domain sid up */
