Set dumpable after uid switch, if allow core dumps is set
fcntl.h \
sys/fcntl.h \
sys/stat.h \
+ sys/prctl.h \
prot.h \
sia.h \
siad.h
#include <grp.h>
#include <pwd.h>
+#ifdef HAVE_SYS_PRCTL_H
+#include <sys/prctl.h>
+#endif
#ifdef WITH_UDPFROMTO
#include "udpfromto.h"
}
switch_users();
+#ifdef HAVE_SYS_PRCTL_H
+#ifdef HAVE_PR_SET_DUMPABLE
+ if (mainconfig.allow_core_dumps) {
+ if (prctl(PR_SET_DUMPABLE, 1) < 0) {
+ radlog(L_ERR|L_CONS,"Cannot enable core dumps: prctl(PR_SET_DUMPABLE) failed: '%s'",
+ strerror(errno));
+ }
+ }
+#endif
+#endif
+
/*
* Sanity check the configuration for internal
* consistency.