]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
auth: codify AUTH_MODE_AUTHORIZER
authorSage Weil <sage@redhat.com>
Sun, 20 Jan 2019 22:51:12 +0000 (16:51 -0600)
committerSage Weil <sage@redhat.com>
Thu, 7 Feb 2019 12:53:03 +0000 (06:53 -0600)
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 <sage@redhat.com>
src/auth/Auth.h
src/auth/cephx/CephxProtocol.cc
src/auth/none/AuthNoneProtocol.h
src/auth/unknown/AuthUnknownProtocol.h

index dc91854ded5e494696743077068737263ada2660..15ea576ec42788e933216692ade88954bbc9bdd6 100644 (file)
 #include "Crypto.h"
 #include "common/entity_name.h"
 
+enum {
+  AUTH_MODE_AUTHORIZER = 1,
+  AUTH_MODE_MON = 100,
+};
+
 class Cond;
 
 struct EntityAuth {
index d92a6d589b5eaba5079045490deca90f4072e5ce..04f9e8e224968a2edc0888b4bf8baaaba33c6114 100644 (file)
@@ -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);
index 155a8d0530464b2c9c832b69e61b23dcdf7c6d46..cacfddefb70e7a36230fec4fb0adb4cfbc42657d 100644 (file)
@@ -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);
index bba48d35431ee25f23564ab089957e3b79991e0f..d3e171eac9e68604003185bd80743ec7aa5397d4 100644 (file)
@@ -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);