mirror of
https://github.com/kakwa/uts-server
synced 2025-01-10 05:34:29 +01:00
fix relative path loading for https certificate/key/ca file
This commit is contained in:
parent
a09db515ca
commit
5b3c90bf07
@ -10,6 +10,7 @@
|
|||||||
#define HTTP_OPTIONS 1
|
#define HTTP_OPTIONS 1
|
||||||
#define LOGLEVEL_OPTIONS 2
|
#define LOGLEVEL_OPTIONS 2
|
||||||
#define TSA_OPTIONS 3
|
#define TSA_OPTIONS 3
|
||||||
|
#define PATH_HTTP_OPTIONS 4
|
||||||
#define MAIN_CONF_SECTION "main"
|
#define MAIN_CONF_SECTION "main"
|
||||||
|
|
||||||
#define RFC3161_OPTIONS_LEN \
|
#define RFC3161_OPTIONS_LEN \
|
||||||
@ -23,20 +24,30 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint64_t query_counter;
|
uint64_t query_counter;
|
||||||
|
// flag for debugging
|
||||||
bool stdout_dbg;
|
bool stdout_dbg;
|
||||||
|
// log level
|
||||||
int loglevel;
|
int loglevel;
|
||||||
|
// number of threads
|
||||||
int numthreads;
|
int numthreads;
|
||||||
|
// civetweb http parameters
|
||||||
const char *http_options[40];
|
const char *http_options[40];
|
||||||
ts_resp_ctx_wrapper *ts_ctx_pool;
|
ts_resp_ctx_wrapper *ts_ctx_pool;
|
||||||
|
|
||||||
|
// just to track for freeing later
|
||||||
CONF *conf;
|
CONF *conf;
|
||||||
|
char *cust_conf[20];
|
||||||
} rfc3161_context;
|
} rfc3161_context;
|
||||||
|
|
||||||
|
// definition of structure to describe
|
||||||
|
// section [ main ] attributes (name, type and default value)
|
||||||
struct rfc3161_option {
|
struct rfc3161_option {
|
||||||
const char *name;
|
const char *name;
|
||||||
int type;
|
int type;
|
||||||
const char *default_value;
|
const char *default_value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// declaration of section [ main ] parameters and their default values
|
||||||
static struct rfc3161_option rfc3161_options[] = {
|
static struct rfc3161_option rfc3161_options[] = {
|
||||||
{"num_threads", HTTP_OPTIONS, "10"},
|
{"num_threads", HTTP_OPTIONS, "10"},
|
||||||
{"run_as_user", HTTP_OPTIONS, NULL},
|
{"run_as_user", HTTP_OPTIONS, NULL},
|
||||||
@ -44,10 +55,7 @@ static struct rfc3161_option rfc3161_options[] = {
|
|||||||
{"enable_keep_alive", HTTP_OPTIONS, "no"},
|
{"enable_keep_alive", HTTP_OPTIONS, "no"},
|
||||||
{"listening_ports", HTTP_OPTIONS, "8080"},
|
{"listening_ports", HTTP_OPTIONS, "8080"},
|
||||||
{"request_timeout_ms", HTTP_OPTIONS, "30000"},
|
{"request_timeout_ms", HTTP_OPTIONS, "30000"},
|
||||||
{"ssl_certificate", HTTP_OPTIONS, NULL},
|
|
||||||
{"ssl_verify_peer", HTTP_OPTIONS, "yes"},
|
{"ssl_verify_peer", HTTP_OPTIONS, "yes"},
|
||||||
{"ssl_ca_path", HTTP_OPTIONS, NULL},
|
|
||||||
{"ssl_ca_file", HTTP_OPTIONS, NULL},
|
|
||||||
{"ssl_verify_depth", HTTP_OPTIONS, "9"},
|
{"ssl_verify_depth", HTTP_OPTIONS, "9"},
|
||||||
{"ssl_default_verify_paths", HTTP_OPTIONS, "yes"},
|
{"ssl_default_verify_paths", HTTP_OPTIONS, "yes"},
|
||||||
{"ssl_cipher_list", HTTP_OPTIONS, NULL},
|
{"ssl_cipher_list", HTTP_OPTIONS, NULL},
|
||||||
@ -56,4 +64,7 @@ static struct rfc3161_option rfc3161_options[] = {
|
|||||||
{"access_control_allow_origin", HTTP_OPTIONS, "*"},
|
{"access_control_allow_origin", HTTP_OPTIONS, "*"},
|
||||||
{"tcp_nodelay", HTTP_OPTIONS, "0"},
|
{"tcp_nodelay", HTTP_OPTIONS, "0"},
|
||||||
{"log_level", LOGLEVEL_OPTIONS, "info"},
|
{"log_level", LOGLEVEL_OPTIONS, "info"},
|
||||||
|
{"ssl_certificate", PATH_HTTP_OPTIONS, NULL},
|
||||||
|
{"ssl_ca_path", PATH_HTTP_OPTIONS, NULL},
|
||||||
|
{"ssl_ca_file", PATH_HTTP_OPTIONS, NULL},
|
||||||
};
|
};
|
||||||
|
@ -275,6 +275,7 @@ int set_params(rfc3161_context *ct, char *conf_file, char *conf_wd) {
|
|||||||
chdir(conf_wd);
|
chdir(conf_wd);
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
int http_counter = 0;
|
int http_counter = 0;
|
||||||
|
int cust_counter = 0;
|
||||||
int numthreads = 42;
|
int numthreads = 42;
|
||||||
|
|
||||||
NCONF_free(ct->conf);
|
NCONF_free(ct->conf);
|
||||||
@ -339,7 +340,16 @@ int set_params(rfc3161_context *ct, char *conf_file, char *conf_wd) {
|
|||||||
numthreads = atoi(value);
|
numthreads = atoi(value);
|
||||||
break;
|
break;
|
||||||
;
|
;
|
||||||
case TSA_OPTIONS:
|
case PATH_HTTP_OPTIONS:
|
||||||
|
if (value != NULL) {
|
||||||
|
char *ptr = NULL;
|
||||||
|
ptr = realpath(value, NULL);
|
||||||
|
ct->http_options[http_counter] = name;
|
||||||
|
http_counter++;
|
||||||
|
ct->http_options[http_counter] = ptr;
|
||||||
|
http_counter++;
|
||||||
|
ct->cust_conf[cust_counter] = ptr;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
@ -372,6 +382,9 @@ void free_uts_context(rfc3161_context *ct) {
|
|||||||
for (int i = 0; i < ct->numthreads; i++) {
|
for (int i = 0; i < ct->numthreads; i++) {
|
||||||
TS_RESP_CTX_free(ct->ts_ctx_pool[i].ts_ctx);
|
TS_RESP_CTX_free(ct->ts_ctx_pool[i].ts_ctx);
|
||||||
}
|
}
|
||||||
|
for (int i = 0; i < 20; i++) {
|
||||||
|
free(ct->cust_conf[i]);
|
||||||
|
}
|
||||||
free(ct->ts_ctx_pool);
|
free(ct->ts_ctx_pool);
|
||||||
NCONF_free(ct->conf);
|
NCONF_free(ct->conf);
|
||||||
free(ct);
|
free(ct);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user