mirror of
https://github.com/ceph/ceph
synced 2025-03-06 08:20:12 +00:00
osd: simplify session peer type check
Check the authenticated peer name directly; don't store a copy in the OSDCaps struct. Also set the entity_name member of the session! Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
parent
4cc122cc93
commit
8b5336a1f8
@ -2759,14 +2759,14 @@ bool OSD::ms_verify_authorizer(Connection *con, int peer_type,
|
||||
dout(10) << " new session " << s << " con=" << s->con << " addr=" << s->con->get_peer_addr() << dendl;
|
||||
}
|
||||
|
||||
s->entity_name = name;
|
||||
s->caps.set_allow_all(caps_info.allow_all);
|
||||
s->caps.set_auid(auid);
|
||||
s->caps.set_peer_type(peer_type);
|
||||
|
||||
if (caps_info.caps.length() > 0) {
|
||||
bufferlist::iterator iter = caps_info.caps.begin();
|
||||
s->caps.parse(iter);
|
||||
dout(10) << " session " << s << " has caps " << s->caps << dendl;
|
||||
dout(10) << " session " << s << " " << s->entity_name << " has caps " << s->caps << dendl;
|
||||
}
|
||||
|
||||
s->put();
|
||||
@ -2883,8 +2883,8 @@ void OSD::_dispatch(Message *m)
|
||||
case CEPH_MSG_SHUTDOWN:
|
||||
session = (Session *)m->get_connection()->get_priv();
|
||||
if (!session ||
|
||||
session->caps.is_mon() ||
|
||||
session->caps.is_osd()) shutdown();
|
||||
session->entity_name.is_mon() ||
|
||||
session->entity_name.is_osd()) shutdown();
|
||||
else dout(0) << "shutdown message from connection with insufficient privs!"
|
||||
<< m->get_connection() << dendl;
|
||||
m->put();
|
||||
@ -3160,7 +3160,7 @@ void OSD::handle_osd_map(MOSDMap *m)
|
||||
}
|
||||
|
||||
Session *session = (Session *)m->get_connection()->get_priv();
|
||||
if (session && !(session->caps.is_mon() || session->caps.is_osd())) {
|
||||
if (session && !(session->entity_name.is_mon() || session->entity_name.is_osd())) {
|
||||
//not enough perms!
|
||||
m->put();
|
||||
session->put();
|
||||
|
Loading…
Reference in New Issue
Block a user