1static char * nopass =
"";
10static char * create_cfg_cwd(
char * config_file)
15 if((wd_end = memrchr(config_file,
'/', strlen(config_file)))){
16 int wdlen = wd_end - config_file + 1;
19 wd = malloc(wdlen + 1);
21 printf(
"can't malloc for chdir\n");
25 memcpy(wd, config_file , wdlen);
33static int loadconfig(
char * filepath,
vc_ssl_cfg * cfg)
46 fd = open(filepath, O_RDONLY);
53 filelen = lseek(fd, 0, SEEK_END);
56 lseek(fd, 0, SEEK_SET);
57 filedata = malloc(filelen);
59 ret = read(fd, filedata, filelen);
66 tok = malloc(
sizeof(*tok) * tokcount);
69 ret =
jsmn_parse(&p, filedata, filelen, tok, tokcount);
71 tokcount = tokcount * 2;
72 tok = realloc_it(tok,
sizeof(*tok) * tokcount);
78 printf(
"failed ret = %d\n", ret);
80 printf(
"jsmn_parse %d\n", ret);
96 printf(
"didn't find keyfile\n");
99 printf(
"found keyfile = %s\n", rnode->
data.
data);
104 printf(
"didn't find rootCA\n");
107 printf(
"found rootca = %s\n", rnode->
data.
data);
112 printf(
"didn't find password\n");
120 printf(
"found password = %s\n", cfg->
password);
123 strcmp(rnode->
data.
data,
"enable") == 0){
124 printf(
"accept expired CA\n");
127 printf(
"reject expired CA\n");
int jsmn_parse(jsmn_parser *parser, const char *js, size_t len, jsmntok_t *tokens, unsigned int num_tokens)
Definition jsmn.c:151
void jsmn_init(jsmn_parser *parser)
Definition jsmn.c:309
@ JSMN_ERROR_NOMEM
Definition jsmn.h:27
int jstree_string_decode(char *out, int outlen, char *data)
Definition jstree.c:64
jstreeret js2tree(const char *js, jsmntok_t *t, size_t count)
Definition jstree.c:327
#define jstree_read(...)
Definition jstree_read.h:146
char * data
Definition jstree.h:5
struct _t_treenode * r
Definition jstree.h:11
_treenode_data data
Definition jstree.h:9
unsigned int toknext
Definition jsmn.h:56
_tree_node * node
Definition jstree.h:33
Definition vcom_load_sslcfg.h:3
char * rootca
Definition vcom_load_sslcfg.h:5
char * password
Definition vcom_load_sslcfg.h:4
int accept_expired_key
Definition vcom_load_sslcfg.h:7
char * keyfile
Definition vcom_load_sslcfg.h:6