Replace pp null check by assert in dds_create_writer and dds_create_reader, and rewrite logic in q_omg_security_check_remote_writer_permissions

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
This commit is contained in:
Dennis Potman 2020-04-21 09:37:09 +02:00 committed by eboasson
parent e8c349f96d
commit 7e6039763b
3 changed files with 38 additions and 47 deletions

View file

@ -456,12 +456,11 @@ static dds_entity_t dds_create_reader_int (dds_entity_t participant_or_subscribe
thread_state_awake (lookup_thread_state (), gv);
const struct ddsi_guid * ppguid = dds_entity_participant_guid (&sub->m_entity);
struct participant * pp = entidx_lookup_participant_guid (gv->entity_index, ppguid);
if (pp == NULL)
{
GVLOGDISC ("new_reader - participant "PGUIDFMT" not found\n", PGUID (*ppguid));
rc = DDS_RETCODE_BAD_PARAMETER;
goto err_pp_not_found;
}
/* When deleting a participant, the child handles (that include the subscriber)
are removed before removing the DDSI participant. So at this point, within
the subscriber lock, we can assert that the participant exists. */
assert (pp != NULL);
#ifdef DDSI_INCLUDE_SECURITY
/* Check if DDS Security is enabled */
@ -508,9 +507,8 @@ static dds_entity_t dds_create_reader_int (dds_entity_t participant_or_subscribe
#ifdef DDSI_INCLUDE_SECURITY
err_not_allowed:
#endif
err_pp_not_found:
thread_state_asleep (lookup_thread_state ());
#endif
err_bad_qos:
dds_delete_qos (rqos);
dds_topic_allow_set_qos (tp);

View file

@ -329,12 +329,10 @@ dds_entity_t dds_create_writer (dds_entity_t participant_or_publisher, dds_entit
thread_state_awake (lookup_thread_state (), gv);
const struct ddsi_guid *ppguid = dds_entity_participant_guid (&pub->m_entity);
struct participant *pp = entidx_lookup_participant_guid (gv->entity_index, ppguid);
if (pp == NULL)
{
GVLOGDISC ("new_writer - participant "PGUIDFMT" not found\n", PGUID (*ppguid));
rc = DDS_RETCODE_BAD_PARAMETER;
goto err_pp_not_found;
}
/* When deleting a participant, the child handles (that include the publisher)
are removed before removing the DDSI participant. So at this point, within
the publisher lock, we can assert that the participant exists. */
assert (pp != NULL);
#ifdef DDSI_INCLUDE_SECURITY
/* Check if DDS Security is enabled */
@ -377,9 +375,8 @@ dds_entity_t dds_create_writer (dds_entity_t participant_or_publisher, dds_entit
#ifdef DDSI_INCLUDE_SECURITY
err_not_allowed:
#endif
err_pp_not_found:
thread_state_asleep (lookup_thread_state ());
#endif
err_bad_qos:
dds_delete_qos(wqos);
dds_topic_allow_set_qos (tp);