From e3e9116f2cfc655fa1006e844cead287e9144349 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Wed, 30 Sep 2009 16:17:00 -0700 Subject: [PATCH] auth: librados requests for osd and mon keys --- src/auth/AuthClientHandler.cc | 5 +++-- src/auth/AuthClientHandler.h | 3 +++ src/librados.cc | 2 +- src/mon/MonClient.h | 6 ++++++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/auth/AuthClientHandler.cc b/src/auth/AuthClientHandler.cc index 4f715693bf32d..f055b301d7547 100644 --- a/src/auth/AuthClientHandler.cc +++ b/src/auth/AuthClientHandler.cc @@ -215,6 +215,7 @@ int AuthClientAuthenticateHandler::generate_cephx_authenticate_request(bufferlis { CephXRequestHeader header; AuthTicketHandler& ticket_handler = client->tickets.get_handler(CEPHX_PRINCIPAL_AUTH); + if (!ticket_handler.has_key()) { dout(0) << "auth ticket: doesn't have key" << dendl; /* we first need to get the principle/auth session key */ @@ -271,8 +272,8 @@ int AuthClientAuthenticateHandler::handle_cephx_response(bufferlist::iterator& i dout(0) << "could not verify service_ticket reply" << dendl; return -EPERM; } - - if (want) + dout(0) << "want=" << want << " have=" << have << dendl; + if (want != have) ret = -EAGAIN; } break; diff --git a/src/auth/AuthClientHandler.h b/src/auth/AuthClientHandler.h index c9e2d0b4f17a0..4d771264c176b 100644 --- a/src/auth/AuthClientHandler.h +++ b/src/auth/AuthClientHandler.h @@ -116,6 +116,9 @@ protected: public: AuthClientAuthenticateHandler(AuthClientHandler *client, uint32_t _want, uint32_t _have) : AuthClientProtocolHandler(client), want(_want), have(_have) { reset(); } + void set_want_keys(__u32 keys) { + want = keys; + } }; class AuthClientAuthorizeHandler : public AuthClientProtocolHandler { diff --git a/src/librados.cc b/src/librados.cc index 9b9b069d68bed..83005f023f810 100644 --- a/src/librados.cc +++ b/src/librados.cc @@ -302,7 +302,7 @@ bool RadosClient::init() rank.start(1); messenger->add_dispatcher_head(this); - monclient.auth.set_want_keys(CEPHX_PRINCIPAL_MON | CEPHX_PRINCIPAL_OSD); + monclient.set_want_keys(CEPHX_PRINCIPAL_MON | CEPHX_PRINCIPAL_OSD); monclient.init(); if (monclient.get_monmap() < 0) diff --git a/src/mon/MonClient.h b/src/mon/MonClient.h index 88e17227f5254..3a06f26cf3b11 100644 --- a/src/mon/MonClient.h +++ b/src/mon/MonClient.h @@ -86,6 +86,8 @@ private: // monclient bool want_monmap; + uint32_t want_keys; + // mount private: client_t clientid; @@ -224,6 +226,10 @@ public: void set_messenger(Messenger *m) { messenger = m; } void send_message(Message *m); + + void set_want_keys(uint32_t want) { + auth_handler.set_want_keys(want); + } }; #endif -- 2.39.5