Skip to content

Commit

Permalink
Merge pull request #5382: segfault launching ceph-fuse with bad --name
Browse files Browse the repository at this point in the history
Reviewed-by: Loic Dachary <ldachary@redhat.com>
  • Loading branch information
ldachary committed Sep 2, 2015
2 parents 6392f0e + 1e05578 commit ff85986
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/auth/cephx/CephxClientHandler.cc
Expand Up @@ -40,7 +40,11 @@ int CephxClientHandler::build_request(bufferlist& bl) const
::encode(header, bl);

CryptoKey secret;
keyring->get_secret(cct->_conf->name, secret);
const bool got = keyring->get_secret(cct->_conf->name, secret);
if (!got) {
ldout(cct, 20) << "no secret found for entity: " << cct->_conf->name << dendl;
return -ENOENT;
}

CephXAuthenticate req;
get_random_bytes((char *)&req.client_challenge, sizeof(req.client_challenge));
Expand Down Expand Up @@ -113,7 +117,11 @@ int CephxClientHandler::handle_response(int ret, bufferlist::iterator& indata)
{
ldout(cct, 10) << " get_auth_session_key" << dendl;
CryptoKey secret;
keyring->get_secret(cct->_conf->name, secret);
const bool got = keyring->get_secret(cct->_conf->name, secret);
if (!got) {
ldout(cct, 0) << "key not found for " << cct->_conf->name << dendl;
return -ENOENT;
}

if (!tickets.verify_service_ticket_reply(secret, indata)) {
ldout(cct, 0) << "could not verify service_ticket reply" << dendl;
Expand Down Expand Up @@ -150,7 +158,11 @@ int CephxClientHandler::handle_response(int ret, bufferlist::iterator& indata)
if (rotating_secrets) {
RotatingSecrets secrets;
CryptoKey secret_key;
keyring->get_secret(cct->_conf->name, secret_key);
const bool got = keyring->get_secret(cct->_conf->name, secret_key);
if (!got) {
ldout(cct, 0) << "key not found for " << cct->_conf->name << dendl;
return -ENOENT;
}
std::string error;
if (decode_decrypt(cct, secrets, secret_key, indata, error)) {
ldout(cct, 0) << "could not set rotating key: decode_decrypt failed. error:"
Expand Down

0 comments on commit ff85986

Please sign in to comment.