static void * ngx_http_modsecurity_create_loc_conf(ngx_conf_t *cf) { ngx_http_modsecurity_loc_conf_t *conf; ngx_pool_cleanup_t *cln = NULL; conf = (ngx_http_modsecurity_loc_conf_t *) ngx_palloc(cf->pool, sizeof(ngx_http_modsecurity_loc_conf_t)); dd("creating a location specific conf"); if (conf == NULL) { dd("Failed to allocate space for a location specific conf"); return NGX_CONF_ERROR; } conf->enable = NGX_CONF_UNSET; conf->rules_remote_server.len = 0; conf->rules_remote_server.data = NULL; conf->rules_remote_key.len = 0; conf->rules_remote_key.data = NULL; conf->rules_file.len = 0; conf->rules_file.data = NULL; conf->rules.len = 0; conf->rules.data = NULL; conf->id = 0; /* Create a new rules instance */ conf->rules_set = msc_create_rules_set(); dd("created a location specific conf -- RuleSet is at: \"%p\"", conf->rules_set); //msc_rules_dump(conf->rules_set); // This was for debug cln = ngx_pool_cleanup_add(cf->pool, 0); if (cln == NULL) { dd("failed to create the ModSecurity location specific configuration cleanup"); return NGX_CONF_ERROR; } cln->handler = ngx_http_modsecurity_config_cleanup; cln->data = conf; return conf; }
void *apache_http_modsecurity_create_loc_conf(apr_pool_t *mp, char *path){ apache_http_modsecurity_loc_conf_t *cf; cf = (apache_http_modsecurity_loc_conf_t *)apr_palloc(mp, sizeof(apache_http_modsecurity_loc_conf_t)); if (cf == NULL) { fprintf(stderr,"Couldn't allocate space for our location specific configurations"); return NULL; } cf->rules_set = msc_create_rules_set(); cf->rules_file = NULL; cf->rules_remote_server = NULL; cf->rules_remote_key = NULL; cf->enable = 1; cf->id = 0; fprintf(stderr,"ModSecurity creating a location configuration\n"); msc_rules_dump(cf->rules_set); return cf; }