--- src/support/suexec.c 2003-03-05 15:50:29.000000000 +0000 +++ src/support/suexec.c 2003-10-15 16:17:51.000000000 +0100 @@ -84,6 +84,7 @@ * debug: Self-explanatory */ +#include #include "ap_config.h" #include #include @@ -264,6 +265,7 @@ int main(int argc, char *argv[]) { + struct rlimit rlim; /* agl - for setting rlimits */ int userdir = 0; /* ~userdir flag */ uid_t uid; /* user information */ gid_t gid; /* target group placeholder */ @@ -478,6 +480,21 @@ exit(108); } + // agl Mon Oct 13 20:06:06 BST 2003 + // Add arbitary resource limits that I've picked out of thin air + // in effort to stop CGI scripts buggering the server too hard + +#define LIM(x,y) rlim.rlim_cur = y; rlim.rlim_max = y; setrlimit (x, &rlim); + LIM (RLIMIT_CPU, 30); + LIM (RLIMIT_DATA, 64 * 1024 * 1024); + LIM (RLIMIT_FSIZE, 64 * 1024 * 1024); + LIM (RLIMIT_LOCKS, 32); + LIM (RLIMIT_MEMLOCK, 32 * 1024); + LIM (RLIMIT_NOFILE, 256); + LIM (RLIMIT_NPROC, 5); + LIM (RLIMIT_STACK, 32 * 1024 * 1024); +#undef LIM + /* * Change UID/GID here so that the following tests work over NFS. *