MCPcopy Create free account
hub / github.com/ceph/ceph / authenticate

Method authenticate

src/mon/MonClient.cc:581–623  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

579}
580
581int MonClient::authenticate(double timeout)
582{
583 std::unique_lock lock{monc_lock};
584
585 if (active_con) {
586 ldout(cct, 5) << "already authenticated" << dendl;
587 return 0;
588 }
589 sub.want("monmap", monmap.get_epoch() ? monmap.get_epoch() + 1 : 0, 0);
590 sub.want("config", 0, 0);
591 if (!_opened())
592 _reopen_session();
593
594 auto until = ceph::mono_clock::now();
595 until += ceph::make_timespan(timeout);
596 if (timeout > 0.0)
597 ldout(cct, 10) << "authenticate will time out at " << until << dendl;
598 while (!active_con && authenticate_err >= 0) {
599 if (timeout > 0.0) {
600 auto r = auth_cond.wait_until(lock, until);
601 if (r == std::cv_status::timeout && !active_con) {
602 ldout(cct, 0) << "authenticate timed out after " << timeout << dendl;
603 authenticate_err = -ETIMEDOUT;
604 }
605 } else {
606 auth_cond.wait(lock);
607 }
608 }
609
610 if (active_con) {
611 ldout(cct, 5) << __func__ << " success, global_id "
612 << active_con->get_global_id() << dendl;
613 // active_con should not have been set if there was an error
614 ceph_assert(authenticate_err >= 0);
615 authenticated = true;
616 }
617
618 if (authenticate_err < 0 && auth_registry.no_keyring_disabled_cephx()) {
619 lderr(cct) << __func__ << " NOTE: no keyring found; disabled cephx authentication" << dendl;
620 }
621
622 return authenticate_err;
623}
624
625int MonClient::call(
626 std::string_view command,

Callers 3

initMethod · 0.45
initMethod · 0.45
handle_authMethod · 0.45

Calls 15

make_timespanFunction · 0.85
wantMethod · 0.80
wait_untilMethod · 0.80
send_message2Method · 0.80
nowFunction · 0.50
get_epochMethod · 0.45
waitMethod · 0.45
get_global_idMethod · 0.45
resetMethod · 0.45
set_global_idMethod · 0.45
cbeginMethod · 0.45

Tested by

no test coverage detected