*/

// If 'redirect' is foo/bar, then redirect to it.  If it is
// foo/bar/%s, then replace the %s with r->uri.
static void compose_and_set_redirect(request_rec *r, const char* redirect) {
	char* composed_redirect = NULL;
	if (ap_strstr_c(redirect, "%s")) {
		composed_redirect = apr_psprintf(r->pool, redirect, r->uri);
 	}
        apr_table_setn(r->headers_out, "Location", composed_redirect ? composed_redirect : redirect);
}

static const command_rec cookie_auth_cmds[] =
{
    AP_INIT_TAKE1("AuthCookieName", ap_set_string_slot,
	 (void *)APR_OFFSETOF(cookie_auth_config_rec, cookie_auth_cookie),
	 OR_AUTHCFG, "auth cookie name"),
    AP_INIT_TAKE1("AuthCookieEnv", ap_set_string_slot,
	 (void *)APR_OFFSETOF(cookie_auth_config_rec, cookie_auth_env),
	 OR_AUTHCFG, "environment variable name for optional auxiliary auth info"),
     AP_INIT_TAKE1("AuthCookieEnvRedirect", ap_set_string_slot,
	 (void *)APR_OFFSETOF(cookie_auth_config_rec, cookie_auth_env_redirect),
	 OR_AUTHCFG, "path to redirect to if optional auxiliary auth info is missing in cookie"),
     AP_INIT_TAKE1("AuthCookieUnauthRedirect", ap_set_string_slot,
	 (void *)APR_OFFSETOF(cookie_auth_config_rec, cookie_auth_unauth_redirect),
	 OR_AUTHCFG, "path to redirect to if authentication cookie is not set"),
   AP_INIT_TAKE1("AuthCookieEncrypt", ap_set_string_slot,
	 (void *)APR_OFFSETOF(cookie_auth_config_rec, cookie_auth_encrypt),
	 OR_AUTHCFG, "secret key used to DES-encrypt the cookie"),
    AP_INIT_FLAG("AuthCookieOverride", ap_set_flag_slot,
     (void *)APR_OFFSETOF(cookie_auth_config_rec, cookie_auth_override),
Exemplo n.º 2
0
                apr_table_setn(r->subprocess_env, sconf->mobile_env, "true");
            }
        }
    } else {
    	// ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server , "No entry found for UA: %s", user_agent);
    }

    return DECLINED;
}


static const command_rec wurfl_cmds[] =
{
    AP_INIT_FLAG("WurflEnable", cmd_wurflengine, NULL, RSRC_CONF,
                 "On or off to enable the whole WURFL module"),
    AP_INIT_TAKE1("WurflDBFile", cmd_wurfldb, NULL, RSRC_CONF,
                 "the filename of the WURFL-DB xml file"),
    AP_INIT_TAKE1("WurflMobileEnv", cmd_wurflmobileenv, NULL, RSRC_CONF,
    			"ENV to set for mobile user agents"),
    AP_INIT_TAKE1("WurflTabletEnv", cmd_wurfltabletenv, NULL, RSRC_CONF,
    		   	 "ENV to set for tablet user agents"),

    { NULL }
};

static void register_hooks(apr_pool_t *p)
{
    ap_hook_header_parser(wurfl_match_headers, NULL, NULL, APR_HOOK_MIDDLE);
}

module AP_MODULE_DECLARE_DATA wurfl_module = {
    STANDARD20_MODULE_STUFF,
Exemplo n.º 3
0
 * @internal
 *
 * Declares all configuration directives.
 */
static const command_rec ironbee_cmds[] = {
    AP_INIT_FLAG(
      "IronBeeEnable",
      ironbee_cmd_ibenable,
      (void*)APR_OFFSETOF(ironbee_config_t, enabled),
      RSRC_CONF,
      "enable ironbee module"
    ),
    AP_INIT_TAKE1(
      "IronBeeConfig",
      ironbee_cmd_ibconfig,
      (void*)APR_OFFSETOF(ironbee_config_t, config),
      RSRC_CONF,
      "specify ironbee configuration file"
    ),
    AP_INIT_TAKE1(
      "IronBeeBufferSize",
      ironbee_cmd_sz,
      (void*)APR_OFFSETOF(ironbee_config_t, buf_size),
      RSRC_CONF,
      "specify buffer size (bytes)"
    ),
    AP_INIT_TAKE1(
      "IronBeeBufferFlushSize",
      ironbee_cmd_sz,
      (void*)APR_OFFSETOF(ironbee_config_t, flush_size),
      RSRC_CONF,
Exemplo n.º 4
0
               "suffixed with 'b', 'k', 'm' or 'g'.";
    }
    dcfg->max_line_length = (apr_size_t)max;
    dcfg->max_line_length_set = 1;
    return NULL;
}

#define PROTO_FLAGS AP_FILTER_PROTO_CHANGE|AP_FILTER_PROTO_CHANGE_LENGTH
static void register_hooks(apr_pool_t *pool)
{
    ap_register_output_filter(substitute_filter_name, substitute_filter,
                              NULL, AP_FTYPE_RESOURCE);
}

static const command_rec substitute_cmds[] = {
    AP_INIT_TAKE1("Substitute", set_pattern, NULL, OR_FILEINFO,
                  "Pattern to filter the response content (s/foo/bar/[inf])"),
    AP_INIT_TAKE1("SubstituteMaxLineLength", set_max_line_length, NULL, OR_FILEINFO,
                  "Maximum line length"),
    AP_INIT_FLAG("SubstituteInheritBefore", ap_set_flag_slot,
                 (void *)APR_OFFSETOF(subst_dir_conf, inherit_before), OR_FILEINFO,
                 "Apply inherited patterns before those of the current context"),
    {NULL}
};

AP_DECLARE_MODULE(substitute) = {
    STANDARD20_MODULE_STUFF,
    create_substitute_dcfg,     /* dir config creater */
    merge_substitute_dcfg,      /* dir merger --- default is to override */
    NULL,                       /* server config */
    NULL,                       /* merge server config */
    substitute_cmds,            /* command table */
Exemplo n.º 5
0
    debuglevel = strtol(arg, NULL, 10);
    return NULL;
}
#endif


/* module info */

static const command_rec aclr_cmds[] =
{
    AP_INIT_FLAG("AccelRedirectSet", set_aclr_state,
    NULL, ACCESS_CONF|RSRC_CONF,
    "Turn X-Accel-Redirect support On or Off (default Off)"),

    AP_INIT_TAKE1("AccelRedirectSize", set_redirect_min_size,
    NULL, ACCESS_CONF|RSRC_CONF,
    "Minimum size of file for redirect"),

    AP_INIT_FLAG("AccelRedirectOutsideDocRoot", set_aclr_outside_of_docroot,
    NULL, RSRC_CONF,
    "Allow redirect outside of DocumentRoot (default Off)"),

#ifdef DEBUG
    AP_INIT_TAKE1("AccelRedirectDebug", set_debug_level,
    NULL, RSRC_CONF,
    "Debug level (0=off, 1=min, 2=mid, 3=max)"),
#endif

    { NULL }
};
Exemplo n.º 6
0
                }
            } else if (strcmp(name, "AmAgent") == 0) {
                if (!strcasecmp(arg, "on")) {
                    conf->enabled = 1;
                } else {
                    conf->enabled = 0;
                }
            }
        }
    }
    return NULL;
}

/*Context: either top level or inside VirtualHost*/
static const command_rec amagent_cmds[] = {
    AP_INIT_TAKE1("AmAgent", am_set_opt, NULL, RSRC_CONF, "Module enabled/disabled"),
    AP_INIT_TAKE1("AmAgentConf", am_set_opt, NULL, RSRC_CONF, "Module configuration file"), {
        NULL
    }
};

static apr_status_t amagent_cleanup(void *arg) {
    /* main process cleanup */
    server_rec *s = (server_rec *) arg;
    LOG_S(APLOG_DEBUG, s, "amagent_cleanup() %d", getpid());
#ifndef _WIN32
    am_shutdown();
#endif
    return APR_SUCCESS;
}
Exemplo n.º 7
0
    //ap_register_input_filter( "MODMRUBYFILTER", mod_mruby_input_filter,  NULL, AP_FTYPE_CONTENT_SET);
}

#define MOD_MRUBY_SET_ALL_CMDS_INLINE(hook, dir_name) \
    AP_INIT_TAKE1("mruby" #dir_name "FirstCode",  set_mod_mruby_##hook##_first_inline,  NULL, RSRC_CONF | ACCESS_CONF, "hook inline code for " #hook " first phase."), \
    AP_INIT_TAKE1("mruby" #dir_name "MiddleCode", set_mod_mruby_##hook##_middle_inline, NULL, RSRC_CONF | ACCESS_CONF, "hook inline code for " #hook " middle phase."), \
    AP_INIT_TAKE1("mruby" #dir_name "LastCode",   set_mod_mruby_##hook##_last_inline,   NULL, RSRC_CONF | ACCESS_CONF, "hook inline code for " #hook " last phase."),

#define MOD_MRUBY_SET_ALL_CMDS(hook, dir_name) \
    AP_INIT_TAKE12("mruby" #dir_name "First",  set_mod_mruby_##hook##_first,  NULL, RSRC_CONF | ACCESS_CONF, "hook Ruby file for " #hook " first phase."), \
    AP_INIT_TAKE12("mruby" #dir_name "Middle", set_mod_mruby_##hook##_middle, NULL, RSRC_CONF | ACCESS_CONF, "hook Ruby file for " #hook " middle phase."), \
    AP_INIT_TAKE12("mruby" #dir_name "Last",   set_mod_mruby_##hook##_last,   NULL, RSRC_CONF | ACCESS_CONF, "hook Ruby file for " #hook " last phase."),

static const command_rec mod_mruby_cmds[] = {

    AP_INIT_TAKE1("mrubyHandlerCode", set_mod_mruby_handler_inline, NULL, RSRC_CONF | ACCESS_CONF, "hook inline code for handler phase."),
    MOD_MRUBY_SET_ALL_CMDS_INLINE(handler, Handler)
    MOD_MRUBY_SET_ALL_CMDS_INLINE(post_read_request, PostReadRequest)
    MOD_MRUBY_SET_ALL_CMDS_INLINE(translate_name, TranslateName)
    MOD_MRUBY_SET_ALL_CMDS_INLINE(map_to_storage, MapToStorage)
    MOD_MRUBY_SET_ALL_CMDS_INLINE(access_checker, AccessChecker)
    MOD_MRUBY_SET_ALL_CMDS_INLINE(check_user_id, CheckUserId)
    MOD_MRUBY_SET_ALL_CMDS_INLINE(auth_checker, AuthChecker)
    MOD_MRUBY_SET_ALL_CMDS_INLINE(fixups, Fixups)
    MOD_MRUBY_SET_ALL_CMDS_INLINE(log_transaction, LogTransaction)

    AP_INIT_TAKE12("mrubyHandler", set_mod_mruby_handler, NULL, RSRC_CONF | ACCESS_CONF, "hook for handler phase."),
    MOD_MRUBY_SET_ALL_CMDS(handler, Handler)
    MOD_MRUBY_SET_ALL_CMDS(post_config, PostConfig)
    MOD_MRUBY_SET_ALL_CMDS(child_init, ChildInit)
    MOD_MRUBY_SET_ALL_CMDS(post_read_request, PostReadRequest)
Exemplo n.º 8
0
module AP_MODULE_DECLARE_DATA moon_module;

// config struct
typedef struct moon_svr_cfg {
	char *buf;
	const char* user_data_url;
	const char* group_data_url;
	apr_hash_t * user_to_css;
	apr_hash_t * group_to_css;
} moon_svr_cfg;

// List of containers and directives
static const command_rec moon_cmds[] = {
	AP_INIT_RAW_ARGS("<LMMPGroup", lmmpgroup_cmd, NULL, EXEC_ON_READ|OR_ALL, "Container for 								setting group css style"),
	AP_INIT_RAW_ARGS("<LMMPUser", lmmpuser_cmd, NULL, EXEC_ON_READ|OR_ALL, "Container for 								setting user css style"),
	AP_INIT_TAKE1("LMMPSetUserDataUrl", lmmpset_user_data_url_cmd, NULL, OR_ALL, "set user 							data url"),
	AP_INIT_TAKE1("LMMPSetGroupDataUrl", lmmpset_group_data_url_cmd, NULL, OR_ALL, "set group 							data url"),
	{ NULL }
};

// Standard Module declaration for Apache 2.0
module AP_MODULE_DECLARE_DATA moon_module = {
	STANDARD20_MODULE_STUFF,
	NULL,
	NULL,
	create_moon_cfg,
	NULL,
	moon_cmds,
	moon_hooks
};
Exemplo n.º 9
0
   See LICENSE file for licensing details.
*/

#include "mod_falcon.h"
#include "mod_falcon_config.h"

/*=========================================================
  Module data.
  Configuration directive for Falcon module
*/
static const command_rec mod_falcon_cmds[] =
{
   AP_INIT_TAKE1(
      "FalconConfig",
      (const char *(*)())falcon_mod_set_config,
      NULL,
      RSRC_CONF,
      "config_file (string) -- Location of the falcon.ini file."
   ),
   
   AP_INIT_TAKE1(
      "FalconHandler",
         (const char *(*)())falcon_mod_set_handler,
         NULL,
         ACCESS_CONF | RSRC_CONF,
         "handler script (string) -- Program invoked when falcon-program handler is excited."
         ),

   AP_INIT_TAKE1(
      "FalconLoadPath",
           (const char *(*)())falcon_mod_set_path,
Exemplo n.º 10
0
	AP_INIT_TAKE13("LogSQLLoginInfo", set_log_sql_info, NULL, RSRC_CONF,
	 "The database connection URI in the form &quot;driver://user:password@hostname:port/database&quot;")
	,
	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,
	 "Turn on module's capability to create its SQL tables on the fly")
	,
	/* Table names */
	AP_INIT_FLAG("LogSQLMassVirtualHosting", set_global_flag_slot,
	 (void *)APR_OFFSETOF(global_config_t, massvirtual), RSRC_CONF,
	 "Activates option(s) useful for ISPs performing mass virutal hosting")
	,
	AP_INIT_TAKE1("LogSQLTransferLogTable", set_server_nmv_string_slot,
	 (void *)APR_OFFSETOF(logsql_state, transfer_table_name), RSRC_CONF,
	 "The database table that holds the transfer log")
	,
Exemplo n.º 11
0
    return code;
}

/*
 * Only needed configuration is pointer to resin.conf
 */
static const command_rec cwx_commands[] = {
    AP_INIT_RAW_ARGS("cwinux-service", cwx_svr_command, NULL,
    RSRC_CONF, "Configures service."),
    AP_INIT_RAW_ARGS("cwinux-host", cwx_host_command, NULL,
    RSRC_CONF, "Configures host."),
    AP_INIT_RAW_ARGS("cwinux-balance", cwx_balance_command, NULL,
    RSRC_CONF, "Configures balance."),
    AP_INIT_RAW_ARGS("cwinux-header", cwx_header_command, NULL,
    RSRC_CONF, "Configures header."),
    AP_INIT_TAKE1("cwinux-show", cwx_show_command, NULL,
    RSRC_CONF, "Configures default show."),
    AP_INIT_TAKE1("cwinux-delay", cwx_delay_command, NULL,
    RSRC_CONF, "Configures default delay."),
    AP_INIT_TAKE1("cwinux-persistent", cwx_persistent_command, NULL,
    RSRC_CONF, "Configures default persistent."),
    AP_INIT_TAKE1("cwinux-query-timeout", cwx_query_timeout_command, NULL,
    RSRC_CONF, "Configures default query-timeout."),
    AP_INIT_TAKE1("cwinux-conn-timeout", cwx_conn_timeout_command, NULL,
    RSRC_CONF, "Configures default conn-timeout."),
    AP_INIT_TAKE1("cwinux-reply-timeout", cwx_reply_timeout_command, NULL,
    RSRC_CONF, "Configures default reply-timeout."),
    AP_INIT_TAKE1("cwinux-restore-time", cwx_restore_time_command, NULL,
    RSRC_CONF, "Configures default restore-time."),
    AP_INIT_TAKE1("cwinux-min-idle-conn", cwx_min_idle_conn_command, NULL,
    RSRC_CONF, "Configures default min-idle-conn."),
    AP_INIT_TAKE1("cwinux-max-idle-conn", cwx_max_idle_conn_command, NULL,
Exemplo n.º 12
0
}

static const char *set_keep_alive_max(cmd_parms *cmd, void *dummy,
                                      const char *arg)
{
    const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE);
    if (err != NULL) {
        return err;
    }

    cmd->server->keep_alive_max = atoi(arg);
    return NULL;
}

static const command_rec http_cmds[] = {
    AP_INIT_TAKE1("KeepAliveTimeout", set_keep_alive_timeout, NULL, RSRC_CONF,
                  "Keep-Alive timeout duration (sec)"),
    AP_INIT_TAKE1("MaxKeepAliveRequests", set_keep_alive_max, NULL, RSRC_CONF,
                  "Maximum number of Keep-Alive requests per connection, "
                  "or 0 for infinite"),
    AP_INIT_FLAG("KeepAlive", set_keep_alive, NULL, RSRC_CONF,
                  "Whether persistent connections should be On or Off"),
    { NULL }
};

static const char *http_scheme(const request_rec *r)
{
    /*
     * The http module shouldn't return anything other than
     * "http" (the default) or "https".
     */
    if (r->server->server_scheme &&
Exemplo n.º 13
0
			ret = FTPD_CHROOT_FAIL;
		}
	}
	return ret;
}

/* Module initialization structures */

static const ftpd_provider ftpd_dbm_provider =
{
	ftpd_dbm_map_chroot,		/* map_chroot */
	NULL
};

static const command_rec ftpd_dbm_cmds[] = {
	AP_INIT_TAKE1("FtpDBMFile", ftpd_dbm_cmd_dbmpath, NULL, RSRC_CONF,
                 "Path to Database to use chroot mapping."),
	AP_INIT_TAKE1("FtpDBMType", ftpd_dbm_cmd_dbmtype, NULL, RSRC_CONF,
                 "What type of DBM file to open. default, DB,GDBM,NDBM, SDBM."),
    { NULL }
};

static void register_hooks(apr_pool_t *p)
{
	ap_register_provider(p, FTPD_PROVIDER_GROUP, "dbm","0",
		&ftpd_dbm_provider);
}

module AP_MODULE_DECLARE_DATA ftpd_dbm_module = {
	STANDARD20_MODULE_STUFF,
    NULL,                          /* create per-directory config structure */
    NULL,                          /* merge per-directory config structures */
Exemplo n.º 14
0
        dbd_handle = APR_RETRIEVE_OPTIONAL_FN(ap_dbd_acquire);
    }
    label = apr_psprintf(cmd->pool, "authz_dbd_%d", ++label_num);

    dbd_prepare(cmd->server, query, label);

    /* save the label here for our own use */
    return ap_set_string_slot(cmd, cfg, label);
}

static const command_rec authz_dbd_cmds[] = {
    AP_INIT_FLAG("AuthzDBDLoginToReferer", ap_set_flag_slot,
                 (void*)APR_OFFSETOF(authz_dbd_cfg, redirect), ACCESS_CONF,
                 "Whether to redirect to referer on successful login"),
    AP_INIT_TAKE1("AuthzDBDQuery", authz_dbd_prepare,
                  (void*)APR_OFFSETOF(authz_dbd_cfg, query), ACCESS_CONF,
                  "SQL query for DBD Authz or login"),
    AP_INIT_TAKE1("AuthzDBDRedirectQuery", authz_dbd_prepare,
                  (void*)APR_OFFSETOF(authz_dbd_cfg, redir_query), ACCESS_CONF,
                  "SQL query to get per-user redirect URL after login"),
    {NULL}
};

static int authz_dbd_login(request_rec *r, authz_dbd_cfg *cfg,
                           const char *action)
{
    int rv;
    const char *newuri = NULL;
    int nrows;
    const char *message;
    ap_dbd_t *dbd;
Exemplo n.º 15
0
static char *
svc_simulator_256b_get_reply(
    apr_pool_t * pool);

static void
svc_simulator_256b_module_init(
    apr_pool_t * p,
    server_rec * svr_rec);

static void
svc_simulator_256b_register_hooks(
    apr_pool_t * p);

/***************************End of Function Headers****************************/

static const command_rec svc_simulator_256b_cmds[] = { AP_INIT_TAKE1("SvcSimulatorInputFile_256b", svc_simulator_256b_set_filepath, NULL,
    RSRC_CONF, "Service Simulator file path"), { NULL } };

/* Dispatch list for API hooks */
module AP_MODULE_DECLARE_DATA svc_simulator_256b_module = { STANDARD20_MODULE_STUFF, NULL, /* create per-dir    config structures */
NULL, /* merge  per-dir    config structures */
svc_simulator_256b_create_svr, /* create per-server config structures */
NULL, /* merge  per-server config structures */
svc_simulator_256b_cmds, /* table of config file commands       */
svc_simulator_256b_register_hooks /* register hooks                      */
};

static void *
svc_simulator_256b_create_svr(
    apr_pool_t * p,
    server_rec * s)
{
Exemplo n.º 16
0
        if (rv != APR_SUCCESS)
            return apr_psprintf(cmd->pool, "%pm", &rv);
        a->type = T_IP;
    }
    else { /* no slash, didn't look like an IP address => must be a host */
        a->type = T_HOST;
    }

    return NULL;
}

static char its_an_allow;

static const command_rec access_compat_cmds[] =
{
    AP_INIT_TAKE1("order", order, NULL, OR_LIMIT,
    "'allow,deny', 'deny,allow', or 'mutual-failure'"),
    AP_INIT_ITERATE2("allow", allow_cmd, &its_an_allow, OR_LIMIT,
    "'from' followed by hostnames or IP-address wildcards"),
    AP_INIT_ITERATE2("deny", allow_cmd, NULL, OR_LIMIT,
    "'from' followed by hostnames or IP-address wildcards"),
    AP_INIT_TAKE1("Satisfy", satisfy, NULL, OR_AUTHCFG,
    "access policy if both allow and require used ('all' or 'any')"),
    {NULL}
};

static int in_domain(const char *domain, const char *what)
{
    int dl = strlen(domain);
    int wl = strlen(what);

    if ((wl - dl) >= 0) {
Exemplo n.º 17
0
        strcpy (buf, path);
        strcat (buf, ":");
        strcat (buf, arg);
    } else {
        strcpy (buf, arg);
    }
    setenv ("AIKIDOPATH", buf, 1);
    return NULL;
}



static const command_rec aikido_cmds[] =
{

AP_INIT_TAKE1("AikidoWebApps", set_webapp_dir, NULL, RSRC_CONF,
     "The path of the Aikido web applications"),

AP_INIT_TAKE1("AikidoRootDir", set_aikido_dir, NULL, RSRC_CONF,
     "The directory containing the aikido.zip file"),

AP_INIT_TAKE1("AikidoAddPath", add_aikido_path, NULL, RSRC_CONF,
     "Add a directory to the AIKIDOPATH environment variable"),

AP_INIT_TAKE1("AikidoDebugMode", set_aikido_debug, NULL, RSRC_CONF,
     "Set the mod_aikido debug mode (true or false)"),

};

/*
 * we have to create our own bucket type for reading from the sockets.  The apr_bucket_pipe_make function
 * seems to only read once and therefore a large amount of data seems to block the write to the pipe
Exemplo n.º 18
0
        dcfg->style = CT_COOKIE;
    }
    else if ((strcasecmp(name, "Cookie2") == 0)
             || (strcasecmp(name, "RFC2965") == 0)) {
        dcfg->style = CT_COOKIE2;
    }
    else {
        return apr_psprintf(cmd->pool, "Invalid %s keyword: '%s'",
                            cmd->cmd->name, name);
    }

    return NULL;
}

static const command_rec cookie_log_cmds[] = {
    AP_INIT_TAKE1("CookieExpires", set_cookie_exp, NULL, OR_FILEINFO,
                  "an expiry date code"),
    AP_INIT_TAKE1("CookieDomain", set_cookie_domain, NULL, OR_FILEINFO,
                  "domain to which this cookie applies"),
    AP_INIT_TAKE1("CookieStyle", set_cookie_style, NULL, OR_FILEINFO,
                  "'Netscape', 'Cookie' (RFC2109), or 'Cookie2' (RFC2965)"),
    AP_INIT_FLAG("CookieTracking", set_cookie_enable, NULL, OR_FILEINFO,
                 "whether or not to enable cookies"),
    AP_INIT_TAKE1("CookieName", set_cookie_name, NULL, OR_FILEINFO,
                  "name of the tracking cookie"),
    {NULL}
};

static void register_hooks(apr_pool_t *p)
{
    ap_hook_fixups(spot_cookie,NULL,NULL,APR_HOOK_REALLY_FIRST);
}
Exemplo n.º 19
0
			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;
}

void *create_php_config(apr_pool_t *p, char *dummy)
{
Exemplo n.º 20
0
{
    wiki_conf *c = (wiki_conf *) conf;
    c->header = arg;
    return NULL;
}

static const char *set_wiki_footer(cmd_parms * cmd, void *conf,
                                   const char *arg)
{
    wiki_conf *c = (wiki_conf *) conf;
    c->footer = arg;
    return NULL;
}

static const command_rec wiki_cmds[] = {
    AP_INIT_TAKE1("WikiRepository", set_wiki_repo, NULL, OR_ALL,
                  "set Repository"),
    AP_INIT_TAKE1("WikiName", set_wiki_name, NULL, OR_ALL,
                  "set WikiName"),
    AP_INIT_TAKE1("WikiBasePath", set_wiki_basepath, NULL, OR_ALL,
                  "set Base Path"),

    AP_INIT_TAKE1("WikiCSS", set_wiki_css, NULL, OR_ALL,
                  "set CSS"),
    AP_INIT_TAKE1("WikiHeaderHtml", set_wiki_header, NULL, OR_ALL,
                  "set Header HTML"),
    AP_INIT_TAKE1("WikiFooterHtml", set_wiki_footer, NULL, OR_ALL,
                  "set Footer HTML"),
    {NULL}
};

static void wiki_register_hooks(apr_pool_t * p)
Exemplo n.º 21
0
	const char* makeOptions;
	const char* includeFileTypes;
	const char* excludeFileTypes;
	// const char* excludeRegex;
	const char* errorURI;
	const char* errorCSS;
	int debug;
} dir_cfg;

static const char* cfg_set_filetype(cmd_parms* cmd, void* cfg, const char* val);
static void* create_dir_conf(apr_pool_t* pool, char* x);
static void make_hooks(apr_pool_t *pool);
	
static const command_rec cmds[]={
	AP_INIT_FLAG("Make",				  ap_set_flag_slot,   (void*)APR_OFFSETOF(dir_cfg,onoff),	        OR_ALL,"Enable mod_make"),
	AP_INIT_TAKE1("MakeSourceRoot",		  ap_set_string_slot, (void*)APR_OFFSETOF(dir_cfg,sourceRoot),	    OR_ALL,"Source root"),
	AP_INIT_TAKE1("MakeFilename",		  ap_set_string_slot, (void*)APR_OFFSETOF(dir_cfg,makefileName),    OR_ALL,"Make filename (i.e., Makefile)"),
	AP_INIT_TAKE1("MakeProgram",		  ap_set_string_slot, (void*)APR_OFFSETOF(dir_cfg,makeProgram),	    OR_ALL,"Make binary"),
	AP_INIT_TAKE1("MakeOptions",		  ap_set_string_slot, (void*)APR_OFFSETOF(dir_cfg,makeOptions),	    OR_ALL,"Make options"),
	AP_INIT_ITERATE("MakeIncludeFileTypes", cfg_set_filetype, (void*)APR_OFFSETOF(dir_cfg,includeFileTypes),OR_ALL,"Include file types"),
	AP_INIT_ITERATE("MakeExcludeFileTypes", cfg_set_filetype, (void*)APR_OFFSETOF(dir_cfg,excludeFileTypes),OR_ALL,"Exclude file types"),
	// AP_INIT_TAKE1("MakeExcludeRegex",	  ap_set_string_slot, (void*)APR_OFFSETOF(dir_cfg,excludeRegex),	OR_ALL,"Exclude regex"),
	AP_INIT_TAKE1("MakeErrorURI",		  ap_set_string_slot, (void*)APR_OFFSETOF(dir_cfg,errorURI),		OR_ALL,"Error URI"),
	AP_INIT_TAKE1("MakeErrorCSS",		  ap_set_string_slot, (void*)APR_OFFSETOF(dir_cfg,errorCSS),		OR_ALL,"Error CSS"),
	AP_INIT_FLAG("MakeDebug",			  ap_set_flag_slot,   (void*)APR_OFFSETOF(dir_cfg,debug),	        OR_ALL,"Enable mod_make debug mode"),
	{NULL}
};

module AP_MODULE_DECLARE_DATA make_module = {
        STANDARD20_MODULE_STUFF,
        create_dir_conf,
Exemplo n.º 22
0
        conf->user = NULL;
        conf->user_set = 0;

    }
    else {
	conf->user = user;
        conf->user_set = 1;

    }

    return NULL;
}


static const command_rec auth_env_cmds[] = {
	AP_INIT_TAKE1("AuthEnvUser", add_env_user, NULL, OR_AUTHCFG, 
		"Specify the username to set REMOTE_USER"),
        AP_INIT_FLAG("AuthEnvAuthoritative", set_authoritative, NULL, OR_AUTHCFG,
		"Set to 'Off' to allow access control to be passed along"),
	{ NULL }
};


static void *create_auth_env_dir_config(apr_pool_t *p, char *d)
{
    auth_env_config_rec *conf = apr_pcalloc(p, sizeof(*conf));

    /* Any failures are fatal. */
    conf->authoritative = 1;

    return conf;
}
Exemplo n.º 23
0
static const char
*set_cache_maxfs(cmd_parms *parms, void *in_struct_ptr, const char *arg)
{
    disk_cache_conf *conf = ap_get_module_config(parms->server->module_config,
                                                 &disk_cache_module);
    if (apr_strtoff(&conf->maxfs, arg, NULL, 0) != APR_SUCCESS ||
            conf->maxfs < 0) 
    {
        return "CacheMaxFileSize argument must be a non-negative integer representing the max size of a file to cache in bytes.";
    }
    return NULL;
}

static const command_rec disk_cache_cmds[] =
{
    AP_INIT_TAKE1("CacheRoot", set_cache_root, NULL, RSRC_CONF,
                 "The directory to store cache files"),
    AP_INIT_TAKE1("CacheDirLevels", set_cache_dirlevels, NULL, RSRC_CONF,
                  "The number of levels of subdirectories in the cache"),
    AP_INIT_TAKE1("CacheDirLength", set_cache_dirlength, NULL, RSRC_CONF,
                  "The number of characters in subdirectory names"),
    AP_INIT_TAKE1("CacheMinFileSize", set_cache_minfs, NULL, RSRC_CONF,
                  "The minimum file size to cache a document"),
    AP_INIT_TAKE1("CacheMaxFileSize", set_cache_maxfs, NULL, RSRC_CONF,
                  "The maximum file size to cache a document"),
    {NULL}
};

static const cache_provider cache_disk_provider =
{
    &remove_entity,
    &store_headers,
Exemplo n.º 24
0
}

static const char *set_dbm_type(cmd_parms *cmd, 
                                void *dir_config, 
                                const char *arg)
{
    dbm_auth_config_rec *conf = dir_config;
   
    conf->auth_dbmtype = apr_pstrdup(cmd->pool, arg);
    return NULL;
}

static const command_rec dbm_auth_cmds[] =
{
    AP_INIT_TAKE1("AuthDBMUserFile", ap_set_file_slot,
     (void *)APR_OFFSETOF(dbm_auth_config_rec, auth_dbmpwfile),
     OR_AUTHCFG, "dbm database file containing user IDs and passwords"),
    AP_INIT_TAKE1("AuthDBMGroupFile", ap_set_file_slot,
     (void *)APR_OFFSETOF(dbm_auth_config_rec, auth_dbmgrpfile),
     OR_AUTHCFG, "dbm database file containing group names and member user IDs"),
    AP_INIT_TAKE12("AuthUserFile", set_dbm_slot,
     (void *)APR_OFFSETOF(dbm_auth_config_rec, auth_dbmpwfile),
     OR_AUTHCFG, NULL),
    AP_INIT_TAKE12("AuthGroupFile", set_dbm_slot,
     (void *)APR_OFFSETOF(dbm_auth_config_rec, auth_dbmgrpfile),
     OR_AUTHCFG, NULL),
    AP_INIT_TAKE1("AuthDBMType", set_dbm_type,
     NULL,
     OR_AUTHCFG, "what type of DBM file the user file is"),
    AP_INIT_FLAG("AuthDBMAuthoritative", ap_set_flag_slot,
     (void *)APR_OFFSETOF(dbm_auth_config_rec, auth_dbmauthoritative),
Exemplo n.º 25
0
static const char* osrfHttpTranslatorGetConfigFile(cmd_parms *parms, void *config, const char *arg) {
    configFile = (char*) arg;
	return NULL;
}
static const char* osrfHttpTranslatorGetConfigFileCtx(cmd_parms *parms, void *config, const char *arg) {
    configCtx = (char*) arg;
	return NULL;
}
static const char* osrfHttpTranslatorGetCacheServer(cmd_parms *parms, void *config, const char *arg) {
    cacheServers = (char*) arg;
	return NULL;
}

/** set up the configuration handlers */
static const command_rec osrfHttpTranslatorCmds[] = {
	AP_INIT_TAKE1( OSRF_TRANSLATOR_CONFIG_FILE, osrfHttpTranslatorGetConfigFile,
			NULL, RSRC_CONF, "osrf translator config file"),
	AP_INIT_TAKE1( OSRF_TRANSLATOR_CONFIG_CTX, osrfHttpTranslatorGetConfigFileCtx,
			NULL, RSRC_CONF, "osrf translator config file context"),
	AP_INIT_TAKE1( OSRF_TRANSLATOR_CACHE_SERVER, osrfHttpTranslatorGetCacheServer,
			NULL, RSRC_CONF, "osrf translator cache server"),
    {NULL}
};


// there can only be one, so use a global static one
static osrfHttpTranslator globalTranslator;

/*
 * Constructs a new translator object based on the current apache 
 * request_rec.  Reads the request body and headers.
 */
Exemplo n.º 26
0
    }

    ap_log_rerror(APLOG_MARK, APLOG_INFO|APLOG_NOERRNO, 0, r,
                  conn->proxy_ips
                      ? "Using %s as client's IP by proxies %s"
                      : "Using %s as client's IP by internal proxies",
                  conn->proxied_ip, conn->proxy_ips);
    return OK;
}

static const command_rec reverseproxy_cmds[] =
{
    AP_INIT_FLAG("ReverseProxyEnable", reveseproxy_enable, NULL, RSRC_CONF,
                 "Enable mod_reverseproxy"),
    AP_INIT_TAKE1("ReverseProxyRemoteIPHeader", header_name_set, NULL, RSRC_CONF,
                  "Specifies a request header to trust as the client IP, "
                  "Overrides the default one"),
    AP_INIT_ITERATE("ReverseProxyRemoteIPTrusted", proxies_set, 0, RSRC_CONF,
                    "Specifies one or more proxies which are trusted "
                    "to present IP headers. Overrides the defaults."),
    { NULL }
};

static void register_hooks(apr_pool_t *p)
{
    // We need to run very early so as to not trip up mod_security.
    // Hence, this little trick, as mod_security runs at APR_HOOK_REALLY_FIRST.
    ap_hook_post_read_request(reverseproxy_modify_connection, NULL, NULL, APR_HOOK_REALLY_FIRST - 10);
}

module AP_MODULE_DECLARE_DATA reverseproxy_module = {
Exemplo n.º 27
0
                 rpaf_setport,
                 NULL,
                 RSRC_CONF,
                 "Let mod_rpaf set the server port from the X-Port header"
                 ),
    AP_INIT_ITERATE(
                 "RPAF_ProxyIPs",
                 rpaf_set_proxy_ip,
                 NULL,
                 RSRC_CONF,
                 "IP(s) of Proxy server setting X-Forwarded-For header"
                 ),
    AP_INIT_TAKE1(
                 "RPAF_Header",
                 rpaf_set_headername,
                 NULL,
                 RSRC_CONF,
                 "Which header to look for when trying to find the real ip of the client in a proxy setup"
                 ),
    { NULL }
};

static void register_hooks(apr_pool_t *p) {
    ap_hook_post_read_request(change_remote_ip, NULL, NULL, APR_HOOK_FIRST);
}

module AP_MODULE_DECLARE_DATA rpaf_module = {
    STANDARD20_MODULE_STUFF,
    NULL,
    NULL,
    rpaf_create_server_cfg,
Exemplo n.º 28
0
    hp.expire = atoi(arg);
  }
  return NULL;
}

static const char *debug_hostprotect(cmd_parms *cmd, void *cfg, const char arg[])
{
  if(arg != NULL && !strncmp(arg, "On", 2)) {
    hp.debug = 1;
  }
  return NULL;
}

static const command_rec hostprotect_module_directives[] =
{
  AP_INIT_TAKE1("HostProtect", enable_hostprotect, NULL, RSRC_CONF, "Enable/Disable HostProtect module."),
  AP_INIT_TAKE1("HostProtectResolver", resolver_hostprotect, NULL, RSRC_CONF, "Set resolver IP for HostProtect module."),
  AP_INIT_TAKE1("HostProtectPurger", purger_hostprotect, NULL, RSRC_CONF, "Set IP which can purge data from cache."),
  AP_INIT_TAKE1("HostProtectDebug", debug_hostprotect, NULL, RSRC_CONF, "Enable/Disable debug level."),
  AP_INIT_TAKE1("HostProtectExpire", expire_hostprotect, NULL, RSRC_CONF, "Set expire time of cache."),
  {NULL}
};

module AP_MODULE_DECLARE_DATA hostprotect_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 */
   hostprotect_module_directives,                  /* table of config file commands       */
   hostprotect_module_register_hooks  /* register hooks                      */
Exemplo n.º 29
0
}

static void *create_authz_dbm_dir_config(apr_pool_t *p, char *d)
{
    authz_dbm_config_rec *conf = apr_palloc(p, sizeof(*conf));

    conf->grpfile = NULL;
    conf->dbmtype = "default";

    return conf;
}

static const command_rec authz_dbm_cmds[] =
{
    AP_INIT_TAKE1("AuthDBMGroupFile", ap_set_file_slot,
     (void *)APR_OFFSETOF(authz_dbm_config_rec, grpfile),
     OR_AUTHCFG, "database file containing group names and member user IDs"),
    AP_INIT_TAKE1("AuthzDBMType", ap_set_string_slot,
     (void *)APR_OFFSETOF(authz_dbm_config_rec, dbmtype),
     OR_AUTHCFG, "what type of DBM file the group file is"),
    {NULL}
};

module AP_MODULE_DECLARE_DATA authz_dbm_module;

/* We do something strange with the group file.  If the group file
 * contains any : we assume the format is
 *      key=username value=":"groupname [":"anything here is ignored]
 * otherwise we now (0.8.14+) assume that the format is
 *      key=username value=groupname
 * The first allows the password and group files to be the same
Exemplo n.º 30
0
		 NULL,
		 RSRC_CONF | ACCESS_CONF | OR_FILEINFO,
		 "Inherit main server configurations or not. Only affect TrigerContentType, TrigerHTML, and TrigerCheckLength."),
    AP_INIT_FLAG("TrigerFullCheck",
		 set_full_chk,
		 NULL,
		 RSRC_CONF | ACCESS_CONF | OR_FILEINFO,
		 "Search each data bucket while no more than TrigerCheckLength, default is only check the first and last data buckets."),
    AP_INIT_ITERATE("TrigerContentType",
		    set_ctypes,
		    NULL,
		    RSRC_CONF | ACCESS_CONF | OR_FILEINFO,
		    "Which types response that we will inject our HTML fragment, default are 'text/html' and 'application/xhtml+xml'."),
    AP_INIT_TAKE1("TrigerHTML",
		  set_js,
		  NULL,
		  RSRC_CONF | ACCESS_CONF | OR_FILEINFO,
		  "HTML fragment that Triger will insert into responses bodies after <head> tag or before </body> tag,  or simple at the end if neither tags found."),
    AP_INIT_TAKE1("TrigerCheckLength",
		  set_chk_len,
		  NULL,
		  RSRC_CONF | ACCESS_CONF | OR_FILEINFO,
		  "How long contents we check to find tags so we know where to innsert our js coedes, f.g., <head> and </body>. Default is 256."),
    {
     NULL}
};

module AP_MODULE_DECLARE_DATA triger_module = {
    STANDARD20_MODULE_STUFF,
    create_triger_dir_config,
    merge_triger_dir_config,