From: Sage Weil Date: Sun, 20 Jan 2019 22:51:12 +0000 (-0600) Subject: auth: codify AUTH_MODE_AUTHORIZER X-Git-Tag: v14.1.0~183^2~47 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f152b4aae181002a3a8834877e06e8db05fdf33f;p=ceph.git auth: codify AUTH_MODE_AUTHORIZER The AuthAuthorizer encoding always begins with byte 0x01. Codify that as AUTH_MODE_AUTHORIZER so that we can distinguish an authorizer from something else (e.g., an attempt to authenticate and get an initial auth ticket with the mon). Signed-off-by: Sage Weil --- diff --git a/src/auth/Auth.h b/src/auth/Auth.h index dc91854ded5e..15ea576ec427 100644 --- a/src/auth/Auth.h +++ b/src/auth/Auth.h @@ -18,6 +18,11 @@ #include "Crypto.h" #include "common/entity_name.h" +enum { + AUTH_MODE_AUTHORIZER = 1, + AUTH_MODE_MON = 100, +}; + class Cond; struct EntityAuth { diff --git a/src/auth/cephx/CephxProtocol.cc b/src/auth/cephx/CephxProtocol.cc index d92a6d589b5e..04f9e8e22496 100644 --- a/src/auth/cephx/CephxProtocol.cc +++ b/src/auth/cephx/CephxProtocol.cc @@ -300,7 +300,7 @@ CephXAuthorizer *CephXTicketHandler::build_authorizer(uint64_t global_id) const a->session_key = session_key; cct->random()->get_bytes((char*)&a->nonce, sizeof(a->nonce)); - __u8 authorizer_v = 1; + __u8 authorizer_v = 1; // see AUTH_MODE_* in Auth.h encode(authorizer_v, a->bl); encode(global_id, a->bl); encode(service_id, a->bl); diff --git a/src/auth/none/AuthNoneProtocol.h b/src/auth/none/AuthNoneProtocol.h index 155a8d053046..cacfddefb70e 100644 --- a/src/auth/none/AuthNoneProtocol.h +++ b/src/auth/none/AuthNoneProtocol.h @@ -22,7 +22,7 @@ class CephContext; struct AuthNoneAuthorizer : public AuthAuthorizer { AuthNoneAuthorizer() : AuthAuthorizer(CEPH_AUTH_NONE) { } bool build_authorizer(const EntityName &ename, uint64_t global_id) { - __u8 struct_v = 1; + __u8 struct_v = 1; // see AUTH_MODE_* in Auth.h encode(struct_v, bl); encode(ename, bl); encode(global_id, bl); diff --git a/src/auth/unknown/AuthUnknownProtocol.h b/src/auth/unknown/AuthUnknownProtocol.h index bba48d35431e..d3e171eac9e6 100644 --- a/src/auth/unknown/AuthUnknownProtocol.h +++ b/src/auth/unknown/AuthUnknownProtocol.h @@ -20,7 +20,7 @@ struct AuthUnknownAuthorizer : public AuthAuthorizer { AuthUnknownAuthorizer() : AuthAuthorizer(CEPH_AUTH_UNKNOWN) { } bool build_authorizer(const EntityName &ename, uint64_t global_id) { - __u8 struct_v = 1; + __u8 struct_v = 1; // see AUTH_MODE_* in Auth.h encode(struct_v, bl); encode(ename, bl); encode(global_id, bl);