Consider a simple NGINX module:
typedef struct {
ngx_array_t *claims;
} my_conf_t
static ngx_command_t my_commands[] = {
{ ngx_string("my_claims"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
ngx_conf_set_str_array_slot,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(my_conf_t, claims),
NULL },
ngx_null_command
};
static ngx_http_module_t my_module_ctx = {
NULL,
my_module_init,
NULL,
NULL,
NULL,
NULL,
my_module_create_loc_conf,
my_module_merge_loc_conf
};
ngx_module_t my_module = {
NGX_MODULE_V1,
&my_module_ctx,
my_commands,
NGX_HTTP_MODULE,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NGX_MODULE_V1_PADDING
};
Without even making use of claims
elsewhere in the module, this throws a segmentation fault during nginx -t
when my new config option is used:
location / {
my_claims test;
return 200 OK;
}
That config throws a segmentation fault while commenting/removing the location allows nginx -t
to succeed.
I looked examples for NGINX Mail SSL module (here and here) and I don't see what I'm missing.