#ifndef CEPH_AUTHAUTHORIZEHANDLER_H
#define CEPH_AUTHAUTHORIZEHANDLER_H
-#include "include/types.h"
-#include "common/config.h"
#include "Auth.h"
+#include "include/types.h"
+class CephContext;
class KeyRing;
class RotatingKeyRing;
struct AuthAuthorizeHandler {
virtual ~AuthAuthorizeHandler() {}
- virtual bool verify_authorizer(KeyStore *keys,
+ virtual bool verify_authorizer(CephContext *cct, KeyStore *keys,
bufferlist& authorizer_data, bufferlist& authorizer_reply,
EntityName& entity_name, uint64_t& global_id,
AuthCapsInfo& caps_info, uint64_t *auid = NULL) = 0;
// ---------------------------------------------------
-int CryptoKey::set_secret(int type, bufferptr& s)
+int CryptoKey::set_secret(CephContext *cct, int type, bufferptr& s)
{
this->type = type;
- created = ceph_clock_now(&g_ceph_context);
+ created = ceph_clock_now(cct);
CryptoHandler *h = get_crypto_handler(type);
if (!h)
utime_t get_created() const { return created; }
void print(std::ostream& out) const;
- int set_secret(int type, bufferptr& s);
+ int set_secret(CephContext *cct, int type, bufferptr& s);
bufferptr& get_secret() { return secret; }
const bufferptr& get_secret() const { return secret; }
#include "CephxAuthorizeHandler.h"
-bool CephxAuthorizeHandler::verify_authorizer(KeyStore *keys,
+bool CephxAuthorizeHandler::verify_authorizer(CephContext *cct, KeyStore *keys,
bufferlist& authorizer_data, bufferlist& authorizer_reply,
EntityName& entity_name, uint64_t& global_id, AuthCapsInfo& caps_info, uint64_t *auid)
{
bufferlist::iterator iter = authorizer_data.begin();
if (!authorizer_data.length()) {
- dout(1) << "verify authorizer, authorizer_data.length()=0" << dendl;
+ ldout(cct, 1) << "verify authorizer, authorizer_data.length()=0" << dendl;
return false;
}
CephXServiceTicketInfo auth_ticket_info;
- bool isvalid = cephx_verify_authorizer(&g_ceph_context, keys, iter, auth_ticket_info, authorizer_reply);
- dout(1) << "CephxAuthorizeHandler::verify_authorizer isvalid=" << isvalid << dendl;
+ bool isvalid = cephx_verify_authorizer(cct, keys, iter, auth_ticket_info, authorizer_reply);
+ ldout(cct, 1) << "CephxAuthorizeHandler::verify_authorizer isvalid=" << isvalid << dendl;
if (isvalid) {
caps_info = auth_ticket_info.ticket.caps;
#include "../AuthAuthorizeHandler.h"
+class CephContext;
+
struct CephxAuthorizeHandler : public AuthAuthorizeHandler {
- bool verify_authorizer(KeyStore *keys,
+ bool verify_authorizer(CephContext *cct, KeyStore *keys,
bufferlist& authorizer_data, bufferlist& authorizer_reply,
EntityName& entity_name, uint64_t& global_id,
AuthCapsInfo& caps_info, uint64_t *auid = NULL);
starting(false),
server_challenge(0),
authorizer(0),
- tickets(&g_ceph_context),
+ tickets(cct_),
rotating_secrets(rsecrets),
keyring(rsecrets->get_keyring())
{
if (crypto->create(bp) < 0)
return false;
- secret.set_secret(CEPH_CRYPTO_AES, bp);
+ secret.set_secret(cct, CEPH_CRYPTO_AES, bp);
return true;
}
#include "AuthNoneAuthorizeHandler.h"
#include "common/debug.h"
-bool AuthNoneAuthorizeHandler::verify_authorizer(KeyStore *keys,
+bool AuthNoneAuthorizeHandler::verify_authorizer(CephContext *cct, KeyStore *keys,
bufferlist& authorizer_data, bufferlist& authorizer_reply,
EntityName& entity_name, uint64_t& global_id, AuthCapsInfo& caps_info,
uint64_t *auid)
::decode(entity_name, iter);
::decode(global_id, iter);
} catch (const buffer::error &err) {
- dout(0) << "AuthNoneAuthorizeHandle::verify_authorizer() failed to decode" << dendl;
+ ldout(cct, 0) << "AuthNoneAuthorizeHandle::verify_authorizer() failed to decode" << dendl;
return false;
}
#include "../AuthAuthorizeHandler.h"
+class CephContext;
+
struct AuthNoneAuthorizeHandler : public AuthAuthorizeHandler {
- bool verify_authorizer(KeyStore *keys,
+ bool verify_authorizer(CephContext *cct, KeyStore *keys,
bufferlist& authorizer_data, bufferlist& authorizer_reply,
EntityName& entity_name, uint64_t& global_id,
AuthCapsInfo& caps_info, uint64_t *auid=NULL);
EntityName name;
uint64_t global_id;
- is_valid = authorize_handler->verify_authorizer(monc->rotating_secrets,
+ is_valid = authorize_handler->verify_authorizer(cct, monc->rotating_secrets,
authorizer_data, authorizer_reply, name, global_id, caps_info);
if (is_valid) {
uint64_t global_id;
uint64_t auid = CEPH_AUTH_UID_DEFAULT;
- isvalid = authorize_handler->verify_authorizer(monc->rotating_secrets,
+ isvalid = authorize_handler->verify_authorizer(&g_ceph_context, monc->rotating_secrets,
authorizer_data, authorizer_reply, name, global_id, caps_info, &auid);
dout(10) << "OSD::ms_verify_authorizer name=" << name << " auid=" << auid << dendl;