Skip to content

Commit

Permalink
fix(plugin): Always clean up the previously configured certificate ve…
Browse files Browse the repository at this point in the history
…rification plugin
  • Loading branch information
jpfr committed Sep 22, 2024
1 parent af1abb2 commit ee79096
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions plugins/ua_config_default.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ setDefaultConfig(UA_ServerConfig *conf) {

/* Certificate Verification that accepts every certificate. Can be
* overwritten when the policy is specialized. */
if(conf->certificateVerification.clear)
conf->certificateVerification.clear(&conf->certificateVerification);
UA_CertificateVerification_AcceptAll(&conf->certificateVerification);

/* * Global Node Lifecycle * */
Expand Down Expand Up @@ -685,6 +687,8 @@ UA_ServerConfig_setDefaultWithSecurityPolicies(UA_ServerConfig *conf,
return retval;
}

if(conf->certificateVerification.clear)
conf->certificateVerification.clear(&conf->certificateVerification);
retval = UA_CertificateVerification_Trustlist(&conf->certificateVerification,
trustList, trustListSize,
issuerList, issuerListSize,
Expand Down Expand Up @@ -758,6 +762,8 @@ UA_ClientConfig_setDefault(UA_ClientConfig *config) {

/* Certificate Verification that accepts every certificate. Can be
* overwritten when the policy is specialized. */
if(config->certificateVerification.clear)
config->certificateVerification.clear(&config->certificateVerification);
UA_CertificateVerification_AcceptAll(&config->certificateVerification);
UA_LOG_WARNING(&config->logger, UA_LOGCATEGORY_USERLAND,
"AcceptAll Certificate Verification. "
Expand Down Expand Up @@ -816,6 +822,8 @@ UA_ClientConfig_setDefaultEncryption(UA_ClientConfig *config,
if(retval != UA_STATUSCODE_GOOD)
return retval;

if(config->certificateVerification.clear)
config->certificateVerification.clear(&config->certificateVerification);
retval = UA_CertificateVerification_Trustlist(&config->certificateVerification,
trustList, trustListSize,
NULL, 0,
Expand Down

0 comments on commit ee79096

Please sign in to comment.