]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
auth: misc printing and initialization fixes
authorGreg Farnum <gregf@hq.newdream.net>
Sat, 27 Feb 2010 01:20:43 +0000 (17:20 -0800)
committerGreg Farnum <gregf@hq.newdream.net>
Tue, 2 Mar 2010 18:02:04 +0000 (10:02 -0800)
src/auth/Auth.h
src/auth/KeyRing.cc
src/auth/cephx/CephxKeyServer.cc

index 4a07bf0dc67e280486997412f90c85fde76e0b05..74d5b988107fc70c2adf03e5e508dae90b48b1f0 100644 (file)
@@ -133,7 +133,10 @@ struct EntityAuth {
 WRITE_CLASS_ENCODER(EntityAuth)
 
 static inline ostream& operator<<(ostream& out, const EntityAuth& a) {
-  return out << "auth(key=" << a.key << " with " << a.caps.size() << " caps)";
+  out << "auth(key=" << a.key;
+  if (a.auth_uid != CEPH_AUTH_UID_DEFAULT)
+    out << " uid=" << a.auth_uid;
+  return out << " with " << a.caps.size() << " caps)";
 }
 
 struct AuthCapsInfo {
@@ -141,7 +144,7 @@ struct AuthCapsInfo {
   __u64 auth_uid;
   bufferlist caps;
 
-  AuthCapsInfo() : allow_all(false) {}
+  AuthCapsInfo() : allow_all(false), auth_uid(CEPH_AUTH_UID_DEFAULT){}
 
   void encode(bufferlist& bl) const {
     __u8 struct_v = 2;
index 61a89d808df1936a682600506f3fb479726a3e8d..d924520fee2b1267d87ee60da055570c6a358acc 100644 (file)
@@ -67,7 +67,7 @@ void KeyRing::print(ostream& out)
   for (map<EntityName, EntityAuth>::iterator p = keys.begin();
        p != keys.end();
        ++p) {
-    out << p->first << std::endl;
+    out << p->first << "\t" << p->second.auth_uid << std::endl;
     out << "\tkey: " << p->second.key << std::endl;
 
     for (map<string, bufferlist>::iterator q = p->second.caps.begin();
index fceec626f917e8b11b1d721594a6d721644c08cc..64eaeebc755b6b77de4c428c7764dc4d476904de 100644 (file)
@@ -103,12 +103,14 @@ bool KeyServerData::get_caps(EntityName& name, string& type, AuthCapsInfo& caps_
   if (iter == secrets.end())
     return false;
 
+  dout(0) << "get_caps: auth_uid=" << iter->second.auth_uid << dendl;
+  caps_info.auth_uid = iter->second.auth_uid;
+
   dout(0) << "get_secret: num of caps=" << iter->second.caps.size() << dendl;
   map<string, bufferlist>::iterator capsiter = iter->second.caps.find(type);
   if (capsiter != iter->second.caps.end()) {
     caps_info.caps = capsiter->second;
   }
-  caps_info.auth_uid = iter->second.auth_uid;
   return true;
 }