32#define CFG_CHECK(x) if ((x) == -1) { \
34 apr_strerror(errno, msgbuf, sizeof(msgbuf)); \
35 return apr_pstrdup(cmd->pool, msgbuf); \
37#define CR_CHECK(x, y) if (x == -1) \
38 ap_log_error(APLOG_MARK, APLOG_CRIT, errno, 0, y \
39 "Failed to initialise privileges")
41module AP_MODULE_DECLARE_DATA privileges_module;
151 if (cfg->
uid || cfg->
gid) {
154 "PRIV_ON failed restoring default user/group");
158 "Error restoring default userid");
162 "Error restoring default group");
169 "Error restoring default privileges");
220 "parent waiting for child");
246 "Failed to fork secure child process!");
257 if (cfg->
uid || cfg->
gid) {
260 "No privilege to set user/group");
267 "Error setting userid");
272 "Error setting group");
279 "Error setting effective privileges");
286 "Error setting inheritable privileges");
291 "Error setting limit privileges");
299 "Error setting permitted privileges");
306#define PDROP_CHECK(x) if (x == -1) { \
307 ap_log_error(APLOG_MARK, APLOG_CRIT, errno, s, APLOGNO(02151) \
308 "Error dropping privileges"); \
397 "mod_privileges: unable to determine MPM characteristics."
398 " Please ensure you are using a non-threaded MPM "
399 "with this module.");
403 "mod_privileges is not compatible with a threaded MPM.");
474 return "VHostCGIMode must be On, Off or Secure";
507 return "PrivilegesMode in a Directory context must be FAST or SECURE";
516 return "PrivilegesMode must be FAST, SECURE or SELECTIVE";
522#ifdef BIG_SECURITY_HOLE
527 const char *priv =
arg;
532 else if (*priv ==
'+') {
545 const char *priv =
arg;
549 else if (*priv ==
'+') {
561 "Userid under which the virtualhost will run"),
563 "Group under which the virtualhost will run"),
565 "Run in enhanced security mode (default ON)"),
567 "Enable fork+exec for this virtualhost (Off|Secure|On)"),
571 "tradeoff performance vs security (fast or secure)"),
572#ifdef BIG_SECURITY_HOLE
574 "Privileges available in the (virtual) server"),
576 "Privileges available to external programs"),
Apache Multi-Processing Module library.
static apr_pool_t * pconf
#define AP_INIT_TAKE1(directive, func, mconfig, where, help)
#define ap_get_module_config(v, m)
void ap_hook_header_parser(ap_HOOK_header_parser_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
void ap_hook_post_config(ap_HOOK_post_config_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
#define AP_DECLARE_MODULE(foo)
#define AP_INIT_FLAG(directive, func, mconfig, where, help)
#define AP_INIT_ITERATE(directive, func, mconfig, where, help)
#define ap_set_module_config(v, m, val)
void ap_hook_pre_config(ap_HOOK_pre_config_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
void ap_hook_post_read_request(ap_HOOK_post_read_request_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
void ap_hook_drop_privileges(ap_HOOK_drop_privileges_t *pf, const char *const *aszPre, const char *const *aszSucc, int nOrder)
apr_dbd_transaction_t int mode
#define APR_HOOK_REALLY_FIRST
#define HTTP_INTERNAL_SERVER_ERROR
#define STANDARD20_MODULE_STUFF
const char * ap_check_cmd_context(cmd_parms *cmd, unsigned forbidden)
const char int apr_pool_t * pool
int strcasecmp(const char *a, const char *b)
apr_int32_t apr_int32_t apr_int32_t err
int apr_exit_why_e * exitwhy
apr_status_t ap_mpm_query(int query_code, int *result)
#define AP_MPMQ_IS_THREADED
static int dtrace_enabled
static int privileges_init(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp)
static priv_set_t * priv_default
static int privileges_req(request_rec *r)
static const command_rec privileges_cmds[]
static const char * privs_mode(cmd_parms *cmd, void *dir, const char *arg)
static int privileges_drop_first(apr_pool_t *pool, server_rec *s)
static const char * vhost_secure(cmd_parms *cmd, void *dir, int arg)
static int privileges_postconf(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
static apr_status_t privileges_term(void *rec)
static priv_set_t * priv_setid
static const char * vhost_group(cmd_parms *cmd, void *dir, const char *arg)
static const char * vhost_cgimode(cmd_parms *cmd, void *dir, const char *arg)
static void * privileges_merge_cfg(apr_pool_t *pool, void *BASE, void *ADD)
static void * privileges_create_dir_cfg(apr_pool_t *pool, char *dummy)
static const char * dtraceenable(cmd_parms *cmd, void *dir, int arg)
static apr_status_t priv_cfg_cleanup(void *CFG)
static const char * vhost_user(cmd_parms *cmd, void *dir, const char *arg)
static void * privileges_create_cfg(apr_pool_t *pool, server_rec *s)
static void privileges_hooks(apr_pool_t *pool)
static int privileges_drop_last(apr_pool_t *pool, server_rec *s)
static apr_status_t privileges_end_req(void *data)
static void * privileges_merge_dir_cfg(apr_pool_t *pool, void *BASE, void *ADD)
Multi-Processing Modules functions.
A structure that represents the current request.
struct ap_conf_vector_t * request_config
struct ap_conf_vector_t * per_dir_config
A structure to store information for each virtual server.
struct ap_conf_vector_t * module_config