rgw: clean up ops initialization, completion

ops init() was a reminiscent of an old design. Since we're
allocating new op for every request we can just init everything
in the constructor.

We now add a new complete() stage in request processing. By
default complete() will call send_response().

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: better protocols separation

This change will make it easier to add new protocol
handlers. We now determine which protocol handler to
use by querying the list of existing protocol handlers
whether the query belongs to that protocol. If so,
then just run the specific protocol's handler code.
Separated some mixed s3 and swift code into the specific
handlers.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
OSDCap: remove grants added during failed parsing

Parsing has side effects that must be undone if it fails.  A
capability string like 'allow rwx pool=bar' will add the grant for
'allow rwx' and then fail on the 'pool=bar'. Thus, the client will
effectively have 'rwx' permissions on all pools.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
OSDCap: fix typo in comment

The grammar uses auid, not uid.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
OSDCap: fix output operators for caps

OSD_CAP_ANY is not a flag, but a value (0xff) that will always
be true when treated as a mask with a non-zero rwxa_t.

Don't duplicate the rwxa_t output operator in the OSDCapSpec output
operator, just use it.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
OSDCaps: fix allow_all()

OSD_CAP_ANY is not a mask. Treating it as one made any allowance
equivalent to 'allow *'.

Fixes: #3228
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
test: add more OSDCap unit tests

Check that allow_all() returns false when 'allow *' is not specified.
This would have caught #3228.
Add tests for the output operators as well.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
Makefile.am: recompile small file instead of libosd for unit test

Linking with libosd requires a lot more recompilation
when testing changes to OSDCap.cc.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
OSDCap: parse 'pool=<poolname>' in addition to 'pool <poolname>'

This was used in releases before 0.49, and was the documented way
to use it in several places, so support it again for backwards
compatibility.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
test: remove commented out test cases

These are copied from non-commented out ones a few lines above.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
OSDCap: parse spaces explicitly

This is necessary to avoid matching things like "allow r poolfoo".
It's also needed to distinguish "allow r class-read" from
"allow r class -read".

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
New documentation about Cephx protocol and session authentication.


Signed-off-by: Peter Reiher <reiher@inktank.com>
Changes to basic authentication class to enable session authentication


Signed-off-by: Peter Reiher <reiher@inktank.com>
Changes to existing None and Unknown authentication protocols to handle null session authentication.


Signed-off-by: Peter Reiher <reiher@inktank.com>
Changes to cephx protocol to handle session authentication.


Signed-off-by: Peter Reiher <reiher@inktank.com>
Code to allow pipes to be prepared to sign messages and to call the authentication methods for signing and checking.


Signed-off-by: Peter Reiher <reiher@inktank.com>
Compatibility code for session authentication; mostly passing keys around to where they're needed.



Signed-off-by: Peter Reiher <reiher@inktank.com>
doc: first draft of full OpenStack integration

Includes glance, cinder, and nova config with cloning.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
OSDCap: allow runs of spaces anywhere

I couldn't find a way to do this with skip parsers,
so these are explicitly included in the grammar.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
OSDCap: add separate caps for class read and class write

These are useful for rbd layering, since reading an rbd image
requires read-only class methods.

Fixes: #3167
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>