Repository navigation
Conversation
|
arm make check fail for env issue. try it again. |
|
anybody ? |
cbodley
left a comment
There was a problem hiding this comment.
according to the examples in https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_resource.html#reference_policies_elements_resource_wildcards, this matching should be greedy
There was a problem hiding this comment.
unfortunately, we can't assume that these string_views are null-terminated
There was a problem hiding this comment.
unfortunately, we can't assume that these string_views are null-terminated
#define EOS '\0'
static const char *rangematch(const char *, char, int);
int
fnmatch(const char *pattern, const char *string, int flags)
{
const char *stringstart;
char c, test;
for (stringstart = string;;)
switch (c = *pattern++) {
case EOS:
if ((flags & FNM_LEADING_DIR) && *string == '/')
return (0);
return (*string == EOS ? 0 : FNM_NOMATCH);
case '?':
There was a problem hiding this comment.
fnmatch() expects its input strings to be null-terminated, but std::string_view variables are not required to be null-terminated - that's why they don't have a c_str() member function. for example, match_policy() can break the arguments up by :s and call match_wildcards() on each substring. in that case, passing these std::string_view pattern, std::string_view input arguments directly to fnmatch() would try to match the entire strings (up to their null terminators) instead of just the substrings
if we are going to switch to fnmatch(), then the arguments to match_wildcards() and match_policy() should change to const char*s or const std::string&s to reflect that requirement
@adamemerson do you agree that we should handle the recursive/greedy matches? is fnmatch() is a good fit for this, or should we extend the existing matching logic?
There was a problem hiding this comment.
well for me 1) maybe; 2) probably not?
There was a problem hiding this comment.
is fnmatch() is a good fit for this, or should we extend the existing matching logic? @mattbenjamin @adamemerson
There was a problem hiding this comment.
Though I think I'd prefer extending the existing logic to extra allocations.
There was a problem hiding this comment.
@cbodley @adamemerson @mattbenjamin
What should we do next ?
Maybe one of us should extend the existing logic to extra allocations.
There was a problem hiding this comment.
@cbodley @adamemerson maybe change match_wildcards to recursive way?
There was a problem hiding this comment.
@qiuxinyidian sorry for the delays. i do think we should match aws' behavior for this parsing, and i'd rather not make this parsing too complicated in the process. so i do like your approach to use fnmatch()
if we are going to switch to
fnmatch(), then the arguments tomatch_wildcards()andmatch_policy()should change toconst char*s orconst std::string&s to reflect that requirement
can you try this way?
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
Signed-off-by: qiuxinyidian <[email protected]>
|
@cbodley please check it . |
|
@adamemerson please check it |
|
thanks @qiuxinyidian! |
Fixes: https://tracker.ceph.com/issues/62292
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "pacific"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windows