if (!tickets.verify_service_ticket_reply(secret, indata)) {
ldout(cct, 0) << "could not verify service_ticket reply" << dendl;
- return -EPERM;
+ return -EACCES;
}
ldout(cct, 10) << " want=" << want << " need=" << need << " have=" << have << dendl;
if (!indata.end()) {
if (!tickets.verify_service_ticket_reply(ticket_handler.session_key, indata)) {
ldout(cct, 0) << "could not verify service_ticket reply" << dendl;
- return -EPERM;
+ return -EACCES;
}
validate_tickets();
if (!_need_tickets()) {
CephXSessionAuthInfo& info)
{
if (!get_service_secret(service_id, info.service_secret, info.secret_id)) {
- return -EPERM;
+ return -EACCES;
}
std::scoped_lock l{lock};
CryptoKey secret;
if (!key_server->get_secret(entity_name, secret)) {
ldout(cct, 0) << "couldn't find entity name: " << entity_name << dendl;
- ret = -EPERM;
+ ret = -EACCES;
break;
}
if (!server_challenge) {
- ret = -EPERM;
+ ret = -EACCES;
break;
}
req.client_challenge, &expected_key, error);
if (!error.empty()) {
ldout(cct, 0) << " cephx_calc_client_server_challenge error: " << error << dendl;
- ret = -EPERM;
+ ret = -EACCES;
break;
}
if (req.key != expected_key) {
ldout(cct, 0) << " unexpected key: req.key=" << hex << req.key
<< " expected_key=" << expected_key << dec << dendl;
- ret = -EPERM;
+ ret = -EACCES;
break;
}
EntityAuth eauth;
if (! key_server->get_auth(entity_name, eauth)) {
- ret = -EPERM;
+ ret = -EACCES;
break;
}
CephXServiceTicketInfo old_ticket_info;
cct, *key_server, indata, 0, auth_ticket_info, nullptr,
nullptr,
&tmp_bl)) {
- ret = -EPERM;
+ ret = -EACCES;
break;
}
<< entity_name << dendl;
build_cephx_response_header(cephx_header.request_type, 0, *result_bl);
if (!key_server->get_rotating_encrypted(entity_name, *result_bl)) {
- ret = -EPERM;
+ ret = -EACCES;
break;
}
}
<< gss_minor_status << " "
<< status_str
<< dendl;
- return (-EPERM);
+ return (-EACCES);
}
gss_buffer_desc krb_input_name_buff = {0, nullptr};
<< gss_minor_status << " "
<< status_str
<< dendl;
- result = (-EPERM);
+ result = (-EACCES);
break;
}
<< gss_minor_status << " "
<< status_str
<< dendl;
- result = (-EPERM);
+ result = (-EACCES);
break;
}
}
<< gss_minor_status << " "
<< status_str
<< dendl;
- return (-EPERM);
+ return (-EACCES);
} else {
KrbResponse krb_response;
krb_response.m_response_type =
prefix='get_command_descriptions',
timeout=10)
if ret:
- if ret == -errno.EPERM and target[0] in ('osd', 'mds'):
+ if (ret == -errno.EPERM or ret == -errno.EACCES) and target[0] in ('osd', 'mds'):
print("Permission denied. Check that your user has 'allow *' "
"capabilities for the target daemon type.", file=sys.stderr)
elif ret == -errno.EPERM:
<< *m->get_connection()->peer_addrs << dendl;
ss << "permission denied";
- r = -EPERM;
+ r = -EACCES;
} else if (m->cmd.empty()) {
r = -EINVAL;
ss << "no command given";
catch (buffer::error& e) {
dout(10) << " session " << s << " " << s->entity_name
<< " failed to decode caps" << dendl;
- return -EPERM;
+ return -EACCES;
}
if (!s->caps.parse(str)) {
dout(10) << " session " << s << " " << s->entity_name
<< " failed to parse caps '" << str << "'" << dendl;
- return -EPERM;
+ return -EACCES;
}
dout(10) << " session " << s << " " << s->entity_name
<< " has caps " << s->caps << " '" << str << "'" << dendl;
MCommand *m = static_cast<MCommand*>(op->get_req());
if (m->fsid != monmap->fsid) {
dout(0) << "handle_command on fsid " << m->fsid << " != " << monmap->fsid << dendl;
- reply_command(op, -EPERM, "wrong fsid", 0);
+ reply_command(op, -EACCES, "wrong fsid", 0);
return;
}
MonSession *session = op->get_session();
"mon", prefix, param_str_map,
true, true, true,
session->get_peer_socket_addr())) {
- reply_tell_command(op, -EPERM, "insufficient caps");
+ reply_tell_command(op, -EACCES, "insufficient caps");
}
}
// pass it to asok
derr << __func__ << " corrupt cap data for " << con->get_peer_entity_name()
<< " in auth db" << dendl;
str.clear();
- ret = -EPERM;
+ ret = -EACCES;
}
if (ret >= 0) {
if (s->caps.parse(str, NULL)) {
} else {
derr << __func__ << " unparseable caps '" << str << "' for "
<< con->get_peer_entity_name() << dendl;
- ret = -EPERM;
+ ret = -EACCES;
}
}
}
ConnectionRef con = m->get_connection();
auto session = ceph::ref_cast<Session>(con->get_priv());
if (!session) {
- con->send_message(new MCommandReply(m, -EPERM));
+ con->send_message(new MCommandReply(m, -EACCES));
m->put();
return;
}
if (!session->caps.allow_all()) {
- con->send_message(new MCommandReply(m, -EPERM));
+ con->send_message(new MCommandReply(m, -EACCES));
m->put();
return;
}
catch (buffer::error& e) {
dout(10) << __func__ << " session " << s << " " << s->entity_name
<< " failed to decode caps string" << dendl;
- ret = -EPERM;
+ ret = -EACCES;
}
if (!ret) {
bool success = s->caps.parse(str);
} else {
dout(10) << __func__ << " session " << s << " " << s->entity_name
<< " failed to parse caps '" << str << "'" << dendl;
- ret = -EPERM;
+ ret = -EACCES;
}
}
}