]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/mon/AuthMonitor.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / mon / AuthMonitor.h
index 75f7618759e078289649f66164aee5c561904191..048fc0c08ef4d3ec9015bfce0cab890c51752bdd 100644 (file)
@@ -24,7 +24,7 @@
 #include "mon/PaxosService.h"
 #include "mon/MonitorDBStore.h"
 
-struct MAuth;
+class MAuth;
 class KeyRing;
 class Monitor;
 
@@ -40,11 +40,11 @@ public:
     IncType inc_type;
     uint64_t max_global_id;
     uint32_t auth_type;
-    bufferlist auth_data;
+    ceph::buffer::list auth_data;
 
     Incremental() : inc_type(GLOBAL_ID), max_global_id(0), auth_type(0) {}
 
-    void encode(bufferlist& bl, uint64_t features=-1) const {
+    void encode(ceph::buffer::list& bl, uint64_t features=-1) const {
       using ceph::encode;
       ENCODE_START(2, 2, bl);
       __u32 _type = (__u32)inc_type;
@@ -57,7 +57,7 @@ public:
       }
       ENCODE_FINISH(bl);
     }
-    void decode(bufferlist::const_iterator& bl) {
+    void decode(ceph::buffer::list::const_iterator& bl) {
       DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl);
       __u32 _type;
       decode(_type, bl);
@@ -71,13 +71,13 @@ public:
       }
       DECODE_FINISH(bl);
     }
-    void dump(Formatter *f) const {
+    void dump(ceph::Formatter *f) const {
       f->dump_int("type", inc_type);
       f->dump_int("max_global_id", max_global_id);
       f->dump_int("auth_type", auth_type);
       f->dump_int("auth_data_len", auth_data.length());
     }
-    static void generate_test_instances(list<Incremental*>& ls) {
+    static void generate_test_instances(std::list<Incremental*>& ls) {
       ls.push_back(new Incremental);
       ls.push_back(new Incremental);
       ls.back()->inc_type = GLOBAL_ID;
@@ -96,7 +96,7 @@ public:
 
 
 private:
-  vector<Incremental> pending_auth;
+  std::vector<Incremental> pending_auth;
   version_t last_rotating_ver;
   uint64_t max_global_id;
   uint64_t last_allocated_id;
@@ -121,19 +121,20 @@ private:
   }
 
   /* validate mon/osd/mds caps; fail on unrecognized service/type */
-  bool valid_caps(const string& type, const string& caps, ostream *out);
-  bool valid_caps(const string& type, const bufferlist& bl, ostream *out) {
+  bool valid_caps(const std::string& type, const std::string& caps, std::ostream *out);
+  bool valid_caps(const std::string& type, const ceph::buffer::list& bl, std::ostream *out) {
     auto p = bl.begin();
-    string v;
+    std::string v;
     try {
+      using ceph::decode;
       decode(v, p);
-    } catch (buffer::error& e) {
+    } catch (ceph::buffer::error& e) {
       *out << "corrupt capability encoding";
       return false;
     }
     return valid_caps(type, v, out);
   }
-  bool valid_caps(const vector<string>& caps, ostream *out);
+  bool valid_caps(const std::vector<std::string>& caps, std::ostream *out);
 
   void on_active() override;
   bool should_propose(double& delay) override;
@@ -170,20 +171,20 @@ private:
   int exists_and_matches_entity(
       const auth_entity_t& entity,
       bool has_secret,
-      stringstream& ss);
+      std::stringstream& ss);
   int exists_and_matches_entity(
       const EntityName& name,
       const EntityAuth& auth,
-      const map<string,bufferlist>& caps,
+      const std::map<std::string,ceph::buffer::list>& caps,
       bool has_secret,
-      stringstream& ss);
+      std::stringstream& ss);
   int remove_entity(const EntityName &entity);
   int add_entity(
       const EntityName& name,
       const EntityAuth& auth);
 
  public:
-  AuthMonitor(Monitor *mn, Paxos *p, const string& service_name)
+  AuthMonitor(Monitor &mn, Paxos &p, const std::string& service_name)
     : PaxosService(mn, p, service_name),
       last_rotating_ver(0),
       max_global_id(0),
@@ -199,7 +200,7 @@ private:
       const uuid_d& uuid,
       EntityName& cephx_entity,
       EntityName& lockbox_entity,
-      stringstream& ss);
+      std::stringstream& ss);
   int do_osd_destroy(
       const EntityName& cephx_entity,
       const EntityName& lockbox_entity);
@@ -211,15 +212,15 @@ private:
   int validate_osd_new(
       int32_t id,
       const uuid_d& uuid,
-      const string& cephx_secret,
-      const string& lockbox_secret,
+      const std::string& cephx_secret,
+      const std::string& lockbox_secret,
       auth_entity_t& cephx_entity,
       auth_entity_t& lockbox_entity,
-      stringstream& ss);
+      std::stringstream& ss);
 
-  void dump_info(Formatter *f);
+  void dump_info(ceph::Formatter *f);
 
-  bool is_valid_cephx_key(const string& k) {
+  bool is_valid_cephx_key(const std::string& k) {
     if (k.empty())
       return false;
 
@@ -227,7 +228,7 @@ private:
     try {
       ea.key.decode_base64(k);
       return true;
-    } catch (buffer::error& e) { /* fallthrough */ }
+    } catch (ceph::buffer::error& e) { /* fallthrough */ }
     return false;
   }
 };