LCOV - code coverage report
Current view: top level - DCPS/security/framework - SecurityConfig.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 37 0.0 %
Date: 2023-04-30 01:32:43 Functions: 0 5 0.0 %

          Line data    Source code
       1             : /*
       2             :  *
       3             :  *
       4             :  * Distributed under the OpenDDS License.
       5             :  * See: http://www.opendds.org/license.html
       6             :  */
       7             : 
       8             : #include "DCPS/DdsDcps_pch.h" //Only the _pch include should start with DCPS/
       9             : #include "SecurityConfig.h"
      10             : 
      11             : #include "Properties.h"
      12             : 
      13             : #include <cstring>
      14             : 
      15             : OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
      16             : 
      17             : namespace OpenDDS {
      18             : namespace Security {
      19             : 
      20           0 : SecurityConfig::SecurityConfig(const OPENDDS_STRING& name,
      21             : #ifdef OPENDDS_SECURITY
      22             :                                Authentication_var authentication_plugin,
      23             :                                AccessControl_var access_ctrl_plugin,
      24             :                                CryptoKeyExchange_var key_exchange_plugin,
      25             :                                CryptoKeyFactory_var key_factory_plugin,
      26             :                                CryptoTransform_var transform_plugin,
      27             :                                DCPS::RcHandle<Utility> utility_plugin,
      28             : #endif
      29           0 :                                const ConfigPropertyList& properties)
      30           0 :   : name_(name)
      31             : #ifdef OPENDDS_SECURITY
      32           0 :   , authentication_plugin_(authentication_plugin)
      33           0 :   , access_control_plugin_(access_ctrl_plugin)
      34           0 :   , key_exchange_plugin_(key_exchange_plugin)
      35           0 :   , key_factory_plugin_(key_factory_plugin)
      36           0 :   , transform_plugin_(transform_plugin)
      37           0 :   , utility_plugin_(utility_plugin)
      38             : #endif
      39           0 :   , properties_(properties)
      40           0 : {}
      41             : 
      42           0 : SecurityConfig::~SecurityConfig()
      43             : {
      44             : #ifdef OPENDDS_SECURITY
      45           0 :   if (DCPS::security_debug.bookkeeping) {
      46           0 :     ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) {bookkeeping} ")
      47             :                ACE_TEXT("SecurityConfig::~SecurityConfig handle_registry_map_ %B\n"),
      48             :                handle_registry_map_.size()));
      49             :   }
      50             : #endif
      51           0 : }
      52             : 
      53           0 : void SecurityConfig::get_properties(DDS::PropertyQosPolicy& out_properties) const
      54             : {
      55             :   // The names on the internal attributes of the PropertyQosPolicy are
      56             :   // strange, but value is a properties sequence
      57             : 
      58             :   // Allocate space and copy over the properties
      59             :   // Presumably this will not be truncating the property count
      60           0 :   out_properties.value.length(static_cast<CORBA::ULong>(properties_.size()));
      61           0 :   CORBA::ULong index = 0;
      62           0 :   for (ConfigPropertyList::const_iterator iProp = properties_.begin();
      63           0 :        iProp != properties_.end();
      64           0 :        ++iProp) {
      65           0 :     DDS::Property_t& out_prop = out_properties.value[index++];
      66           0 :     out_prop.name = iProp->first.c_str();
      67           0 :     out_prop.value = iProp->second.c_str();
      68             :   }
      69           0 : }
      70             : 
      71           0 : bool SecurityConfig::qos_implies_security(const DDS::DomainParticipantQos& qos) const {
      72           0 :   const DDS::PropertySeq& properties = qos.property.value;
      73           0 :   for (unsigned int idx = 0; idx != properties.length(); ++idx) {
      74           0 :     const char* name = properties[idx].name.in();
      75           0 :     if (std::strcmp(DDS::Security::Properties::AuthIdentityCA, name) == 0 ||
      76           0 :         std::strcmp(DDS::Security::Properties::AuthIdentityCertificate, name) == 0 ||
      77           0 :         std::strcmp(DDS::Security::Properties::AuthPrivateKey, name) == 0 ||
      78           0 :         std::strcmp(DDS::Security::Properties::AccessPermissionsCA, name) == 0 ||
      79           0 :         std::strcmp(DDS::Security::Properties::AccessGovernance, name) == 0 ||
      80           0 :         std::strcmp(DDS::Security::Properties::AccessPermissions, name) == 0) {
      81           0 :       return true;
      82             :     }
      83             :   }
      84           0 :   return false;
      85             : }
      86             : 
      87             : }
      88             : }
      89             : 
      90             : OPENDDS_END_VERSIONED_NAMESPACE_DECL

Generated by: LCOV version 1.16