Skip to content

Commit

Permalink
Merge branch 'wip-names!-in!-space!' of git://github.com/adamemerson/…
Browse files Browse the repository at this point in the history
…ceph

Reviewed-by: Jesse Williamson <jwilliamson@suse.de>

# Conflicts:
#	src/cls/rbd/cls_rbd.cc
#	src/cls/rbd/cls_rbd_types.cc
  • Loading branch information
liewegas committed Jan 11, 2018
2 parents c6d6676 + 8da0708 commit 4da29a0
Show file tree
Hide file tree
Showing 556 changed files with 10,947 additions and 10,166 deletions.
96 changes: 53 additions & 43 deletions src/auth/Auth.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,21 @@ struct EntityAuth {

void encode(bufferlist& bl) const {
__u8 struct_v = 2;
::encode(struct_v, bl);
::encode(auid, bl);
::encode(key, bl);
::encode(caps, bl);
using ceph::encode;
encode(struct_v, bl);
encode(auid, bl);
encode(key, bl);
encode(caps, bl);
}
void decode(bufferlist::iterator& bl) {
using ceph::decode;
__u8 struct_v;
::decode(struct_v, bl);
decode(struct_v, bl);
if (struct_v >= 2)
::decode(auid, bl);
decode(auid, bl);
else auid = CEPH_AUTH_UID_DEFAULT;
::decode(key, bl);
::decode(caps, bl);
decode(key, bl);
decode(caps, bl);
}
};
WRITE_CLASS_ENCODER(EntityAuth)
Expand All @@ -57,19 +59,21 @@ struct AuthCapsInfo {
AuthCapsInfo() : allow_all(false) {}

void encode(bufferlist& bl) const {
using ceph::encode;
__u8 struct_v = 1;
::encode(struct_v, bl);
encode(struct_v, bl);
__u8 a = (__u8)allow_all;
::encode(a, bl);
::encode(caps, bl);
encode(a, bl);
encode(caps, bl);
}
void decode(bufferlist::iterator& bl) {
using ceph::decode;
__u8 struct_v;
::decode(struct_v, bl);
decode(struct_v, bl);
__u8 a;
::decode(a, bl);
decode(a, bl);
allow_all = (bool)a;
::decode(caps, bl);
decode(caps, bl);
}
};
WRITE_CLASS_ENCODER(AuthCapsInfo)
Expand Down Expand Up @@ -98,28 +102,30 @@ struct AuthTicket {
}

void encode(bufferlist& bl) const {
using ceph::encode;
__u8 struct_v = 2;
::encode(struct_v, bl);
::encode(name, bl);
::encode(global_id, bl);
::encode(auid, bl);
::encode(created, bl);
::encode(expires, bl);
::encode(caps, bl);
::encode(flags, bl);
encode(struct_v, bl);
encode(name, bl);
encode(global_id, bl);
encode(auid, bl);
encode(created, bl);
encode(expires, bl);
encode(caps, bl);
encode(flags, bl);
}
void decode(bufferlist::iterator& bl) {
using ceph::decode;
__u8 struct_v;
::decode(struct_v, bl);
::decode(name, bl);
::decode(global_id, bl);
decode(struct_v, bl);
decode(name, bl);
decode(global_id, bl);
if (struct_v >= 2)
::decode(auid, bl);
decode(auid, bl);
else auid = CEPH_AUTH_UID_DEFAULT;
::decode(created, bl);
::decode(expires, bl);
::decode(caps, bl);
::decode(flags, bl);
decode(created, bl);
decode(expires, bl);
decode(caps, bl);
decode(flags, bl);
}
};
WRITE_CLASS_ENCODER(AuthTicket)
Expand Down Expand Up @@ -149,16 +155,18 @@ struct ExpiringCryptoKey {
utime_t expiration;

void encode(bufferlist& bl) const {
using ceph::encode;
__u8 struct_v = 1;
::encode(struct_v, bl);
::encode(key, bl);
::encode(expiration, bl);
encode(struct_v, bl);
encode(key, bl);
encode(expiration, bl);
}
void decode(bufferlist::iterator& bl) {
using ceph::decode;
__u8 struct_v;
::decode(struct_v, bl);
::decode(key, bl);
::decode(expiration, bl);
decode(struct_v, bl);
decode(key, bl);
decode(expiration, bl);
}
};
WRITE_CLASS_ENCODER(ExpiringCryptoKey)
Expand All @@ -175,16 +183,18 @@ struct RotatingSecrets {
RotatingSecrets() : max_ver(0) {}

void encode(bufferlist& bl) const {
using ceph::encode;
__u8 struct_v = 1;
::encode(struct_v, bl);
::encode(secrets, bl);
::encode(max_ver, bl);
encode(struct_v, bl);
encode(secrets, bl);
encode(max_ver, bl);
}
void decode(bufferlist::iterator& bl) {
using ceph::decode;
__u8 struct_v;
::decode(struct_v, bl);
::decode(secrets, bl);
::decode(max_ver, bl);
decode(struct_v, bl);
decode(secrets, bl);
decode(max_ver, bl);
}

uint64_t add(ExpiringCryptoKey& key) {
Expand Down Expand Up @@ -235,7 +245,7 @@ class KeyStore {
CryptoKey& secret) const = 0;
};

static inline bool auth_principal_needs_rotating_keys(EntityName& name)
inline bool auth_principal_needs_rotating_keys(EntityName& name)
{
uint32_t ty(name.get_type());
return ((ty == CEPH_ENTITY_TYPE_OSD)
Expand Down
14 changes: 8 additions & 6 deletions src/auth/Crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -387,19 +387,21 @@ CryptoKeyHandler *CryptoAES::get_key_handler(const bufferptr& secret,

void CryptoKey::encode(bufferlist& bl) const
{
::encode(type, bl);
::encode(created, bl);
using ceph::encode;
encode(type, bl);
encode(created, bl);
__u16 len = secret.length();
::encode(len, bl);
encode(len, bl);
bl.append(secret);
}

void CryptoKey::decode(bufferlist::iterator& bl)
{
::decode(type, bl);
::decode(created, bl);
using ceph::decode;
decode(type, bl);
decode(created, bl);
__u16 len;
::decode(len, bl);
decode(len, bl);
bufferptr tmp;
bl.copy_deep(len, tmp);
if (_set_secret(type, tmp) < 0)
Expand Down
15 changes: 9 additions & 6 deletions src/auth/KeyRing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ int KeyRing::set_modifier(const char *type, const char *val, EntityName& name, m
return -EINVAL;
string l(val);
bufferlist bl;
::encode(l, bl);
encode(l, bl);
caps[caps_entity] = bl;
set_caps(name, caps);
} else if (strcmp(type, "auid") == 0) {
Expand Down Expand Up @@ -143,11 +143,12 @@ void KeyRing::encode_formatted(string label, Formatter *f, bufferlist& bl)
f->dump_int("auid", p->second.auid);
f->open_object_section("caps");
for (map<string, bufferlist>::iterator q = p->second.caps.begin();
q != p->second.caps.end();
q != p->second.caps.end();
++q) {
bufferlist::iterator dataiter = q->second.begin();
string caps;
::decode(caps, dataiter);
using ceph::decode;
decode(caps, dataiter);
f->dump_string(q->first.c_str(), caps);
}
f->close_section(); /* caps */
Expand Down Expand Up @@ -204,8 +205,9 @@ void KeyRing::decode(bufferlist::iterator& bl) {
__u8 struct_v;
bufferlist::iterator start_pos = bl;
try {
::decode(struct_v, bl);
::decode(keys, bl);
using ceph::decode;
decode(struct_v, bl);
decode(keys, bl);
} catch (buffer::error& err) {
keys.clear();
decode_plaintext(start_pos);
Expand Down Expand Up @@ -253,7 +255,8 @@ void KeyRing::print(ostream& out)
++q) {
bufferlist::iterator dataiter = q->second.begin();
string caps;
::decode(caps, dataiter);
using ceph::decode;
decode(caps, dataiter);
out << "\tcaps " << q->first << " = \"" << caps << '"' << std::endl;
}
}
Expand Down
15 changes: 7 additions & 8 deletions src/auth/cephx/CephxClientHandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ int CephxClientHandler::build_request(bufferlist& bl) const
/* authenticate */
CephXRequestHeader header;
header.request_type = CEPHX_GET_AUTH_SESSION_KEY;
::encode(header, bl);
encode(header, bl);

CryptoKey secret;
const bool got = keyring->get_secret(cct->_conf->name, secret);
Expand Down Expand Up @@ -69,7 +69,7 @@ int CephxClientHandler::build_request(bufferlist& bl) const
ldout(cct, 20) << "old ticket len=" << req.old_ticket.blob.length() << dendl;
}

::encode(req, bl);
encode(req, bl);

ldout(cct, 10) << "get auth session key: client_challenge "
<< hex << req.client_challenge << dendl;
Expand All @@ -82,7 +82,7 @@ int CephxClientHandler::build_request(bufferlist& bl) const

CephXRequestHeader header;
header.request_type = CEPHX_GET_PRINCIPAL_SESSION_KEY;
::encode(header, bl);
encode(header, bl);

CephXAuthorizer *authorizer = ticket_handler->build_authorizer(global_id);
if (!authorizer)
Expand All @@ -92,7 +92,7 @@ int CephxClientHandler::build_request(bufferlist& bl) const

CephXServiceTicketRequest req;
req.keys = need;
::encode(req, bl);
encode(req, bl);
}

return 0;
Expand All @@ -117,7 +117,7 @@ int CephxClientHandler::handle_response(int ret, bufferlist::iterator& indata)

if (starting) {
CephXServerChallenge ch;
::decode(ch, indata);
decode(ch, indata);
server_challenge = ch.server_challenge;
ldout(cct, 10) << " got initial server challenge "
<< hex << server_challenge << dendl;
Expand All @@ -128,7 +128,7 @@ int CephxClientHandler::handle_response(int ret, bufferlist::iterator& indata)
}

struct CephXResponseHeader header;
::decode(header, indata);
decode(header, indata);

switch (header.request_type) {
case CEPHX_GET_AUTH_SESSION_KEY:
Expand Down Expand Up @@ -215,7 +215,7 @@ bool CephxClientHandler::build_rotating_request(bufferlist& bl) const
ldout(cct, 10) << "build_rotating_request" << dendl;
CephXRequestHeader header;
header.request_type = CEPHX_GET_ROTATING_KEY;
::encode(header, bl);
encode(header, bl);
return true;
}

Expand Down Expand Up @@ -249,4 +249,3 @@ bool CephxClientHandler::need_tickets()

return _need_tickets();
}

3 changes: 2 additions & 1 deletion src/auth/cephx/CephxKeyServer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ int KeyServer::encode_secrets(Formatter *f, stringstream *ds) const
bufferlist *bl = const_cast<bufferlist*>(&capsiter->second);
bufferlist::iterator dataiter = bl->begin();
string caps;
::decode(caps, dataiter);
using ceph::decode;
decode(caps, dataiter);
if (ds)
*ds << "\tcaps: [" << capsiter->first << "] " << caps << std::endl;
if (f)
Expand Down

0 comments on commit 4da29a0

Please sign in to comment.