Skip to content

Fix Bug #1175: bareos crashes with invalid character in ACL#410

Merged
arogge merged 4 commits intobareos:masterfrom
arogge:dev/arogge/master/fix-1175
Feb 11, 2020
Merged

Fix Bug #1175: bareos crashes with invalid character in ACL#410
arogge merged 4 commits intobareos:masterfrom
arogge:dev/arogge/master/fix-1175

Conversation

@arogge
Copy link
Member

@arogge arogge commented Feb 6, 2020

Bareos crashed when an invalid ACL syntax was detected. This patch adds a systemtest to check for this behaviour and a fix for the problem.

@@ -0,0 +1,24 @@
#!/bin/sh
#
# Run a simple backup
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment could help to understand that the config does not crash the director because of the invalid ACL Syntax.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unittest looks reasonable.


TEST(acl_entry_syntax_test, acl_entry_syntax_test)
{
std::vector<char> msg{};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
std::vector<char> msg{};
std::vector<char> msg;

@arogge arogge force-pushed the dev/arogge/master/fix-1175 branch 2 times, most recently from 7a77f17 to 3b65c5d Compare February 11, 2020 10:23
Bug bareos#1175 - bareos crashes with invalid character in ACL

When a profile configuration contains an entry that is detected as
invalid, the director crashes. This test reproduces this problem.
Previously Mmsg() would only write into a POOLMEM or PoolMem. This patch
adds another overload that allows Mmsg() to write to a std::vector<char>
and to automatically resize that vector as needed.
Fixes bareos#1175: bareos crashes with invalid character in ACL

Previously IsAclEntryValid() took a char* as a parameter that was
expected to be a POOLMEM (and would have been resized when an error
occured).
This char* has been replaced by a std::vector<char>& and the new
overload for Mmsg() is now used to format a message.
Bug bareos#1175: bareos crashes with invalid character in ACL

The newly introduced IsAclEntryValid() allowed only "!*.:_-'/" as chars
in an ACL. As regular expressions are possible in ACLs this list did not
allow some previously valid ACLs to be configured.
This patch extends the list to allow "!()[]|+?*.:_-'/" which will allow
most syntaxes.
We do not add "{}," intentionally, because this would re-allow the wrong
ACL syntaxes that the original change tried to catch (i.e. adding a
string with comma-separated resource names instead of a list of resource
names).
@arogge arogge force-pushed the dev/arogge/master/fix-1175 branch from 3b65c5d to 1449105 Compare February 11, 2020 10:48
@arogge arogge merged commit 3b6ebea into bareos:master Feb 11, 2020
@arogge arogge deleted the dev/arogge/master/fix-1175 branch August 10, 2020 08:10
@joergsteffens joergsteffens mentioned this pull request Jul 10, 2024
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants