EntityName name;
uint64_t global_id;
- is_valid = authorize_handler->verify_authorizer(cct, monc->rotating_secrets,
- authorizer_data, authorizer_reply, name, global_id, caps_info, session_key);
+ is_valid = authorize_handler->verify_authorizer(
+ cct, monc->rotating_secrets.get(),
+ authorizer_data, authorizer_reply, name, global_id, caps_info, session_key);
if (is_valid) {
entity_name_t n(con->get_peer_type(), global_id);
EntityName name;
uint64_t global_id = 0;
- is_valid = handler->verify_authorizer(cct, monc->rotating_secrets,
- authorizer_data,
- authorizer_reply, name,
- global_id, caps_info,
- session_key);
+ is_valid = handler->verify_authorizer(
+ cct, monc->rotating_secrets.get(),
+ authorizer_data,
+ authorizer_reply, name,
+ global_id, caps_info,
+ session_key);
// TODO: invent some caps suitable for ceph-mgr
no_keyring_disabled_cephx(false),
log_client(NULL),
more_log_pending(false),
- auth_supported(NULL),
hunting(true),
want_monmap(true),
want_keys(0), global_id(0),
authenticate_err(0),
- session_established_context(NULL),
had_a_connection(false),
reopen_interval_multiplier(1.0),
- auth(NULL),
- keyring(NULL),
- rotating_secrets(NULL),
last_mon_command_tid(0),
version_req_id(0)
{
MonClient::~MonClient()
{
- delete auth_supported;
- delete session_established_context;
- delete auth;
- delete keyring;
- delete rotating_secrets;
}
int MonClient::build_initial_monmap()
Mutex::Locker l(monc_lock);
string method;
- if (!cct->_conf->auth_supported.empty())
- method = cct->_conf->auth_supported;
- else if (entity_name.get_type() == CEPH_ENTITY_TYPE_OSD ||
- entity_name.get_type() == CEPH_ENTITY_TYPE_MDS ||
- entity_name.get_type() == CEPH_ENTITY_TYPE_MON)
- method = cct->_conf->auth_cluster_required;
- else
- method = cct->_conf->auth_client_required;
- auth_supported = new AuthMethodList(cct, method);
+ if (!cct->_conf->auth_supported.empty())
+ method = cct->_conf->auth_supported;
+ else if (entity_name.get_type() == CEPH_ENTITY_TYPE_OSD ||
+ entity_name.get_type() == CEPH_ENTITY_TYPE_MDS ||
+ entity_name.get_type() == CEPH_ENTITY_TYPE_MON)
+ method = cct->_conf->auth_cluster_required;
+ else
+ method = cct->_conf->auth_client_required;
+ auth_supported.reset(new AuthMethodList(cct, method));
ldout(cct, 10) << "auth_supported " << auth_supported->get_supported_set() << " method " << method << dendl;
int r = 0;
- keyring = new KeyRing; // initializing keyring anyway
+ keyring.reset(new KeyRing); // initializing keyring anyway
if (auth_supported->is_supported_auth(CEPH_AUTH_CEPHX)) {
r = keyring->from_ceph_context(cct);
return r;
}
- rotating_secrets = new RotatingKeyRing(cct, cct->get_module_type(), keyring);
+ rotating_secrets.reset(
+ new RotatingKeyRing(cct, cct->get_module_type(), keyring.get()));
initialized = true;
bufferlist::iterator p = m->result_bl.begin();
if (state == MC_STATE_NEGOTIATING) {
if (!auth || (int)m->protocol != auth->get_protocol()) {
- delete auth;
- auth = get_auth_client_handler(cct, m->protocol, rotating_secrets);
+ auth.reset(get_auth_client_handler(cct, m->protocol,
+ rotating_secrets.get()));
if (!auth) {
ldout(cct, 10) << "no handler for protocol " << m->protocol << dendl;
if (m->result == -ENOTSUP) {
send_log();
}
if (session_established_context) {
- cb = session_established_context;
- session_established_context = NULL;
+ cb = session_established_context.release();
}
}
void send_log();
- AuthMethodList *auth_supported;
+ std::unique_ptr<AuthMethodList> auth_supported;
bool ms_dispatch(Message *m);
bool ms_handle_reset(Connection *con);
list<Message*> waiting_for_session;
utime_t last_rotating_renew_sent;
- Context *session_established_context;
+ std::unique_ptr<Context> session_established_context;
bool had_a_connection;
double reopen_interval_multiplier;
// auth tickets
public:
- AuthClientHandler *auth;
+ std::unique_ptr<AuthClientHandler> auth;
public:
void renew_subs() {
Mutex::Locker l(monc_lock);
return false;
}
- KeyRing *keyring;
- RotatingKeyRing *rotating_secrets;
+ std::unique_ptr<KeyRing> keyring;
+ std::unique_ptr<RotatingKeyRing> rotating_secrets;
public:
explicit MonClient(CephContext *cct_);
void reopen_session(Context *cb=NULL) {
Mutex::Locker l(monc_lock);
if (cb) {
- delete session_established_context;
- session_established_context = cb;
+ session_established_context.reset(cb);
}
_reopen_session();
}
uint64_t global_id;
uint64_t auid = CEPH_AUTH_UID_DEFAULT;
- isvalid = authorize_handler->verify_authorizer(cct, monc->rotating_secrets,
- authorizer_data, authorizer_reply, name, global_id, caps_info, session_key, &auid);
+ isvalid = authorize_handler->verify_authorizer(
+ cct, monc->rotating_secrets.get(),
+ authorizer_data, authorizer_reply, name, global_id, caps_info, session_key,
+ &auid);
if (isvalid) {
Session *s = static_cast<Session *>(con->get_priv());