summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSage Weil <sage@redhat.com>2018-08-12 20:29:00 +0200
committerSage Weil <sage@redhat.com>2018-08-31 22:54:58 +0200
commit0ce73796fdb3feabf42d46d86ec9d234fee4c2ce (patch)
treee9d785caea81674748ff471b309c3e77c4585e8a
parentosd/OSDCap: remove auid from is_capable() etc args (diff)
downloadceph-0ce73796fdb3feabf42d46d86ec9d234fee4c2ce.tar.xz
ceph-0ce73796fdb3feabf42d46d86ec9d234fee4c2ce.zip
osd/OSDCap: remove auid from grammar
This is an incompatible change: old caps that include auid will no longer parse. Signed-off-by: Sage Weil <sage@redhat.com>
-rw-r--r--src/mon/OSDMonitor.cc2
-rw-r--r--src/osd/OSDCap.cc17
-rw-r--r--src/osd/OSDCap.h5
-rw-r--r--src/test/osd/osdcap.cc6
4 files changed, 8 insertions, 22 deletions
diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc
index 250e9cc7c19..ea333b62ec9 100644
--- a/src/mon/OSDMonitor.cc
+++ b/src/mon/OSDMonitor.cc
@@ -100,7 +100,7 @@ bool is_osd_writable(const OSDCapGrant& grant, const std::string* pool_name) {
auto& match = grant.match;
if (match.is_match_all()) {
return true;
- } else if (pool_name != nullptr && match.auid < 0 &&
+ } else if (pool_name != nullptr &&
!match.pool_namespace.pool_name.empty() &&
match.pool_namespace.pool_name == *pool_name) {
return true;
diff --git a/src/osd/OSDCap.cc b/src/osd/OSDCap.cc
index d482da727f0..ee1e947b088 100644
--- a/src/osd/OSDCap.cc
+++ b/src/osd/OSDCap.cc
@@ -85,10 +85,6 @@ ostream& operator<<(ostream &out, const OSDCapPoolTag &pt)
ostream& operator<<(ostream& out, const OSDCapMatch& m)
{
- if (m.auid != -1LL) {
- out << "auid " << m.auid << " ";
- }
-
if (!m.pool_namespace.pool_name.empty() || m.pool_namespace.nspace) {
out << m.pool_namespace;
}
@@ -193,9 +189,7 @@ bool OSDCapMatch::is_match(const string& pn, const string& ns,
bool OSDCapMatch::is_match_all() const
{
- if (auid >= 0) {
- return false;
- } else if (!pool_namespace.is_match_all()) {
+if (!pool_namespace.is_match_all()) {
return false;
} else if (!pool_tag.is_match_all()) {
return false;
@@ -338,9 +332,9 @@ void OSDCapGrant::expand_profile()
if (profile.name == "rbd") {
// RBD read-write grant
- profile_grants.emplace_back(OSDCapMatch({}, "rbd_children"),
+ profile_grants.emplace_back(OSDCapMatch(string(), "rbd_children"),
OSDCapSpec(osd_rwxa_t(OSD_CAP_CLS_R)));
- profile_grants.emplace_back(OSDCapMatch({}, "rbd_mirroring"),
+ profile_grants.emplace_back(OSDCapMatch(string(), "rbd_mirroring"),
OSDCapSpec(osd_rwxa_t(OSD_CAP_CLS_R)));
profile_grants.emplace_back(OSDCapMatch(profile.pool_namespace),
OSDCapSpec(osd_rwxa_t(OSD_CAP_R |
@@ -437,8 +431,7 @@ struct OSDCapParser : qi::grammar<Iterator, OSDCap()>
>> (lit('=') | spaces)
>> estr >> -char_('*'));
- // match := [pool[=]<poolname> [namespace[=]<namespace>] | auid <123>] [object_prefix <prefix>]
- auid %= (spaces >> lit("auid") >> spaces >> int_);
+ // match := [pool[=]<poolname> [namespace[=]<namespace>]] [object_prefix <prefix>]
object_prefix %= -(spaces >> lit("object_prefix") >> spaces >> str);
pooltag %= (spaces >> lit("tag")
>> spaces >> str // application
@@ -448,7 +441,6 @@ struct OSDCapParser : qi::grammar<Iterator, OSDCap()>
match = (
pooltag [_val = phoenix::construct<OSDCapMatch>(_1)] |
(nspace >> pooltag) [_val = phoenix::construct<OSDCapMatch>(_1, _2)] |
- (auid >> object_prefix) [_val = phoenix::construct<OSDCapMatch>(_1, _2)] |
(pool_name >> nspace >> object_prefix) [_val = phoenix::construct<OSDCapMatch>(_1, _2, _3)] |
(pool_name >> object_prefix) [_val = phoenix::construct<OSDCapMatch>(_1, _2)]
);
@@ -499,7 +491,6 @@ struct OSDCapParser : qi::grammar<Iterator, OSDCap()>
qi::rule<Iterator, string()> unquoted_word;
qi::rule<Iterator, string()> str, estr, network_str;
qi::rule<Iterator, string()> wildcard;
- qi::rule<Iterator, int()> auid;
qi::rule<Iterator, string()> class_name;
qi::rule<Iterator, string()> method_name;
qi::rule<Iterator, OSDCapSpec()> capspec;
diff --git a/src/osd/OSDCap.h b/src/osd/OSDCap.h
index 7f4bc0ff030..2bb4e21ca1a 100644
--- a/src/osd/OSDCap.h
+++ b/src/osd/OSDCap.h
@@ -119,8 +119,6 @@ ostream& operator<<(ostream& out, const OSDCapPoolTag& pt);
struct OSDCapMatch {
typedef std::map<std::string, std::map<std::string, std::string> > app_map_t;
- // auid and pool_name/nspace are mutually exclusive
- int64_t auid = CEPH_AUTH_UID_DEFAULT;
OSDCapPoolNamespace pool_namespace;
OSDCapPoolTag pool_tag;
std::string object_prefix;
@@ -135,8 +133,6 @@ struct OSDCapMatch {
OSDCapMatch(const std::string& pl, const std::string& ns,
const std::string& pre)
: pool_namespace(pl, ns), object_prefix(pre) {}
- OSDCapMatch(uint64_t auid, const std::string& pre)
- : auid(auid), object_prefix(pre) {}
OSDCapMatch(const std::string& dummy, const std::string& app,
const std::string& key, const std::string& val)
: pool_tag(app, key, val) {}
@@ -148,7 +144,6 @@ struct OSDCapMatch {
*
* @param pool_name pool name
* @param nspace_name namespace name
- * @param pool_auid pool's auid
* @param object object name
* @return true if we match, false otherwise
*/
diff --git a/src/test/osd/osdcap.cc b/src/test/osd/osdcap.cc
index f87234f37c8..55dd0e526e3 100644
--- a/src/test/osd/osdcap.cc
+++ b/src/test/osd/osdcap.cc
@@ -34,12 +34,10 @@ const char *parse_good[] = {
"allow pool taco object_prefix obj_with_underscores_and_no_quotes wx",
"allow rwx pool 'weird name'",
"allow rwx pool \"weird name with ''s\"",
- "allow rwx auid 123",
"allow rwx pool foo, allow r pool bar",
"allow rwx pool foo ; allow r pool bar",
"allow rwx pool foo ;allow r pool bar",
"allow rwx pool foo; allow r pool bar",
- "allow auid 123 rwx",
"allow pool foo rwx, allow pool bar r",
"allow pool foo.froo.foo rwx, allow pool bar r",
"allow pool foo rwx ; allow pool bar r",
@@ -61,7 +59,6 @@ const char *parse_good[] = {
" allow pool foo rwx; allow pool bar r ",
" allow wx pool taco",
"\tallow\nwx\tpool \n taco\t",
- "allow r pool foo object_prefix blah ; allow w auid 5",
"allow class-read object_prefix rbd_children, allow pool libvirt-pool-test rwx",
"allow class-read object_prefix rbd-children, allow pool libvirt_pool_test rwx",
"allow pool foo namespace nfoo rwx, allow pool bar namespace=nbar r",
@@ -122,6 +119,9 @@ const char *parse_bad[] = {
"allow rwx auid 123 namespace asdf",
"allow wwx pool ''",
"allow rwx tag application key value",
+ "allow rwx auid 123",
+ "allow auid 123 rwx",
+ "allow r pool foo object_prefix blah ; allow w auid 5",
0
};