Support to define ca-bundle

This commit is contained in:
Vivek Kumar Dutta 2024-04-23 12:04:27 +05:30 committed by Xiaofeng Meng
parent 21b23012d6
commit a310ec081e
3 changed files with 13 additions and 3 deletions

View file

@ -109,6 +109,7 @@ typedef struct config {
char acs_userid[BUF_SIZE_256];
char acs_passwd[BUF_SIZE_256];
char acs_ssl_capath[BUF_SIZE_256];
char acs_ssl_cabundle[BUF_SIZE_256];
char cpe_userid[BUF_SIZE_256];
char cpe_passwd[BUF_SIZE_256];
char custom_notify_json[BUF_SIZE_256];

View file

@ -107,7 +107,11 @@ static void http_set_security_options()
curl_easy_setopt(curl, CURLOPT_PASSWORD, cwmp_main->conf.acs_passwd);
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC | CURLAUTH_DIGEST);
if (CWMP_STRLEN(cwmp_main->conf.acs_ssl_capath) !=0 ) {
curl_easy_setopt(curl, CURLOPT_CAPATH, cwmp_main->conf.acs_ssl_capath);
} else if (CWMP_STRLEN(cwmp_main->conf.acs_ssl_cabundle) != 0) {
curl_easy_setopt(curl, CURLOPT_CAINFO, cwmp_main->conf.acs_ssl_cabundle);
}
if (cwmp_main->conf.insecure_enable) {
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);

View file

@ -138,8 +138,13 @@ static void config_get_acs_elements(struct uci_section *s)
snprintf(cwmp_main->conf.acs_passwd, sizeof(cwmp_main->conf.acs_passwd), "%s", get_value_from_uci_option(acs_tb[UCI_ACS_PASSWR]));
CWMP_LOG(DEBUG, "CWMP CONFIG - acs password: %s", cwmp_main->conf.acs_passwd);
snprintf(cwmp_main->conf.acs_ssl_capath, sizeof(cwmp_main->conf.acs_ssl_capath), "%s", get_value_from_uci_option(acs_tb[UCI_ACS_SSL_CAPATH]));
CWMP_LOG(DEBUG, "CWMP CONFIG - acs ssl capath: %s", cwmp_main->conf.acs_ssl_capath);
char *cert = get_value_from_uci_option(acs_tb[UCI_ACS_SSL_CAPATH]);
if (folder_exists(cert) == true) {
snprintf(cwmp_main->conf.acs_ssl_capath, sizeof(cwmp_main->conf.acs_ssl_capath), "%s", cert);
} else if (file_exists(cert) == true) {
snprintf(cwmp_main->conf.acs_ssl_cabundle, sizeof(cwmp_main->conf.acs_ssl_cabundle), "%s", cert);
}
CWMP_LOG(DEBUG, "CWMP CONFIG - acs ssl capath: %s", cert);
cwmp_main->conf.retry_min_wait_interval = DEFAULT_RETRY_MINIMUM_WAIT_INTERVAL;
char *acs_retry_min_wait_interval = get_value_from_uci_option(acs_tb[UCI_ACS_RETRY_MIN_WAIT_INTERVAL]);