PR 51714. [Stefan Fritsch, Jim Jagielski, Ruediger Pluem, Eric Covener,
<lowprio20 gmail.com>]
+ *) Fix cross-compilation of mod_cgi/mod_cgid when APR_HAVE_STRUCT_RLIMIT is
+ false but RLIMIT_* are defined. PR51371. [Eric Covener]
+
*) core: Correctly obey ServerName / ServerAlias if the Host header from the
request matches the VirtualHost address.
PR 51709. [Micha Lenk <micha lenk.info>]
#include "mod_core.h"
#include "mod_cgi.h"
+#if APR_HAVE_STRUCT_RLIMIT
+#if defined (RLIMIT_CPU) || defined (RLIMIT_NPROC) || defined (RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_AS)
+#define AP_CGI_USE_RLIMIT
+#endif
+#endif
+
module AP_MODULE_DECLARE_DATA cgi_module;
static APR_OPTIONAL_FN_TYPE(ap_register_include_handler) *cgi_pfn_reg_with_ssi;
apr_proc_t *procnew;
apr_status_t rc = APR_SUCCESS;
-#if defined(RLIMIT_CPU) || defined(RLIMIT_NPROC) || \
- defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined (RLIMIT_AS)
-
+#ifdef AP_CGI_USE_RLIMIT
core_dir_config *conf = ap_get_core_module_config(r->per_dir_config);
#endif
((rc = apr_procattr_dir_set(procattr,
ap_make_dirstr_parent(r->pool,
r->filename))) != APR_SUCCESS) ||
-#ifdef RLIMIT_CPU
+#if defined(RLIMIT_CPU) && defined(AP_CGI_USE_RLIMIT)
((rc = apr_procattr_limit_set(procattr, APR_LIMIT_CPU,
conf->limit_cpu)) != APR_SUCCESS) ||
#endif
-#if defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_AS)
+#if defined(AP_CGI_USE_RLIMIT) && (defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_AS))
((rc = apr_procattr_limit_set(procattr, APR_LIMIT_MEM,
conf->limit_mem)) != APR_SUCCESS) ||
#endif
-#ifdef RLIMIT_NPROC
+#if RLIMIT_NPROC && defined(AP_CGI_USE_RLIMIT)
((rc = apr_procattr_limit_set(procattr, APR_LIMIT_NPROC,
conf->limit_nproc)) != APR_SUCCESS) ||
#endif
#include <sys/stat.h>
#include <sys/un.h> /* for sockaddr_un */
+#if APR_HAVE_STRUCT_RLIMIT
+#if defined (RLIMIT_CPU) || defined (RLIMIT_NPROC) || defined (RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_AS)
+#define AP_CGID_USE_RLIMIT
+#endif
+#endif
module AP_MODULE_DECLARE_DATA cgid_module;
int bufbytes;
} cgid_server_conf;
-#if defined (RLIMIT_CPU) || defined (RLIMIT_NPROC) || defined (RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_AS)
+#ifdef AP_CGID_USE_RLIMIT
typedef struct {
#ifdef RLIMIT_CPU
int limit_cpu_set;
apr_size_t args_len;
int loglevel; /* to stuff in server_rec */
-#if defined (RLIMIT_CPU) || defined (RLIMIT_NPROC) || defined (RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_AS)
+#ifdef AP_CGID_USE_RLIMIT
cgid_rlimit_t limits;
#endif
} cgid_req_t;
}
*env = environ;
-#if defined (RLIMIT_CPU) || defined (RLIMIT_NPROC) || defined (RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_AS)
+#ifdef AP_CGID_USE_RLIMIT
if ((stat = sock_read(fd, &(req->limits), sizeof(cgid_rlimit_t))) != APR_SUCCESS)
return stat;
#endif
return stat;
}
}
-#ifdef RLIMIT_CPU
+#if defined(RLIMIT_CPU) && defined(AP_CGID_USE_RLIMIT)
if (core_conf->limit_cpu) {
req.limits.limit_cpu = *(core_conf->limit_cpu);
req.limits.limit_cpu_set = 1;
}
#endif
-#if defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_AS)
+#if defined(AP_CGID_USE_RLIMIT) && (defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_AS))
if (core_conf->limit_mem) {
req.limits.limit_mem = *(core_conf->limit_mem);
req.limits.limit_mem_set = 1;
#endif
-#ifdef RLIMIT_NPROC
+#if defined(RLIMIT_NPROC) && defined(AP_CGID_USE_RLIMIT)
if (core_conf->limit_nproc) {
req.limits.limit_nproc = *(core_conf->limit_nproc);
req.limits.limit_nproc_set = 1;
}
#endif
-#if defined (RLIMIT_CPU) || defined (RLIMIT_NPROC) || defined (RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_AS)
+#ifdef AP_CGID_USE_RLIMIT
if ( (stat = sock_write(fd, &(req.limits), sizeof(cgid_rlimit_t))) != APR_SUCCESS)
return stat;
#endif
((rc = apr_procattr_dir_set(procattr,
ap_make_dirstr_parent(r->pool, r->filename))) != APR_SUCCESS) ||
((rc = apr_procattr_cmdtype_set(procattr, cmd_type)) != APR_SUCCESS) ||
+#ifdef AP_CGID_USE_RLIMIT
#ifdef RLIMIT_CPU
( (cgid_req.limits.limit_cpu_set) && ((rc = apr_procattr_limit_set(procattr, APR_LIMIT_CPU,
&cgid_req.limits.limit_cpu)) != APR_SUCCESS)) ||
#ifdef RLIMIT_NPROC
( (cgid_req.limits.limit_nproc_set) && ((rc = apr_procattr_limit_set(procattr, APR_LIMIT_NPROC,
&cgid_req.limits.limit_nproc)) != APR_SUCCESS)) ||
+#endif
#endif
((rc = apr_procattr_child_errfn_set(procattr, cgid_child_errfn)) != APR_SUCCESS)) {