]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
messages: MForward: stash auth entity name
authorJoao Eduardo Luis <joao@redhat.com>
Fri, 14 Nov 2014 21:01:39 +0000 (21:01 +0000)
committerJoao Eduardo Luis <joao@redhat.com>
Mon, 17 Nov 2014 15:40:36 +0000 (15:40 +0000)
This will allow us to assess the entity name, used during auth, for a
forwarded request, which is otherwise unavailable to the receiving
party.

Fixes: #9913 (partially)
Backport: giant

Signed-off-by: Joao Eduardo Luis <joao@redhat.com>
src/messages/MForward.h

index 6a0e2bf71cbc4fca958508f54ae8b87c5f92a4c2..c19865428c2b9e85de58066d8fd5a070c8eaffdb 100644 (file)
@@ -29,8 +29,9 @@ struct MForward : public Message {
   entity_inst_t client;
   MonCap client_caps;
   uint64_t con_features;
+  EntityName entity_name;
 
-  static const int HEAD_VERSION = 2;
+  static const int HEAD_VERSION = 3;
   static const int COMPAT_VERSION = 1;
 
   MForward() : Message(MSG_FORWARD, HEAD_VERSION, COMPAT_VERSION),
@@ -62,6 +63,7 @@ public:
     ::encode(client_caps, payload, features);
     encode_message(msg, features, payload);
     ::encode(con_features, payload);
+    ::encode(entity_name, payload);
   }
 
   void decode_payload() {
@@ -75,6 +77,14 @@ public:
     } else {
       con_features = 0;
     }
+    if (header.version >= 3) {
+      ::decode(entity_name, p);
+    } else {
+      // we are able to know the entity type, obtaining it from the
+      // entity_name_t on 'client', but we have no idea about the
+      // entity name, so we'll just use a friendly '?' instead.
+      entity_name.set(client.name.type(), "?");
+    }
 
   }