| 1283 | void dynamic_hook(MessageType&) {} |
| 1284 | |
| 1285 | bool store_instance_data_check(unique_ptr<MessageTypeWithAllocator>& instance_data, |
| 1286 | DDS::InstanceHandle_t publication_handle, |
| 1287 | const OpenDDS::DCPS::DataSampleHeader& header, |
| 1288 | OpenDDS::DCPS::SubscriptionInstance_rch& instance_ptr) |
| 1289 | { |
| 1290 | #if OPENDDS_CONFIG_SECURITY && OPENDDS_HAS_DYNAMIC_DATA_ADAPTER |
| 1291 | const bool is_dispose_msg = |
| 1292 | header.message_id_ == OpenDDS::DCPS::DISPOSE_INSTANCE || |
| 1293 | header.message_id_ == OpenDDS::DCPS::DISPOSE_UNREGISTER_INSTANCE; |
| 1294 | |
| 1295 | if (!is_bit() && security_config_) { |
| 1296 | if (header.message_id_ == SAMPLE_DATA || |
| 1297 | header.message_id_ == INSTANCE_REGISTRATION) { |
| 1298 | |
| 1299 | // Pubulisher has already gone through the check. |
| 1300 | if (instance_ptr && |
| 1301 | instance_ptr->instance_state_ && |
| 1302 | instance_ptr->instance_state_->writes_instance(header.publication_id_)) { |
| 1303 | return true; |
| 1304 | } |
| 1305 | |
| 1306 | DDS::Security::SecurityException ex; |
| 1307 | const GUID_t local_participant = make_part_guid(subscription_id()); |
| 1308 | const GUID_t remote_participant = make_part_guid(header.publication_id_); |
| 1309 | const DDS::Security::ParticipantCryptoHandle remote_participant_permissions_handle = security_config_->get_handle_registry(local_participant)->get_remote_participant_permissions_handle(remote_participant); |
| 1310 | // Construct a DynamicData around the deserialized sample. |
| 1311 | DDS::DynamicData_var dda = |
| 1312 | XTypes::get_dynamic_data_adapter(dynamic_type_, *instance_data->message()); |
| 1313 | // The remote participant might not be using security. |
| 1314 | if (remote_participant_permissions_handle != DDS::HANDLE_NIL && |
| 1315 | !security_config_->get_access_control()->check_remote_datawriter_register_instance(remote_participant_permissions_handle, this, publication_handle, dda, ex)) { |
| 1316 | if (log_level >= LogLevel::Warning) { |
| 1317 | ACE_ERROR((LM_WARNING, |
| 1318 | "(%P|%t) WARNING: DataReaderImpl_T::store_instance_data_check: unable to register instance SecurityException[%d.%d]: %C\n", |
| 1319 | ex.code, ex.minor_code, ex.message.in())); |
| 1320 | } |
| 1321 | return false; |
| 1322 | } |
| 1323 | } else if (is_dispose_msg) { |
| 1324 | |
| 1325 | DDS::Security::SecurityException ex; |
| 1326 | const GUID_t local_participant = make_part_guid(subscription_id()); |
| 1327 | const GUID_t remote_participant = make_part_guid(header.publication_id_); |
| 1328 | const DDS::Security::ParticipantCryptoHandle remote_participant_permissions_handle = security_config_->get_handle_registry(local_participant)->get_remote_participant_permissions_handle(remote_participant); |
| 1329 | // Construct a DynamicData around the deserialized sample. |
| 1330 | DDS::DynamicData_var dda = |
| 1331 | XTypes::get_dynamic_data_adapter(dynamic_type_, *instance_data->message()); |
| 1332 | // The remote participant might not be using security. |
| 1333 | if (remote_participant_permissions_handle != DDS::HANDLE_NIL && |
| 1334 | !security_config_->get_access_control()->check_remote_datawriter_dispose_instance(remote_participant_permissions_handle, this, publication_handle, dda, ex)) { |
| 1335 | if (log_level >= LogLevel::Warning) { |
| 1336 | ACE_ERROR((LM_WARNING, |
| 1337 | "(%P|%t) WARNING: DataReaderImpl_T::store_instance_data_check: unable to dispose instance SecurityException[%d.%d]: %C\n", |
| 1338 | ex.code, ex.minor_code, ex.message.in())); |
| 1339 | } |
| 1340 | return false; |
| 1341 | } |
| 1342 | } |
no test coverage detected