| 658 | } |
| 659 | |
| 660 | bool AuthMonitor::prep_auth(MonOpRequestRef op, bool paxos_writable) |
| 661 | { |
| 662 | auto m = op->get_req<MAuth>(); |
| 663 | dout(10) << "prep_auth() blob_size=" << m->get_auth_payload().length() << dendl; |
| 664 | |
| 665 | MonSession *s = op->get_session(); |
| 666 | if (!s) { |
| 667 | dout(10) << "no session, dropping" << dendl; |
| 668 | return true; |
| 669 | } |
| 670 | |
| 671 | int ret = 0; |
| 672 | MAuthReply *reply; |
| 673 | bufferlist response_bl; |
| 674 | auto indata = m->auth_payload.cbegin(); |
| 675 | __u32 proto = m->protocol; |
| 676 | bool start = false; |
| 677 | bool finished = false; |
| 678 | EntityName entity_name; |
| 679 | bool is_new_global_id = false; |
| 680 | |
| 681 | // set up handler? |
| 682 | if (m->protocol == 0 && !s->auth_handler) { |
| 683 | set<__u32> supported; |
| 684 | |
| 685 | try { |
| 686 | __u8 struct_v = 1; |
| 687 | decode(struct_v, indata); |
| 688 | decode(supported, indata); |
| 689 | decode(entity_name, indata); |
| 690 | decode(s->con->peer_global_id, indata); |
| 691 | } catch (const ceph::buffer::error &e) { |
| 692 | dout(10) << "failed to decode initial auth message" << dendl; |
| 693 | ret = -EINVAL; |
| 694 | goto reply; |
| 695 | } |
| 696 | |
| 697 | // do we require cephx signatures? |
| 698 | |
| 699 | if (!m->get_connection()->has_feature(CEPH_FEATURE_MSG_AUTH)) { |
| 700 | if (entity_name.get_type() == CEPH_ENTITY_TYPE_MON || |
| 701 | entity_name.get_type() == CEPH_ENTITY_TYPE_OSD || |
| 702 | entity_name.get_type() == CEPH_ENTITY_TYPE_MDS || |
| 703 | entity_name.get_type() == CEPH_ENTITY_TYPE_MGR) { |
| 704 | if (g_conf()->cephx_cluster_require_signatures || |
| 705 | g_conf()->cephx_require_signatures) { |
| 706 | dout(1) << m->get_source_inst() |
| 707 | << " supports cephx but not signatures and" |
| 708 | << " 'cephx [cluster] require signatures = true';" |
| 709 | << " disallowing cephx" << dendl; |
| 710 | supported.erase(CEPH_AUTH_CEPHX); |
| 711 | } |
| 712 | } else { |
| 713 | if (g_conf()->cephx_service_require_signatures || |
| 714 | g_conf()->cephx_require_signatures) { |
| 715 | dout(1) << m->get_source_inst() |
| 716 | << " supports cephx but not signatures and" |
| 717 | << " 'cephx [service] require signatures = true';" |
nothing calls this directly
no test coverage detected