add configuration otion to enable insecure mode

This commit is contained in:
imen.bhiri 2016-01-08 11:44:49 +01:00
parent 69ba798f4f
commit e00dd9b205
3 changed files with 17 additions and 0 deletions

View file

@ -511,6 +511,17 @@ int get_global_config(struct config *conf)
{
FREE(conf->acs_ssl_capath);
}
if((error = uci_get_value(UCI_ACS_INSECURE_ENABLE,&value)) == CWMP_OK)
{
if(value != NULL)
{
if ((strcasecmp(value,"true")==0) || (strcmp(value,"1")==0))
{
conf->insecure_enable = true;
}
value = NULL;
}
}
if((error = uci_get_value(UCI_ACS_SSL_VERSION,&value)) == CWMP_OK)
{
if(value != NULL)

4
http.c
View file

@ -191,6 +191,10 @@ http_send_message(struct cwmp *cwmp, char *msg_out, char **msg_in)
if (cwmp->conf.acs_ssl_capath)
curl_easy_setopt(curl, CURLOPT_CAPATH, cwmp->conf.acs_ssl_capath);
if (cwmp->conf.insecure_enable) {
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
}
*msg_in = (char *) calloc (1, sizeof(char));

View file

@ -41,6 +41,7 @@
#define UCI_ACS_PASSWD_PATH "cwmp.acs.passwd"
#define UCI_ACS_PARAMETERKEY_PATH "cwmp.acs.ParameterKey"
#define UCI_ACS_SSL_CAPATH "cwmp.acs.ssl_capath"
#define UCI_ACS_INSECURE_ENABLE "cwmp.acs.insecure_enable"
#define UCI_ACS_SSL_VERSION "cwmp.acs.ssl_version"
#define UCI_LOG_SEVERITY_PATH "cwmp.cpe.log_severity"
#define UCI_CPE_USERID_PATH "cwmp.cpe.userid"
@ -138,6 +139,7 @@ typedef struct config {
int period;
time_t time;
bool periodic_enable;
bool insecure_enable;
} config;
typedef struct env {