servers = memcached_server_list_append(NULL, w1, port, &r);
  if(r!=MEMCACHED_SUCCESS) return "memcached_server_list_append() failed.";

  r = memcached_server_push(conf->memc, servers);
  if(r!=MEMCACHED_SUCCESS) {
    memcached_server_list_free(servers);
    return "memcached_server_push() failed.";
  }
  memcached_server_list_free(servers);

  return NULL;
}

static const command_rec config_cmds[] = {
  AP_INIT_FLAG(X_RESIZE, (cmd_func)ap_set_flag_slot, (void*)APR_OFFSETOF(resize_conf, enabled), OR_OPTIONS, "{On|Off}"),
  AP_INIT_TAKE2(RESIZE "-cache",  (cmd_func)append_server, NULL, OR_OPTIONS, "server, port"),
  AP_INIT_TAKE1(RESIZE "-expire", (cmd_func)ap_set_int_slot, (void*)APR_OFFSETOF(resize_conf, expire), OR_OPTIONS, "expire(sec)"),
  AP_INIT_TAKE1(RESIZE "-quality", (cmd_func)ap_set_int_slot, (void*)APR_OFFSETOF(resize_conf, jpeg_quality), OR_OPTIONS, "JPEG quality(~100)"),
  { NULL },
};

static void register_hooks(apr_pool_t *p)
{
  ap_register_output_filter(X_RESIZE, resize_output_filter, NULL, AP_FTYPE_CONTENT_SET);
  ap_hook_insert_filter(resize_insert_output_filter, NULL, NULL, APR_HOOK_FIRST);
}


// Dispatch list for API hooks.
module AP_MODULE_DECLARE_DATA resizeimage_module = {
  STANDARD20_MODULE_STUFF, 
Beispiel #2
0
  AP_INIT_TAKE1("CDNAuthAlt", set_auth_alt, NULL,
                RSRC_CONF | ACCESS_CONF,
                "Alternate redirection URL for failed authentications"),
  AP_INIT_TAKE1("CDNAuthExpire", ap_set_int_slot,
                (void *) APR_OFFSETOF(cdn_conf, auth_exptime),
                RSRC_CONF | ACCESS_CONF, "Set default expiration time for generated authentication tokens"),
  AP_INIT_FLAG("CDNHTMLAddAuthTokens", ap_set_flag_slot,
               (void *)APR_OFFSETOF(cdn_conf, global_auth),
               RSRC_CONF | ACCESS_CONF,
               "Add authentication tokens to all matching URLs"),

  AP_INIT_TAKE1("CDNIgnoreTokenName", set_ignore_token, NULL,
                RSRC_CONF | ACCESS_CONF,
                "Set the name of the ignore token argument to be added to query strings"),
  AP_INIT_TAKE2("CDNHTMLIgnoreTokenLocation", set_ignore_token_location, NULL,
                RSRC_CONF | ACCESS_CONF,
                "Set the location in the query string to insert an ignore token"),
  AP_INIT_FLAG("CDNHTMLAddIgnoreTokens", ap_set_flag_slot,
               (void *)APR_OFFSETOF(cdn_conf, global_qstring_ignore),
               RSRC_CONF | ACCESS_CONF,
               "Add ignore tokens to the query strings of all matching URLs"),

  AP_INIT_RAW_ARGS("CDNActAsOrigin", set_act_as_origin, NULL,
                   RSRC_CONF | ACCESS_CONF,
                   "Set proper origin headers for matching requests"),

  AP_INIT_TAKE1("CDNDefaultExpire", ap_set_int_slot,
                (void *)APR_OFFSETOF(cdn_conf, default_exptime),
                RSRC_CONF | ACCESS_CONF,
                "Set default expiration time for originified responses"),
  {NULL}
Beispiel #3
0
                              apr_pool_cleanup_null, s->process->pool);
    }

    return OK;
}
#undef SUEXEC_POST_CONFIG_USERDATA

/*
 * Define the directives specific to this module.  This structure is referenced
 * later by the 'module' structure.
 */
static const command_rec suexec_cmds[] =
{
    /* XXX - Another important reason not to allow this in .htaccess is that
     * the ap_[ug]name2id() is not thread-safe */
    AP_INIT_TAKE2("SuexecUserGroup", set_suexec_ugid, NULL, RSRC_CONF,
      "User and group for spawned processes"),
    { NULL }
};

static void suexec_hooks(apr_pool_t *p)
{
    ap_hook_get_suexec_identity(get_suexec_id_doer,NULL,NULL,APR_HOOK_MIDDLE);
    ap_hook_post_config(suexec_post_config,NULL,NULL,APR_HOOK_MIDDLE);
}

module AP_MODULE_DECLARE_DATA suexec_module =
{
    STANDARD20_MODULE_STUFF,
    create_mconfig_for_directory,   /* create per-dir config */
    NULL,                       /* merge per-dir config */
    create_mconfig_for_server,  /* server config */
Beispiel #4
0
}


/* Setup of the available httpd.conf configuration commands.
 * Structure: command, function called, NULL, where available, how many arguments, verbose description
 */
static const command_rec log_sql_cmds[] = {
	AP_INIT_FLAG("LogSQLAnnounce", set_global_flag_slot,
	 (void *)APR_OFFSETOF(global_config_t, announce), RSRC_CONF,
	 "Whether to announce that mod_log_sql is loaded in the server header")
	,
	/* DB connection parameters */
	AP_INIT_TAKE13("LogSQLLoginInfo", set_log_sql_info, NULL, RSRC_CONF,
	 "The database connection URI in the form "driver://user:password@hostname:port/database"")
	,
	AP_INIT_TAKE2("LogSQLDBParam", set_dbparam, NULL, RSRC_CONF,
	 "First argument is the DB parameter, second is the value to assign")
	,
	AP_INIT_FLAG("LogSQLForcePreserve", set_global_flag_slot,
	 (void *)APR_OFFSETOF(global_config_t, forcepreserve), RSRC_CONF,
	 "Forces logging to preserve file and bypasses database")
	,
	AP_INIT_FLAG("LogSQLDisablePreserve", set_global_flag_slot,
	 (void *)APR_OFFSETOF(global_config_t, disablepreserve), RSRC_CONF,
	 "Completely disables use of the preserve file")
	,
	AP_INIT_TAKE1("LogSQLPreserveFile", set_server_file_slot,
	 (void *)APR_OFFSETOF(logsql_state,preserve_file), RSRC_CONF,
	 "Name of the file to use for data preservation during database downtime")
	,
	AP_INIT_FLAG("LogSQLCreateTables", set_global_nmv_flag_slot,
	 (void *)APR_OFFSETOF(global_config_t, createtables), RSRC_CONF,
Beispiel #5
0
                 "WARNING: LoadModule not supported on this platform");
    return NULL;
}

#endif /* NO_DLOPEN */

static void register_hooks(apr_pool_t *p)
{
#ifndef NO_DLOPEN
    APR_REGISTER_OPTIONAL_FN(ap_find_loaded_module_symbol);
    ap_hook_test_config(dump_loaded_modules, NULL, NULL, APR_HOOK_MIDDLE);
#endif
}

static const command_rec so_cmds[] = {
    AP_INIT_TAKE2("LoadModule", load_module, NULL, RSRC_CONF | EXEC_ON_READ,
      "a module name and the name of a shared object file to load it from"),
    AP_INIT_ITERATE("LoadFile", load_file, NULL, RSRC_CONF  | EXEC_ON_READ,
      "shared object file or library to load into the server at runtime"),
    { NULL }
};

module AP_MODULE_DECLARE_DATA so_module = {
   STANDARD20_MODULE_STUFF,
   NULL,                 /* create per-dir config */
   NULL,                 /* merge per-dir config */
   so_sconf_create,      /* server config */
   NULL,                 /* merge server config */
   so_cmds,              /* command apr_table_t */
   register_hooks        /* register hooks */
};
    long cpurate = strtol(rate, (char **) NULL, 10);
    mrm_config_t *conf = ap_get_module_config(cmd->server->module_config, &resource_manager_module);
    conf->cpurate = cpurate;
    conf->host = apr_pstrdup(cmd->pool, target_host);
    return NULL;
}

static void register_hooks(apr_pool_t *p)
{   
    ap_hook_post_config(resource_manager_init, NULL, NULL, APR_HOOK_MIDDLE);
    ap_hook_handler(resource_manager_atached, NULL, NULL, APR_HOOK_REALLY_FIRST);
    ap_hook_log_transaction(resource_manager_detached, NULL, NULL, APR_HOOK_MIDDLE);
}

static const command_rec resource_manager_cmds[] = {

    AP_INIT_TAKE2("ResourceManagedCPU", set_resource_manager, NULL, RSRC_CONF | ACCESS_CONF, "resource managed host."),
    AP_INIT_TAKE1("ResourceManagedmruby", set_resource_manager_mruby, NULL, RSRC_CONF | ACCESS_CONF, "resource management by mruby."),
    {NULL}
};

module AP_MODULE_DECLARE_DATA resource_manager_module = {
    STANDARD20_MODULE_STUFF,
    NULL,                               /* dir config creater */
    NULL,                               /* dir merger */
    resource_manager_create_config,     /* server config */
    NULL,                               /* merge server config */
    resource_manager_cmds,              /* command apr_table_t */
    register_hooks                      /* register hooks */
};
#include "http_config.h"
#include "http_protocol.h"
#include "ap_config.h"

static const char *php_void_apache_value_handler(cmd_parms *cmd,
                                                 void *dummy,
                                                 const char *name,
                                                 const char *value)
{
    return NULL;
}

/* SEE ALSO http://blog.endflow.net/?lang=ja&p=48 */
const command_rec php_void_dir_cmds[] =
{
    AP_INIT_TAKE2("php_value",       php_void_apache_value_handler, NULL, OR_OPTIONS, "PHP Value Modifier"),
    AP_INIT_TAKE2("php_flag",        php_void_apache_value_handler, NULL, OR_OPTIONS, "PHP Flag Modifier"),
    {NULL}
};

/* Dispatch list for API hooks */
module AP_MODULE_DECLARE_DATA php_void_module = {
    STANDARD20_MODULE_STUFF,
    NULL,                    /* create per-dir    config structures */
    NULL,                    /* merge  per-dir    config structures */
    NULL,                    /* create per-server config structures */
    NULL,                    /* merge  per-server config structures */
    php_void_dir_cmds,       /* table of config file commands       */
    NULL                     /* register hooks                      */
};
Beispiel #8
0
	
/* The content handler function. This is the main function of Wodan2 */
static int wodan2_handler(request_rec *r);

/**
 * The configuration directives and their setup functions.
 */
static const command_rec wodan2_commands[] = 
{
	AP_INIT_TAKE12("WodanPass", add_pass, NULL, RSRC_CONF, "A path and a URL"),
	AP_INIT_TAKE12("WodanPassReverse", add_pass_reverse, 
		NULL, RSRC_CONF, "A path and a URL"),
	AP_INIT_TAKE1("WodanCacheDir", add_cachedir, NULL, RSRC_CONF, "A path"),
	AP_INIT_TAKE1("WodanCacheDirLevels", add_cachedir_levels, NULL, RSRC_CONF, 
		"A Number (> 0)"),
	AP_INIT_TAKE2("WodanDefaultCacheTime", add_default_cachetime, NULL, RSRC_CONF,
		"A path and a time string"),
	AP_INIT_TAKE2("WodanDefaultCacheTimeMatch", add_default_cachetime_regex,
		NULL, RSRC_CONF, "A regex pattern and a time string"),
	AP_INIT_TAKE3("WodanDefaultCacheTimeHeaderMatch", 
		add_default_cachetime_header, NULL, RSRC_CONF, 
		"A header, a regex pattern and a time string"),
	AP_INIT_FLAG("WodanRunOnCache", add_run_on_cache, NULL, RSRC_CONF,
		"run completely on cache"),
	AP_INIT_FLAG("WodanCache404s", add_cache_404s, NULL, RSRC_CONF,
		"cache 404 pages"),
	AP_INIT_TAKE1("WodanBackendTimeout", add_backend_timeout, NULL, RSRC_CONF,
		"a number, which represents a time in miliseconds"),
	{NULL}
};
/* The module. Apache uses this information to initialise and hook up
 * the module into the webserver. */
    apache_http_modsecurity_loc_conf_t *cf = (apache_http_modsecurity_loc_conf_t *)cfg;    
    if(cf == NULL){
    	return "ModSecurity's remote_server processing directive didn't get an instance of the Apache config, we can't continue";
    }
    // Add checks here for p1 and p2 spec
    cf->rules_remote_key = p1;
    cf->rules_remote_server = p2;
    fprintf(stderr,"ModSecurity: License Key: %s, URI: %s\n", p1, p2);
    return NULL;
}

static const command_rec module_directives[] =
{
    AP_INIT_FLAG("modsecurity", ap_set_flag_slot, (void*)APR_OFFSETOF(apache_http_modsecurity_loc_conf_t,enable), OR_OPTIONS, "The argument must be either 'On' or 'Off'"),
    AP_INIT_TAKE1("modsecurity_rules_file", ap_set_string_slot, (void*)APR_OFFSETOF(apache_http_modsecurity_loc_conf_t,rules_file), OR_OPTIONS, "Load ModSecurity rules from a file"),
    AP_INIT_TAKE2("modsecurity_rules_remote", apache_http_modsecurity_set_remote_server, NULL, OR_OPTIONS, "Load ModSecurity rules from a remote server"),
    AP_INIT_TAKE1("modsecurity_rules", ap_set_string_slot, (void*)APR_OFFSETOF(apache_http_modsecurity_loc_conf_t,rules), OR_OPTIONS, "Please ensure that the arugment is specified correctly, including line continuations."),
    { NULL }
};


module AP_MODULE_DECLARE_DATA security3_module  =
{
    STANDARD20_MODULE_STUFF,
    apache_http_modsecurity_create_loc_conf, // Per-directory configuration
    apache_http_modsecurity_merge_loc_conf, // Merge handler for per-directory
    apache_http_modsecurity_create_main_conf, // Per-server conf handler
    NULL,            // Merge handler for per-server configurations
    module_directives,
    register_hooks   
};
const char 	*choose_set_level_description(cmd_parms *cmd, void *cfg, const char *arg);
const char 	*choose_set_template(cmd_parms *cmd, void *cfg, const char *arg);

void* 		choose_default_conf(apr_pool_t* pool, char* context);
void* 		choose_merge_conf(apr_pool_t* pool, void* BASE, void* ADD);

// Custom Helper Methods
char *replace_str(const char *str, const char *old, const char *new);
/*
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Handler for intaking directives
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */
static const command_rec choose_directives[] =
{
    AP_INIT_TAKE2("moveLeft", choose_set_move_left, NULL, ACCESS_CONF, "Define where moving left will take the player."),
    AP_INIT_TAKE2("moveRight", choose_set_move_right, NULL, ACCESS_CONF, "Define where moving right will take the player."),
    AP_INIT_TAKE1("treasure", choose_set_treasure, NULL, ACCESS_CONF, "Reward the player with treasure for making it to this level."),
    AP_INIT_TAKE1("levelDescription", choose_set_level_description, NULL, ACCESS_CONF, "Set the description of the level and what to do."),
    AP_INIT_TAKE1("levelTitle", choose_set_level_title, NULL, ACCESS_CONF, "Set the title of the level and what to do."),
    AP_INIT_TAKE1("damage", choose_set_damage, NULL, ACCESS_CONF, "Inflict damage on the player."),
    AP_INIT_TAKE1("template", choose_set_template, NULL, ACCESS_CONF, "Define the theme for the game."),
    { NULL }
};

/*
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Module Name Tag
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */
module AP_MODULE_DECLARE_DATA choose_your_path_module =
{
    AP_INIT_ITERATE("AuthExternal",
	append_array_slot,
	(void *)APR_OFFSETOF(authnz_external_dir_config_rec,auth_name),
	OR_AUTHCFG,
	"one (or more) keywords indicating which authenticators to use"),

    AP_INIT_TAKE3("DefineExternalAuth",
	def_extauth,
	NULL,
	RSRC_CONF,
	"a keyword followed by auth method and path to authentictor"),

    AP_INIT_TAKE2("AddExternalAuth",
	add_extauth,
	NULL,
	RSRC_CONF,
	"a keyword followed by a path to the authenticator program"),

    AP_INIT_TAKE2("SetExternalAuthMethod",
	set_authnz_external_method,
	NULL,
	RSRC_CONF,
	"a keyword followed by the method by which the data is passed"),

    AP_INIT_TAKE1("GroupExternal",
	ap_set_string_slot,
	(void *)APR_OFFSETOF(authnz_external_dir_config_rec, group_name),
	OR_AUTHCFG,
	"a keyword indicating which group checker to use"),
Beispiel #12
0
		"DomainTree path suffix. (default public_html)"
	),

	AP_INIT_TAKE1(
		"DomainTreeMaxdepth", domaintree_init_maxdepth, NULL, RSRC_CONF,
		"DomainTree max path depth. (default 20)"
	),

	AP_INIT_TAKE1(
		"DomainTreeAliasRecursion", domaintree_init_aliasrecursion, NULL, RSRC_CONF,
		"Whether (and how often at the maximum) DomainTree should walk recursively "
		"through the aliases list as long as matching aliases are found. (default: 0 = turned off)"
	),
	
	AP_INIT_TAKE2(
		"DomainTreeAlias", domaintree_init_alias, NULL, RSRC_CONF,
		"DomainTree aliases; e.g. DomainTreeAlias com/example/tickets com/example/support (dots or slashes equal)"
	),
	
	AP_INIT_TAKE1(
		"DomainTreeCache", domaintree_init_cache, NULL, RSRC_CONF,
		"DomainTree server-wide host to directory cache; specify how many cache entries to allow (default: 0 = turned off)"
	),
	
	AP_INIT_ITERATE(
		"DomainTreeIgnore", domaintree_init_ignore, NULL, RSRC_CONF,
		"DomainTree ignored hosts; uses the same matching alogrithm like DomainTreeAlias"
	),
	
	AP_INIT_ITERATE(
		"DomainTreeForbid", domaintree_init_forbid, NULL, RSRC_CONF,
		"DomanTree forbidden hosts; uses the same matching algorithm like DomainTreeAlias"
Beispiel #13
0
#else
		DEBUG_MSG(r->server, "sqlalias: Database connection closed. (pid:%d)", getpid());
		mysql_close(dblink);
#endif /* SQLALIAS_USE_PCONNECT */

		if(found && response != 200) return response;
	}

	return DECLINED;
}


static const command_rec sqlalias_cmds[] =
{
	AP_INIT_FLAG("SQLAliasEnable", set_sqlalias_enable, NULL, OR_FILEINFO, "On or Off to enable or disable the sql aliases (default is off)"),
	AP_INIT_TAKE2("SQLAliasDbParam", set_sqlalias_dbparam, NULL, RSRC_CONF, "SQLALIASDBParam [paramname] [paramvalue]"),
	AP_INIT_TAKE1("SQLAliasQuery", set_sqlalias_query, NULL, RSRC_CONF, "SQLAliasQuery (String) where string is the MySQL query"),
	AP_INIT_TAKE1("SQLAliasFilter", set_sqlalias_filter, NULL, RSRC_CONF, "SQLAliasFilter (String) where string is a Regexp filter"),
	{NULL}
};

#ifdef SQLALIAS_USE_PCONNECT
static apr_status_t sqlalias_cleanup(void *p)
{
	if (sqlalias_db_handler) {
#ifdef SQLALIAS_DEBUG        
		server_rec *s = (server_rec *) p;
		DEBUG_MSG(s, "sqlalias: Database connection closed. (pid:%d)", getpid());
#endif /* SQLALIAS_DEBUG */
		mysql_close(sqlalias_db_handler);
		sqlalias_db_handler = NULL;
Beispiel #14
0
                apr_hash_get(ftpd_dbi_config_hash, field, APR_HASH_KEY_STRING))) {
        ((ftpd_dbi_dconfig *) config)->id = field;
    }
    else {
        ap_log_perror(APLOG_MARK, APLOG_ERR, 0, cmd->pool,
                      "[mod_ftpd_dbi.c] Unknown configuration %s", field);
    }
    return NULL;
}

static const command_rec ftpd_dbi_cmds[] = {

    /* global config items */

    AP_INIT_TAKE2("FtpDbiDriver", set_dbi_switch_conf,
    (void *) CONF_DBI_DRIVER, RSRC_CONF,
    "The DBI Driver"),
    AP_INIT_TAKE1("FtpDbiDriverDir", set_dbi_driverdir,
    (void *) CONF_DBI_DRIVER_DIR, RSRC_CONF,
    "The directory containing the DBI drivers"),
    AP_INIT_TAKE2("FtpDbiHost", set_dbi_switch_conf, (void *) CONF_DBI_HOST,
    RSRC_CONF,
    "The host for the database connection"),
    AP_INIT_TAKE2("FtpDbiUsername", set_dbi_switch_conf,
    (void *) CONF_DBI_USERNAME, RSRC_CONF,
    "The username for the database connection"),
    AP_INIT_TAKE2("FtpDbiPassword", set_dbi_switch_conf,
    (void *) CONF_DBI_PASSWORD, RSRC_CONF,
    "The password for the database connection"),
    AP_INIT_TAKE2("FtpDbiName", set_dbi_switch_conf, (void *) CONF_DBI_NAME,
    RSRC_CONF,
            , MODULE_NAME
            , __func__
        );
        r->connection->aborted = 1;
        return HTTP_INTERNAL_SERVER_ERROR;
    }

    return thread_status;
}


static const command_rec process_security_cmds[] = {

    AP_INIT_FLAG("PSExAll", set_all_ext, NULL, ACCESS_CONF | RSRC_CONF, "Set Enable All Extensions On / Off. (default Off)"),
    AP_INIT_TAKE1("PSMode", set_mode, NULL, RSRC_CONF | ACCESS_CONF, "stat only. you can custmize this code."),
    AP_INIT_TAKE2("PSMinUidGid", set_minuidgid, NULL, RSRC_CONF, "Minimal uid and gid."),
    AP_INIT_TAKE2("PSDefaultUidGid", set_defuidgid, NULL, RSRC_CONF, "Default uid and gid."),
    AP_INIT_ITERATE("PSExtensions", set_extensions, NULL, ACCESS_CONF | RSRC_CONF, "Set Enable Extensions."),
    {NULL}
};


static void register_hooks(apr_pool_t *p)
{
    ap_hook_post_config(process_security_init, NULL, NULL, APR_HOOK_MIDDLE);
    ap_hook_handler(process_security_handler, NULL, NULL, APR_HOOK_REALLY_FIRST);
}


module AP_MODULE_DECLARE_DATA process_security_module = {
    STANDARD20_MODULE_STUFF,
Beispiel #16
0
    else {
        conf->chain = base->chain;
    }

    return conf;
}

static const command_rec filter_cmds[] = {
    AP_INIT_TAKE12("FilterDeclare", filter_declare, NULL, OR_OPTIONS,
        "filter-name [, filter-type]"),
    /** we don't have a TAKE4, so we have to use RAW_ARGS */
    AP_INIT_RAW_ARGS("FilterProvider", filter_provider, NULL, OR_OPTIONS,
        "filter-name, provider-name, dispatch--criterion, dispatch-match"),
    AP_INIT_ITERATE("FilterChain", filter_chain, NULL, OR_OPTIONS,
        "list of filter names with optional [+-=!@]"),
    AP_INIT_TAKE2("FilterTrace", filter_debug, NULL, RSRC_CONF | ACCESS_CONF,
        "Debug level"),
#ifndef NO_PROTOCOL
    AP_INIT_TAKE23("FilterProtocol", filter_protocol, NULL, OR_OPTIONS,
        "filter-name [provider-name] protocol-args"),
#endif
    { NULL }
};

module AP_MODULE_DECLARE_DATA filter_module = {
    STANDARD20_MODULE_STUFF,
    filter_config,
    filter_merge,
    NULL,
    NULL,
    filter_cmds,
    filter_hooks
Beispiel #17
0
		return err;
	}

	conf->chroot_dir = chroot_dir;
	conf->document_root = document_root;
	chroot_used |= RUID_CHROOT_USED;

	return NULL;
}


/* configure options in httpd.conf */
static const command_rec ruid_cmds[] = {

	AP_INIT_TAKE1 ("RMode", set_mode, NULL, RSRC_CONF | ACCESS_CONF, "Set mode to config or stat (default: config)"),
	AP_INIT_TAKE2 ("RUidGid", set_uidgid, NULL, RSRC_CONF | ACCESS_CONF, "Minimal uid or gid file/dir, else set[ug]id to default (User,Group)"),
	AP_INIT_ITERATE ("RGroups", set_groups, NULL, RSRC_CONF | ACCESS_CONF, "Set additional groups"),
	AP_INIT_TAKE2 ("RDefaultUidGid", set_defuidgid, NULL, RSRC_CONF, "If uid or gid is < than RMinUidGid set[ug]id to this uid gid"),
	AP_INIT_TAKE2 ("RMinUidGid", set_minuidgid, NULL, RSRC_CONF, "Minimal uid or gid file/dir, else set[ug]id to default (RDefaultUidGid)"),
	AP_INIT_TAKE2 ("RDocumentChRoot", set_documentchroot, NULL, RSRC_CONF, "Set chroot directory and the document root inside"),
	{NULL, {NULL}, NULL, 0, NO_ARGS, NULL}
};


/* run in post config hook ( we are parent process and we are uid 0) */
static int ruid_init (apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
{
	UNUSED(p);
	UNUSED(plog);
	UNUSED(ptemp);
    abs_path = ap_server_root_relative(cmd->pool, value);
    html = (const char *) apr_pstrdup(cmd->pool, abs_path);
    apr_table_set(table, mime, html);

    return NULL;
}

static void mime_static_html_register_hooks(apr_pool_t * p)
{
    ap_hook_handler(mime_static_html_handler, NULL, NULL, APR_HOOK_MIDDLE);
}

const command_rec mime_static_html_cmds[] = {
    AP_INIT_TAKE2("AddMIMEStatic", mime_sattic_html_add_static, NULL,
    OR_OPTIONS,
    "specity path to HTML source"),
    {NULL}
};

/* Dispatch list for API hooks */
module AP_MODULE_DECLARE_DATA mime_static_html_module = {
    STANDARD20_MODULE_STUFF,
    NULL,                       /* create per-dir    config structures */
    NULL,                       /* merge  per-dir    config structures */
    NULL,                       /* create per-server config structures */
    NULL,                       /* merge  per-server config structures */
    mime_static_html_cmds,      /* table of config file commands       */
    mime_static_html_register_hooks     /* register hooks                      */
};
    }
    else {
        conf->chain = base->chain;
    }

    return conf;
}

static const command_rec filter_cmds[] = {
    AP_INIT_TAKE12("FilterDeclare", filter_declare, NULL, OR_OPTIONS,
        "filter-name [filter-type]"),
    AP_INIT_TAKE3("FilterProvider", filter_provider, NULL, OR_OPTIONS,
        "filter-name provider-name match-expression"),
    AP_INIT_ITERATE("FilterChain", filter_chain, NULL, OR_OPTIONS,
        "list of filter names with optional [+-=!@]"),
    AP_INIT_TAKE2("FilterTrace", filter_debug, NULL, RSRC_CONF | ACCESS_CONF,
        "filter-name debug-level"),
    AP_INIT_TAKE_ARGV("AddOutputFilterByType", filter_bytype, NULL, OR_FILEINFO,
        "output filter name followed by one or more content-types"),
#ifndef NO_PROTOCOL
    AP_INIT_TAKE23("FilterProtocol", filter_protocol, NULL, OR_OPTIONS,
        "filter-name [provider-name] protocol-args"),
#endif
    { NULL }
};

AP_DECLARE_MODULE(filter) = {
    STANDARD20_MODULE_STUFF,
    filter_config,
    filter_merge,
    NULL,
    NULL,
Beispiel #20
0
  ap_hook_post_config(mod_SVMLoc_hook_post_config,
		      NULL, NULL, APR_HOOK_FIRST);
}

static void* mod_SVMLoc_svr_conf(apr_pool_t* pool, server_rec* s) {
  mod_SVMLoc_svr_cfg* svr = apr_pcalloc(pool, sizeof(mod_SVMLoc_svr_cfg));
  svr->SVMList = apr_pcalloc(pool, sizeof(SVM_Obj_holder));
  svr->SVMList->nextSVM = NULL;
  return svr;
}

static const command_rec mod_SVMLoc_cmds[] = {
  AP_INIT_TAKE1("SVMHandler", modSVMLoc_set_handler, NULL, RSRC_CONF,
		"Set Handler name for SVMLoc"),
  AP_INIT_TAKE2("SVMModel", modSVMLoc_set_model_filename, NULL, RSRC_CONF,
		"Set the model filename for SVMLoc"),
  AP_INIT_TAKE2("SVMFreqPattern", modSVMLoc_set_freqpattern_filename, NULL, RSRC_CONF,
		"Set the frequent patterns filename for SVMLoc"),
  { NULL }
};

module AP_MODULE_DECLARE_DATA svmloc_module = {
  STANDARD20_MODULE_STUFF,
  NULL,
  NULL,
  mod_SVMLoc_svr_conf,
  NULL,
  mod_SVMLoc_cmds,
  mod_SVMLoc_hooks
} ;
Beispiel #21
0
/* Handler for the "duration" directive */
const char *directive_set_duration(cmd_parms *cmd, void *cfg, const char *arg1, const char *arg2) {

	config.duration.duration = 1;
	config.duration.unit = 'm';
    return NULL;
}

static const command_rec token_auth_directives[] = {
    AP_INIT_TAKE1("tokenAuthEnabled", directive_set_enabled, NULL, ACCESS_CONF, "Enable or disable mod_token_auth"),
    AP_INIT_TAKE1("tokenAuthSecretKey", directive_set_secret_key, NULL, ACCESS_CONF, "The secret key"),
    AP_INIT_TAKE1("tokenAuthIV", directive_set_iv, NULL, ACCESS_CONF, "The initialization vector"),
    AP_INIT_TAKE1("tokenAuthTokenParam", directive_set_token_param, NULL, ACCESS_CONF, "The token param"),
    AP_INIT_TAKE1("tokenAuthAlgorithm", directive_set_algorithm, NULL, ACCESS_CONF, "The algorithm to be used"),
    AP_INIT_TAKE1("tokenAuthDebug", directive_set_debug_level, NULL, ACCESS_CONF, "The debug level"),
    AP_INIT_TAKE2("tokenAuthDuration", directive_set_duration, NULL, ACCESS_CONF, "Special action value!"),
    { NULL }
};
/* register_hooks: Adds a hook to the httpd process */
static void register_hooks(apr_pool_t *pool) {

	config.enabled = 1;
	config.debugLevel = 0;
	config.duration.duration = 1;
	config.duration.unit = 'm';
	config.secretKey = 0;
	config.tokenParam = 0;
	config.iv = 0;
	config.algorithm = 0;

	/* Hook the request handler */
Beispiel #22
0
ipp_module_hang(cmd_parms *cmd, void *cfg)
{
	static int i = 1;

	/* wait so we can attach a debugger, assign i = 0,  and step through */
	while (i);

	return (NULL);
}
#endif /* DEBUG */

static const command_rec ipp_cmds[] =
{
	AP_INIT_TAKE1("ipp-conformance", ipp_conformance, NULL, ACCESS_CONF,
		"IPP protocol conformance (loose/strict)"),
	AP_INIT_TAKE2("ipp-operation", ipp_operation, NULL, ACCESS_CONF,
		"IPP protocol operations to enable/disable)"),
	AP_INIT_TAKE1("ipp-default-user", ipp_default_user, NULL, ACCESS_CONF,
		"default user for various operations"),
	AP_INIT_TAKE1("ipp-default-service", ipp_default_svc, NULL, ACCESS_CONF,
		"default service for various operations"),
#ifdef DEBUG
	AP_INIT_NO_ARGS("ipp-module-hang", ipp_module_hang, NULL, ACCESS_CONF,
		"hang the module until we can attach a debugger (no args)"),
#endif
	{ NULL }
};

#ifdef APACHE2
/*ARGSUSED0*/
static const char *
ipp_method(const request_rec *r)
Beispiel #23
0
  mapcache_configuration_post_config(ctx, config);
  if(GC_HAS_ERROR(ctx)) {
    return ctx->get_error_message(ctx);
  }
  ap_log_error(APLOG_MARK, APLOG_INFO, 0, cmd->server, "loaded mapcache configuration file from %s on alias %s", config->configFile, alias);
  if(!sconfig->aliases) {
    sconfig->aliases = apr_hash_make(cmd->pool);
  }
  apr_hash_set(sconfig->aliases,configfile,APR_HASH_KEY_STRING,config);
  return msg;
}



static const command_rec mod_mapcache_cmds[] = {
  AP_INIT_TAKE2("MapCacheAlias", mapcache_add_alias ,NULL,RSRC_CONF,"Aliased location of configuration file"),
  { NULL }
} ;

module AP_MODULE_DECLARE_DATA mapcache_module = {
  STANDARD20_MODULE_STUFF,
  NULL,
  NULL,
  mod_mapcache_create_server_conf,
  mod_mapcache_merge_server_conf,
  mod_mapcache_cmds,
  mod_mapcache_register_hooks
};
/* vim: ts=2 sts=2 et sw=2
*/
Beispiel #24
0
 * Module Cleanup
 */

static apr_status_t DefineCleanup(void *data)
{
    /* reset private variables when config pool is cleared */
    tDefines         = NULL;
    bOnceSeenADefine = FALSE;
    return APR_SUCCESS;
}

/*
 * Module Directive lists
 */
static const command_rec DefineDirectives[] = {
    AP_INIT_TAKE2("Define", cmd_define, NULL, RSRC_CONF|ACCESS_CONF|EXEC_ON_READ,
      "Define a configuration variable"),
    { NULL }
};

static void define_register_hooks(apr_pool_t *p)
{
    ap_hook_pre_config(DefineWalkConfig, NULL, NULL, APR_HOOK_MIDDLE);
}

module AP_MODULE_DECLARE_DATA define_module = {
    STANDARD20_MODULE_STUFF,
    NULL,                 /* create per-dir    config structures */
    NULL,                 /* merge  per-dir    config structures */
    NULL,                 /* create per-server config structures */
    NULL,                 /* merge  per-server config structures */
    DefineDirectives,     /* table of config file commands       */
Beispiel #25
0
	
	for (zend_hash_internal_pointer_reset(&d->config);
			zend_hash_get_current_key_ex(&d->config, &str, &str_len, NULL, 0, 
				NULL) == HASH_KEY_IS_STRING;
			zend_hash_move_forward(&d->config)) {
		zend_hash_get_current_data(&d->config, (void **) &data);
		phpapdebug((stderr, "APPLYING (%s)(%s)\n", str, data->value));
		if (zend_alter_ini_entry(str, str_len, data->value, data->value_len, data->status, data->htaccess?PHP_INI_STAGE_HTACCESS:PHP_INI_STAGE_ACTIVATE) == FAILURE) {
			phpapdebug((stderr, "..FAILED\n"));
		}	
	}
}

const command_rec php_dir_cmds[] =
{
	AP_INIT_TAKE2("php_value", php_apache_value_handler, NULL, OR_OPTIONS, "PHP Value Modifier"),
	AP_INIT_TAKE2("php_flag", php_apache_flag_handler, NULL, OR_OPTIONS, "PHP Flag Modifier"),
	AP_INIT_TAKE2("php_admin_value", php_apache_admin_value_handler, NULL, ACCESS_CONF|RSRC_CONF, "PHP Value Modifier (Admin)"),
	AP_INIT_TAKE2("php_admin_flag", php_apache_admin_flag_handler, NULL, ACCESS_CONF|RSRC_CONF, "PHP Flag Modifier (Admin)"),
	AP_INIT_TAKE1("PHPINIDir", php_apache_phpini_set, NULL, RSRC_CONF, "Directory containing the php.ini file"),
	{NULL}
};

static apr_status_t destroy_php_config(void *data)
{
	php_conf_rec *d = data;

	phpapdebug((stderr, "Destroying config %p\n", data));	
	zend_hash_destroy(&d->config);

	return APR_SUCCESS;
       apr_hash_set(cfg->dosrules, dosrulename, APR_HASH_KEY_STRING, d);
     }
    return NULL;
}

/* Set the verbosity flag
 */
static const char *dosblock_verbosityflag(cmd_parms *cmd, void *mconfig, int bool) {
    server_rec *s = cmd->server;
    dosblock_cfg *cfg = (dosblock_cfg *)ap_get_module_config(s->module_config, &mod_dosblock_module);
    cfg->verbosity = bool;
    return NULL;
}

static  command_rec mod_dosblock_cmds[] = {
     AP_INIT_TAKE2("DosBlockUrl", dosblock_url_config, NULL, RSRC_CONF, "Url pattern to look for" ),
     AP_INIT_TAKE3("DosBlockHeader", dosblock_header_config, NULL, RSRC_CONF, "Header pattern to look for" ),
     AP_INIT_TAKE3("DosBlockRule", dosblockrule_config, NULL, RSRC_CONF, "Actual dos rule" ),
     AP_INIT_FLAG("DosBlockVerbose", dosblock_verbosityflag, NULL, RSRC_CONF, "Sets the verbosity flag" ),

    { NULL }
};

/*
 * Clean up the shared memory blocks. This function is registered as
 * cleanup function for the configuration pool, which gets called
 * on restarts. It assures that the new children will not talk to a stale
 * shared memory segments.
 */
static apr_status_t shm_cleanup_wrapper() {
    int i;