static const char *set_threadcount(cmd_parms * cmd, void *baton, const char *arg) { simple_core_t *sc = simple_core_get(); const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { return err; } sc->procmgr.thread_count = atoi(arg); return NULL; }
static const char *cmd_dnssd_enable_vhost( cmd_parms *cmd, AVAHI_GCC_UNUSED void *mconfig, int enable) { struct global_config_data *d = GET_CONFIG_DATA(cmd->server); const char *err; if ((err = ap_check_cmd_context(cmd, GLOBAL_ONLY))) return err; d->vhost = enable; return NULL; }
static const char *cmd_spread_logs(cmd_parms *cmd, void *dummy, int flag) { log_spread2_options *opt = ap_get_module_config(cmd->server->module_config, &log_spread2_module); const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err) { return err; } APR_OPTIONAL_FN_TYPE(ap_log_set_writer_init) *set_writer_init; APR_OPTIONAL_FN_TYPE(ap_log_set_writer) *set_writer; set_writer_init = APR_RETRIEVE_OPTIONAL_FN(ap_log_set_writer_init); set_writer = APR_RETRIEVE_OPTIONAL_FN(ap_log_set_writer); if (set_writer_init == NULL || set_writer == NULL) { return MNAME ": can't install log writer - ap_log_set_writer not available"; } SP_disconnect(opt->mbox); opt->enabled = 0; if (flag) { apr_status_t rv = SP_connect(opt->name, 0, 0, 0, &opt->mbox, opt->priv); if (rv != ACCEPT_SESSION) { ap_log_error(APLOG_MARK, APLOG_ERR, rv, cmd->server, MNAME ": could not open connection to daemon."); return NULL; } opt->old_writer_init = set_writer_init(ap_spread_log_writer_init); opt->old_writer = set_writer(ap_spread_log_writer); opt->enabled = 1; } else { if (opt->old_writer_init) { set_writer_init(opt->old_writer_init); opt->old_writer_init = NULL; } if (opt->old_writer) { set_writer(opt->old_writer); opt->old_writer = NULL; } } return NULL; }
AP_DECLARE(const char *) ap_mpm_set_accept_lock_mech(cmd_parms *cmd, void *dummy, const char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { return err; } if (!strcasecmp(arg, "default")) { ap_accept_lock_mech = APR_LOCK_DEFAULT; } #if APR_HAS_FLOCK_SERIALIZE else if (!strcasecmp(arg, "flock")) { ap_accept_lock_mech = APR_LOCK_FLOCK; } #endif #if APR_HAS_FCNTL_SERIALIZE else if (!strcasecmp(arg, "fcntl")) { ap_accept_lock_mech = APR_LOCK_FCNTL; } #endif /* perchild can't use SysV sems because the permissions on the accept * mutex can't be set to allow all processes to use the mutex and * at the same time keep all users from being able to dink with the * mutex */ #if APR_HAS_SYSVSEM_SERIALIZE && !defined(PERCHILD_MPM) else if (!strcasecmp(arg, "sysvsem")) { ap_accept_lock_mech = APR_LOCK_SYSVSEM; } #endif #if APR_HAS_POSIXSEM_SERIALIZE else if (!strcasecmp(arg, "posixsem")) { ap_accept_lock_mech = APR_LOCK_POSIXSEM; } #endif #if APR_HAS_PROC_PTHREAD_SERIALIZE else if (!strcasecmp(arg, "pthread")) { ap_accept_lock_mech = APR_LOCK_PROC_PTHREAD; } #endif else { return apr_pstrcat(cmd->pool, arg, " is an invalid mutex mechanism; ", ap_valid_accept_mutex_string, NULL); } return NULL; }
static const char *cmd_dnssd_service_type( cmd_parms *cmd, AVAHI_GCC_UNUSED void *mconfig, const char *value) { const char *err; if ((err = ap_check_cmd_context(cmd, NOT_IN_DIRECTORY|NOT_IN_FILES|NOT_IN_LIMIT))) return err; if (!avahi_is_valid_service_type_strict(value)) return "Invalid service type"; return NULL; }
/* * Command handler for the ISAPIReadAheadBuffer directive, which is TAKE1 */ static const char *isapi_cmd_readaheadbuffer(cmd_parms *cmd, void *config, char *arg) { long val; const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { return err; } if (((val = strtol(arg, (char **) &err, 10)) <= 0) || *err) return "ISAPIReadAheadBuffer must be a legitimate value."; ReadAheadBuffer = val; return NULL; }
static const char *set_threads_to_start(cmd_parms *cmd, void *dummy, const char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { return err; } ap_threads_to_start = atoi(arg); if (ap_threads_to_start < 0) { ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, "StartThreads set to a value less than 0, reset to 1"); ap_threads_to_start = 1; } return NULL; }
const char *ssl_cmd_SSLAllowEmptyFragments(cmd_parms *cmd, void *dcfg, int flag) { SSLSrvConfigRec *sc = mySrvConfig(cmd->server); const char *err; if ((err = ap_check_cmd_context(cmd, GLOBAL_ONLY))) { return err; } if ((sc->allow_empty_fragments != UNSET) && (sc->allow_empty_fragments != (BOOL)(flag ? TRUE : FALSE))) return "Conflicting SSLAllowEmptyFragments options, cannot be both On and Off"; sc->allow_empty_fragments = flag ? TRUE : FALSE; return NULL; }
const char *ap_mpm_set_pidfile(cmd_parms *cmd, void *dummy, const char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { return err; } if (cmd->server->is_virtual) { return "PidFile directive not allowed in <VirtualHost>"; } ap_pid_fname = arg; return NULL; }
static const char *set_keep_alive_timeout(cmd_parms *cmd, void *dummy, const char *arg) { apr_interval_time_t timeout; const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE); if (err != NULL) { return err; } /* Stolen from mod_proxy.c */ if (ap_timeout_parameter_parse(arg, &timeout, "s") != APR_SUCCESS) return "KeepAliveTimeout has wrong format"; cmd->server->keep_alive_timeout = timeout; return NULL; }
const char *ssl_cmd_SSLCompression(cmd_parms *cmd, void *dcfg, int flag) { #if !defined(OPENSSL_NO_COMP) SSLSrvConfigRec *sc = mySrvConfig(cmd->server); #ifndef SSL_OP_NO_COMPRESSION const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err) return "This version of openssl does not support configuring " "compression within <VirtualHost> sections."; #endif sc->compression = flag ? TRUE : FALSE; return NULL; #else return "Setting Compression mode unsupported; not implemented by the SSL library"; #endif }
AP_DECLARE(const char *) unixd_set_suexec(cmd_parms *cmd, void *dummy, int arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { return err; } if (!unixd_config.suexec_enabled && arg) { return "suEXEC isn't supported; check existence, owner, and " "file mode of " SUEXEC_BIN; } unixd_config.suexec_enabled = arg; return NULL; }
static const char *set_minuidgid (cmd_parms *cmd, void *mconfig, const char *uid, const char *gid) { UNUSED(mconfig); ruid_config_t *conf = ap_get_module_config (cmd->server->module_config, &ruid2_module); const char *err = ap_check_cmd_context (cmd, NOT_IN_DIR_LOC_FILE | NOT_IN_LIMIT); if (err != NULL) { return err; } conf->min_uid = ap_uname2id(uid); conf->min_gid = ap_gname2id(gid); return NULL; }
static const char *cmd_dnssd_service_port( cmd_parms *cmd, AVAHI_GCC_UNUSED void *mconfig, const char *value) { const char *err; int i; if ((err = ap_check_cmd_context(cmd, NOT_IN_DIRECTORY|NOT_IN_FILES|NOT_IN_LIMIT))) return err; i = atoi(value); if (i <= 0 || i > 0xFFFF) return "Invalid port number"; return NULL; }
static const char * cmd_passenger_friendly_error_pages(cmd_parms *cmd, void *pcfg, const char *arg) { const char *err = ap_check_cmd_context(cmd, NOT_IN_FILES); if (err != NULL) { return err; } DirConfig *config = (DirConfig *) pcfg; config->mFriendlyErrorPagesSourceFile = cmd->directive->filename; config->mFriendlyErrorPagesSourceLine = cmd->directive->line_num; config->mFriendlyErrorPagesExplicitlySet = true; config->mFriendlyErrorPages = (arg != NULL) ? ENABLED : DISABLED; return NULL; }
static const char * cmd_passenger_load_shell_envvars(cmd_parms *cmd, void *pcfg, const char *arg) { const char *err = ap_check_cmd_context(cmd, NOT_IN_FILES); if (err != NULL) { return err; } DirConfig *config = (DirConfig *) pcfg; config->mLoadShellEnvvarsSourceFile = cmd->directive->filename; config->mLoadShellEnvvarsSourceLine = cmd->directive->line_num; config->mLoadShellEnvvarsExplicitlySet = true; config->mLoadShellEnvvars = (arg != NULL) ? ENABLED : DISABLED; return NULL; }
static const char *set_max_requests_per_thread (cmd_parms *cmd, void *dummy, const char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { return err; } ap_max_requests_per_thread = atoi(arg); if (ap_max_requests_per_thread < 0) { ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, "WARNING: MaxRequestsPerThread was set below 0" "reset to 0, but this may not be what you want."); ap_max_requests_per_thread = 0; } return NULL; }
/*--------------------------------------------------------------------------*/ static const char *wd_cmd_watchdog_int(cmd_parms *cmd, void *dummy, const char *arg) { int i; const char *errs = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (errs != NULL) return errs; if (wd_interval_set) return "Duplicate WatchdogInterval directives are not allowed"; if ((i = atoi(arg)) < 1) return "Invalid WatchdogInterval value"; wd_interval = apr_time_from_sec(i); wd_interval_set = 1; return NULL; }
static const char *set_documentchroot (cmd_parms *cmd, void *mconfig, const char *chroot_dir, const char *document_root) { UNUSED(mconfig); ruid_config_t *conf = ap_get_module_config (cmd->server->module_config, &ruid2_module); const char *err = ap_check_cmd_context (cmd, NOT_IN_DIR_LOC_FILE | NOT_IN_LIMIT); if (err != NULL) { return err; } conf->chroot_dir = chroot_dir; conf->document_root = document_root; chroot_used |= RUID_CHROOT_USED; return NULL; }
static const char * svc_simulator_256b_set_filepath( cmd_parms * cmd, void *dummy, const char *arg) { apr_status_t status; svc_simulator_256b_config_rec_t *conf = NULL; const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if(err != NULL) { return err; } conf = (svc_simulator_256b_config_rec_t *)ap_get_module_config(cmd->server->module_config, &svc_simulator_256b_module); conf->filepath = apr_pstrdup(cmd->pool, arg); return NULL; }
const char *ssl_cmd_SSLPassPhraseDialog(cmd_parms *cmd, void *dcfg, const char *arg) { SSLSrvConfigRec *sc = mySrvConfig(cmd->server); const char *err; int arglen = strlen(arg); if ((err = ap_check_cmd_context(cmd, GLOBAL_ONLY))) { return err; } if (strcEQ(arg, "builtin")) { sc->server->pphrase_dialog_type = SSL_PPTYPE_BUILTIN; sc->server->pphrase_dialog_path = NULL; } else if ((arglen > 5) && strEQn(arg, "exec:", 5)) { sc->server->pphrase_dialog_type = SSL_PPTYPE_FILTER; sc->server->pphrase_dialog_path = ap_server_root_relative(cmd->pool, arg+5); if (!sc->server->pphrase_dialog_path) { return apr_pstrcat(cmd->pool, "Invalid SSLPassPhraseDialog exec: path ", arg+5, NULL); } if (!ssl_util_path_check(SSL_PCM_EXISTS, sc->server->pphrase_dialog_path, cmd->pool)) { return apr_pstrcat(cmd->pool, "SSLPassPhraseDialog: file '", sc->server->pphrase_dialog_path, "' does not exist", NULL); } } else if ((arglen > 1) && (arg[0] == '|')) { sc->server->pphrase_dialog_type = SSL_PPTYPE_PIPE; sc->server->pphrase_dialog_path = arg + 1; } else { return "SSLPassPhraseDialog: Invalid argument"; } return NULL; }
static const char *cmd_dnssd_user_dir_path( cmd_parms *cmd, AVAHI_GCC_UNUSED void *mconfig, const char *value) { struct global_config_data *d = GET_CONFIG_DATA(cmd->server); const char *err; if ((err = ap_check_cmd_context(cmd, GLOBAL_ONLY))) return err; if (value[0] == '~') return "Bad syntax"; d->user_dir_path = value; return NULL; }
const char *ap_mpm_set_max_mem_free(cmd_parms *cmd, void *dummy, const char *arg) { long value; const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { return err; } value = strtol(arg, NULL, 0); if (value < 0 || errno == ERANGE) return apr_pstrcat(cmd->pool, "Invalid MaxMemFree value: ", arg, NULL); ap_max_mem_free = (apr_uint32_t)value * 1024; return NULL; }
const char *ap_mpm_set_thread_stacksize(cmd_parms *cmd, void *dummy, const char *arg) { long value; const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { return err; } value = strtol(arg, NULL, 0); if (value < 0 || errno == ERANGE) return apr_pstrcat(cmd->pool, "Invalid ThreadStackSize value: ", arg, NULL); ap_thread_stacksize = (apr_size_t)value; return NULL; }
const char *ap_mpm_set_max_requests(cmd_parms *cmd, void *dummy, const char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { return err; } if (!strcasecmp(cmd->cmd->name, "MaxRequestsPerChild")) { ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, APLOGNO(00545) "MaxRequestsPerChild is deprecated, use " "MaxConnectionsPerChild instead."); } ap_max_requests_per_child = atoi(arg); return NULL; }
/* configure option functions */ static const char *set_mode (cmd_parms *cmd, void *mconfig, const char *arg) { ruid_dir_config_t *dconf = (ruid_dir_config_t *) mconfig; const char *err = ap_check_cmd_context (cmd, NOT_IN_FILES | NOT_IN_LIMIT); if (err != NULL) { return err; } if (strcasecmp(arg,"stat")==0) { dconf->ruid_mode=RUID_MODE_STAT; mode_stat_used |= RUID_MODE_STAT_USED; } else { dconf->ruid_mode=RUID_MODE_CONF; } return NULL; }
static const char *isapi_cmd_appendlogtoquery(cmd_parms *cmd, void *config, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { return err; } if (strcasecmp(arg, "on") == 0) { AppendLogToQuery = -1; } else if (strcasecmp(arg, "off") == 0) { AppendLogToQuery = 0; } else { return "ISAPIAppendLogToQuery must be on or off"; } return NULL; }
/* * Command handler for the ISAPIReadAheadBuffer directive, which is TAKE1 */ static const char *isapi_cmd_lognotsupported(cmd_parms *cmd, void *config, char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { return err; } if (strcasecmp(arg, "on") == 0) { LogNotSupported = -1; } else if (strcasecmp(arg, "off") == 0) { LogNotSupported = 0; } else { return "ISAPILogNotSupported must be on or off"; } return NULL; }
static const char *set_keep_alive(cmd_parms *cmd, void *dummy, const char *arg) { const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); if (err != NULL) { return err; } /* We've changed it to On/Off, but used to use numbers * so we accept anything but "Off" or "0" as "On" */ if (!strcasecmp(arg, "off") || !strcmp(arg, "0")) { cmd->server->keep_alive = 0; } else { cmd->server->keep_alive = 1; } return NULL; }
static const char *cmd_spread_encrypt(cmd_parms *cmd, void *dummy, const char *key) { log_spread2_options *opt = ap_get_module_config(cmd->server->module_config, &log_spread2_module); const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err) { return err; } int keylen = strlen(key) * 8; if (keylen < 56 || keylen > 448) { return "SpreadEncrpyt key too short/long (56 - 448 bit)"; } opt->key = apr_pstrdup(cmd->pool, key); return NULL; }