forgotten function added;

This commit is contained in:
Alexander Vdolainen 2015-07-23 14:57:30 +03:00
parent 6d553ffab8
commit aa62df3885
2 changed files with 24 additions and 0 deletions

View File

@ -202,6 +202,9 @@ int connections_destroy(conn_sys_t *ssys);
int connections_free(conn_sys_t *ssys);
int connections_setsslserts(conn_sys_t *ssys, const char *rootca,
const char *certpem, const char *certkey);
/* create links */
conn_t *connection_master_link(conn_sys_t *ssys, int sck, struct in_addr *addr);
conn_t *connection_link(conn_sys_t *ssys, const char *host,

View File

@ -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;
}