|
|
|
@ -268,3 +268,24 @@ conn_sys_t *connections_create(void)
|
|
|
|
|
|
|
|
|
|
return nsys;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int connections_setsslserts(conn_sys_t *ssys, const char *rootca,
|
|
|
|
|
const char *certpem, const char *certkey)
|
|
|
|
|
{
|
|
|
|
|
int r = ENOMEM;
|
|
|
|
|
|
|
|
|
|
if(!ssys) return EINVAL;
|
|
|
|
|
/* simply copying */
|
|
|
|
|
if(!(ssys->rootca = strdup(rootca))) return ENOMEM;
|
|
|
|
|
if(!(ssys->certkey = strdup(certkey))) goto __fail;
|
|
|
|
|
if(!(ssys->certpem = strdup(certpem))) goto __fail;
|
|
|
|
|
|
|
|
|
|
r = 0;
|
|
|
|
|
return 0;
|
|
|
|
|
__fail:
|
|
|
|
|
if(ssys->rootca) free(ssys->rootca);
|
|
|
|
|
if(ssys->certkey) free(ssys->certkey);
|
|
|
|
|
if(ssys->certpem) free(ssys->certpem);
|
|
|
|
|
|
|
|
|
|
return r;
|
|
|
|
|
}
|
|
|
|
|