mirror of
https://github.com/ceph/ceph
synced 2025-01-18 17:12:29 +00:00
Merge pull request #15354 from badone/wip-rados-ls-auth-fix
osd: Reverse order of op_has_sufficient_caps and do_pg_op Reviewed-by: Greg Farnum <gfarnum@redhat.com>
This commit is contained in:
commit
288f623878
9
qa/suites/rados/singleton-nomsgr/all/pool-access.yaml
Normal file
9
qa/suites/rados/singleton-nomsgr/all/pool-access.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
roles:
|
||||
- [mon.a, mgr.x, osd.0, osd.1, client.0]
|
||||
tasks:
|
||||
- install:
|
||||
- ceph:
|
||||
- workunit:
|
||||
clients:
|
||||
all:
|
||||
- rados/test_pool_access.sh
|
23
qa/workunits/rados/test_pool_access.sh
Executable file
23
qa/workunits/rados/test_pool_access.sh
Executable file
@ -0,0 +1,23 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
set -e
|
||||
|
||||
expect_1()
|
||||
{
|
||||
set -x
|
||||
set +e
|
||||
"$@"
|
||||
if [ $? == 1 ]; then return 0; else return 1; fi
|
||||
}
|
||||
|
||||
|
||||
key=`ceph auth get-or-create-key client.poolaccess1 mon 'allow r' osd 'allow *'`
|
||||
rados --id poolaccess1 --key $key -p rbd ls
|
||||
|
||||
key=`ceph auth get-or-create-key client.poolaccess2 mon 'allow r' osd 'allow * pool=nopool'`
|
||||
expect_1 rados --id poolaccess2 --key $key -p rbd ls
|
||||
|
||||
key=`ceph auth get-or-create-key client.poolaccess3 mon 'allow r' osd 'allow rw pool=nopool'`
|
||||
expect_1 rados --id poolaccess3 --key $key -p rbd ls
|
||||
|
||||
echo OK
|
@ -1877,15 +1877,15 @@ void PrimaryLogPG::do_op(OpRequestRef& op)
|
||||
}
|
||||
}
|
||||
|
||||
if (op->includes_pg_op()) {
|
||||
return do_pg_op(op);
|
||||
}
|
||||
|
||||
if (!op_has_sufficient_caps(op)) {
|
||||
osd->reply_op_error(op, -EPERM);
|
||||
return;
|
||||
}
|
||||
|
||||
if (op->includes_pg_op()) {
|
||||
return do_pg_op(op);
|
||||
}
|
||||
|
||||
// object name too long?
|
||||
if (m->get_oid().name.size() > cct->_conf->osd_max_object_name_len) {
|
||||
dout(4) << "do_op name is longer than "
|
||||
|
Loading…
Reference in New Issue
Block a user