static Mutex _lock("auth_service_handler_init");
static map<int, AuthAuthorizeHandler *> authorizers;
-static void _init_authorizers(void)
+static void _init_authorizers(CephContext *cct)
{
- if (is_supported_auth(CEPH_AUTH_NONE)) {
+ if (is_supported_auth(CEPH_AUTH_NONE, cct)) {
authorizers[CEPH_AUTH_NONE] = new AuthNoneAuthorizeHandler();
}
- if (is_supported_auth(CEPH_AUTH_CEPHX)) {
+ if (is_supported_auth(CEPH_AUTH_CEPHX, cct)) {
authorizers[CEPH_AUTH_CEPHX] = new CephxAuthorizeHandler();
}
_initialized = true;
}
-AuthAuthorizeHandler *get_authorize_handler(int protocol)
+AuthAuthorizeHandler *get_authorize_handler(int protocol, CephContext *cct)
{
Mutex::Locker l(_lock);
if (!_initialized) {
- _init_authorizers();
+ _init_authorizers(cct);
}
map<int, AuthAuthorizeHandler *>::iterator iter = authorizers.find(protocol);
AuthCapsInfo& caps_info, uint64_t *auid = NULL) = 0;
};
-extern AuthAuthorizeHandler *get_authorize_handler(int protocol);
+extern AuthAuthorizeHandler *get_authorize_handler(int protocol, CephContext *cct);
#endif
AuthServiceHandler *get_auth_service_handler(CephContext *cct, KeyServer *ks,
set<__u32>& supported)
{
- if (is_supported_auth(CEPH_AUTH_CEPHX) && supported.count(CEPH_AUTH_CEPHX))
+ if (is_supported_auth(CEPH_AUTH_CEPHX, cct) && supported.count(CEPH_AUTH_CEPHX))
return new CephxServiceHandler(cct, ks);
- if (is_supported_auth(CEPH_AUTH_NONE) && supported.count(CEPH_AUTH_NONE))
+ if (is_supported_auth(CEPH_AUTH_NONE, cct) && supported.count(CEPH_AUTH_NONE))
return new AuthNoneServiceHandler(cct);
return NULL;
}
static Mutex _supported_lock("auth_supported_init");
static map<int, bool> auth_supported;
-static void _init_supported(void)
+static void _init_supported(CephContext *cct)
{
- string str = g_conf->auth_supported;
+ string str = cct->_conf->auth_supported;
list<string> sup_list;
get_str_list(str, sup_list);
for (list<string>::iterator iter = sup_list.begin(); iter != sup_list.end(); ++iter) {
} else if (iter->compare("none") == 0) {
auth_supported[CEPH_AUTH_NONE] = true;
} else {
- derr << "WARNING: unknown auth protocol defined: " << *iter << dendl;
+ lderr(cct) << "WARNING: unknown auth protocol defined: " << *iter << dendl;
}
}
_supported_initialized = true;
}
-bool is_supported_auth(int auth_type)
+bool is_supported_auth(int auth_type, CephContext *cct)
{
{
Mutex::Locker lock(_supported_lock);
if (!_supported_initialized) {
- _init_supported();
+ _init_supported(cct);
}
}
return auth_supported[auth_type];
#include <map>
-extern bool is_supported_auth(int auth_type);
+class CephContext;
+
+extern bool is_supported_auth(int auth_type, CephContext *cct);
#endif
bool found_key = false;
auto_ptr < KeyRing > keyring(new KeyRing());
- if (!is_supported_auth(CEPH_AUTH_CEPHX)) {
+ if (!is_supported_auth(CEPH_AUTH_CEPHX, cct)) {
ldout(cct, 2) << "KeyRing::from_ceph_context: CephX auth is not supported." << dendl;
return keyring.release();
}
{
Mutex::Locker l(mds_lock);
- AuthAuthorizeHandler *authorize_handler = get_authorize_handler(protocol);
+ AuthAuthorizeHandler *authorize_handler =
+ get_authorize_handler(protocol, &g_ceph_context);
if (!authorize_handler) {
dout(0) << "No AuthAuthorizeHandler found for protocol " << protocol << dendl;
is_valid = false;
if (service_id != CEPH_ENTITY_TYPE_MON)
return false;
- if (!is_supported_auth(CEPH_AUTH_CEPHX))
+ if (!is_supported_auth(CEPH_AUTH_CEPHX, &g_ceph_context))
return false;
CephXServiceTicketInfo auth_ticket_info;
<< " protocol " << protocol << dendl;
if (peer_type == CEPH_ENTITY_TYPE_MON &&
- is_supported_auth(CEPH_AUTH_CEPHX)) {
+ is_supported_auth(CEPH_AUTH_CEPHX, &g_ceph_context)) {
// monitor, and cephx is enabled
isvalid = false;
if (protocol == CEPH_AUTH_CEPHX) {
int protocol, bufferlist& authorizer_data, bufferlist& authorizer_reply,
bool& isvalid)
{
- AuthAuthorizeHandler *authorize_handler = get_authorize_handler(protocol);
+ AuthAuthorizeHandler *authorize_handler =
+ get_authorize_handler(protocol, &g_ceph_context);
if (!authorize_handler) {
dout(0) << "No AuthAuthorizeHandler found for protocol " << protocol << dendl;
isvalid = false;