Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to one Participant per Context #515

Merged
merged 30 commits into from
Apr 3, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
31d3acc
Rename security_directory.* to security.*
ivanpauno Jan 31, 2020
f9aa67e
Switch to one participant per context
ivanpauno Oct 10, 2019
7009480
Add context name and namespace, allow configuring security directory …
ivanpauno Jan 24, 2020
d160c8d
Only destroy security options when they were created
ivanpauno Jan 31, 2020
d8cd5d5
Avoid mentioning node in security.*
ivanpauno Jan 31, 2020
9c5d594
Fix test_info_by_topic
ivanpauno Feb 4, 2020
61acc14
Add const where possible
ivanpauno Feb 4, 2020
859929c
Please linters
ivanpauno Feb 5, 2020
48864b8
Address peer review comments
ivanpauno Feb 17, 2020
deb4f94
Support overriding the security directory
ivanpauno Feb 18, 2020
08653d0
Rename test_security_directory to test_security
ivanpauno Feb 18, 2020
9134305
Reenable tests for security directory override
ivanpauno Feb 18, 2020
b4fe23a
Add test case for 'rcl_get_security_options_from_environment'
ivanpauno Feb 18, 2020
f7d9406
Delete unused local variable
ivanpauno Feb 27, 2020
717c444
Address peer review comments
ivanpauno Feb 28, 2020
ea4575f
Latest update after discussion about supporting sros2
ivanpauno Mar 12, 2020
4e48a4d
Delete namespace from security root path functions. Delete security d…
ivanpauno Mar 13, 2020
8680864
Delete unused headers
ivanpauno Mar 13, 2020
0fe8a0b
Correct rebasing error
ivanpauno Mar 13, 2020
c4807ba
Correct error in comment
ivanpauno Mar 16, 2020
7f1b51e
Naming: replace context_name with security_context
ivanpauno Mar 17, 2020
eb2e187
Addrees peer review comments
ivanpauno Mar 20, 2020
daad168
Please linters
ivanpauno Mar 20, 2020
50035e3
Replace RCL_CONTEXT_NAME_* with RCL_SECURITY_CONTEXT_NAME_*
ivanpauno Mar 20, 2020
b4d4738
* Use security_context instead of context_name everywhere
ivanpauno Mar 23, 2020
4c239f6
Please linters
ivanpauno Mar 23, 2020
86da265
Address peer review comments
ivanpauno Mar 26, 2020
46322dc
Address more reviewers' comments
ivanpauno Mar 26, 2020
000e2e3
Address reviewer comment
ivanpauno Mar 26, 2020
77aad14
Address peer review comments
ivanpauno Mar 30, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions rcl/include/rcl/graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,8 @@ rcl_get_node_names(

/// Return a list of available nodes in the ROS graph, including their security context names.
/**
* \sa Works like rcl_get_node_names, but it also include the security context name the node is
* using as an output.
* \sa An \ref rcl_get_node_names equivalent, but including in its output the security context
* name the node is using.
*
* <hr>
* Attribute | Adherence
Expand Down
4 changes: 2 additions & 2 deletions rcl/include/rcl/validate_security_context_name.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ extern "C"

/// Determine if a given security context name is valid.
/**
* /sa The same rules as rmw_validate_namespace are used.
* The only difference is the maximum length, which can be 255 characters.
* \sa The same rules as \ref rmw_validate_namespace are used.
ivanpauno marked this conversation as resolved.
Show resolved Hide resolved
* The only difference is in the maximum allowed length, which can be up to 255 characters.
*
* \param[in] security_context security_context to be validated
* \param[out] validation_result int in which the result of the check is stored
Expand Down
9 changes: 9 additions & 0 deletions rcl/src/rcl/arguments.c
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,15 @@ rcl_arguments_copy(
}
}
}
char * security_context_copy = rcutils_strdup(args->impl->security_context, allocator);
if (args->impl->security_context && !security_context_copy) {
if (RCL_RET_OK != rcl_arguments_fini(args_out)) {
RCL_SET_ERROR_MSG("Error while finalizing arguments due to another error");
}
RCL_SET_ERROR_MSG("Error while copying security context argument");
ivanpauno marked this conversation as resolved.
Show resolved Hide resolved
return RCL_RET_BAD_ALLOC;
}
args_out->impl->security_context = security_context_copy;
return RCL_RET_OK;
}

Expand Down
2 changes: 1 addition & 1 deletion rcl/src/rcl/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ rcl_init(
}
if (RCL_SECURITY_CONTEXT_NAME_VALID != validation_result) {
RCL_SET_ERROR_MSG_WITH_FORMAT_STRING(
"security context name is not valid: '%s'. Invalid index: %zu",
"Security context name is not valid: '%s'. Invalid index: %zu",
rcl_security_context_name_validation_result_string(validation_result),
invalid_index);
fail_ret = RMW_RET_ERROR;
Expand Down
18 changes: 9 additions & 9 deletions rcl/src/rcl/validate_security_context_name.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,18 @@ rcl_validate_security_context_name_with_size(
return RCL_RET_INVALID_ARGUMENT;
}

int t_validation_result;
size_t t_invalid_index;
int tmp_validation_result;
size_t tmp_invalid_index;
rmw_ret_t ret = rmw_validate_namespace_with_size(
security_context, security_context_length, &t_validation_result, &t_invalid_index);
security_context, security_context_length, &tmp_validation_result, &tmp_invalid_index);
if (ret != RMW_RET_OK) {
return rcl_convert_rmw_ret_to_rcl_ret(ret);
}

if (t_validation_result != RMW_NAMESPACE_VALID &&
t_validation_result != RMW_NAMESPACE_INVALID_TOO_LONG)
if (tmp_validation_result != RMW_NAMESPACE_VALID &&
tmp_validation_result != RMW_NAMESPACE_INVALID_TOO_LONG)
{
switch (t_validation_result) {
switch (tmp_validation_result) {
case RMW_NAMESPACE_INVALID_IS_EMPTY_STRING:
*validation_result = RCL_SECURITY_CONTEXT_NAME_INVALID_IS_EMPTY_STRING;
break;
Expand All @@ -91,7 +91,7 @@ rcl_validate_security_context_name_with_size(
default_err_msg, sizeof(default_err_msg),
"rcl_validate_security_context_name_with_size(): "
"unknown rmw_validate_namespace_with_size() result '%d'",
t_validation_result);
tmp_validation_result);
if (ret < 0) {
RCL_SET_ERROR_MSG(
"rcl_validate_security_context_name_with_size(): "
Expand All @@ -103,13 +103,13 @@ rcl_validate_security_context_name_with_size(
return RCL_RET_ERROR;
}
if (invalid_index) {
*invalid_index = t_invalid_index;
*invalid_index = tmp_invalid_index;
}
return RCL_RET_OK;
}

// security_context might be longer that namespace length, check false positives and correct
if (t_validation_result == RMW_NAMESPACE_INVALID_TOO_LONG &&
if (tmp_validation_result == RMW_NAMESPACE_INVALID_TOO_LONG &&
security_context_length <= RCL_SECURITY_CONTEXT_NAME_MAX_LENGTH)
{
*validation_result = RCL_SECURITY_CONTEXT_NAME_VALID;
Expand Down