Skip to content

Commit

Permalink
auth: Add an auid parameter to verify_authorizer and handle_request
Browse files Browse the repository at this point in the history
It defaults to null, in which case it's not assigned to.

auth: add optional auid param to handle_request
  • Loading branch information
Greg Farnum committed Mar 5, 2010
1 parent 4637d18 commit 846acac
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/auth/AuthAuthorizeHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ struct AuthAuthorizeHandler {
virtual ~AuthAuthorizeHandler() {}
virtual bool verify_authorizer(KeyStore *keys,
bufferlist& authorizer_data, bufferlist& authorizer_reply,
EntityName& entity_name, uint64_t& global_id, AuthCapsInfo& caps_info) = 0;
EntityName& entity_name, uint64_t& global_id,
AuthCapsInfo& caps_info, __u64 *auid = NULL) = 0;
};

extern AuthAuthorizeHandler *get_authorize_handler(int protocol);
Expand Down
2 changes: 1 addition & 1 deletion src/auth/AuthServiceHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct AuthServiceHandler {
virtual ~AuthServiceHandler() { }

virtual int start_session(EntityName& name, bufferlist::iterator& indata, bufferlist& result, AuthCapsInfo& caps) = 0;
virtual int handle_request(bufferlist::iterator& indata, bufferlist& result, uint64_t& global_id, AuthCapsInfo& caps) = 0;
virtual int handle_request(bufferlist::iterator& indata, bufferlist& result, uint64_t& global_id, AuthCapsInfo& caps, __u64 *auid = NULL) = 0;

EntityName& get_entity_name() { return entity_name; }
};
Expand Down
3 changes: 2 additions & 1 deletion src/auth/cephx/CephxAuthorizeHandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

bool CephxAuthorizeHandler::verify_authorizer(KeyStore *keys,
bufferlist& authorizer_data, bufferlist& authorizer_reply,
EntityName& entity_name, uint64_t& global_id, AuthCapsInfo& caps_info)
EntityName& entity_name, uint64_t& global_id, AuthCapsInfo& caps_info, __u64 *auid)
{
bufferlist::iterator iter = authorizer_data.begin();

Expand All @@ -25,6 +25,7 @@ bool CephxAuthorizeHandler::verify_authorizer(KeyStore *keys,
caps_info = auth_ticket_info.ticket.caps;
entity_name = auth_ticket_info.ticket.name;
global_id = auth_ticket_info.ticket.global_id;
if (auid) *auid = auth_ticket_info.ticket.auid;
}

return isvalid;
Expand Down
3 changes: 2 additions & 1 deletion src/auth/cephx/CephxAuthorizeHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
struct CephxAuthorizeHandler : public AuthAuthorizeHandler {
bool verify_authorizer(KeyStore *keys,
bufferlist& authorizer_data, bufferlist& authorizer_reply,
EntityName& entity_name, uint64_t& global_id, AuthCapsInfo& caps_info);
EntityName& entity_name, uint64_t& global_id,
AuthCapsInfo& caps_info, __u64 *auid = NULL);
};


Expand Down
4 changes: 3 additions & 1 deletion src/auth/cephx/CephxServiceHandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ int CephxServiceHandler::start_session(EntityName& name, bufferlist::iterator& i
return CEPH_AUTH_CEPHX;
}

int CephxServiceHandler::handle_request(bufferlist::iterator& indata, bufferlist& result_bl, uint64_t& global_id, AuthCapsInfo& caps)
int CephxServiceHandler::handle_request(bufferlist::iterator& indata, bufferlist& result_bl, uint64_t& global_id, AuthCapsInfo& caps, __u64 *auid)
{
int ret = 0;

Expand Down Expand Up @@ -107,6 +107,8 @@ int CephxServiceHandler::handle_request(bufferlist::iterator& indata, bufferlist
info.ticket.auid = eauth.auid;
info.validity += g_conf.auth_mon_ticket_ttl;

if (auid) *auid = eauth.auid;

key_server->generate_secret(session_key);

info.session_key = session_key;
Expand Down
2 changes: 1 addition & 1 deletion src/auth/cephx/CephxServiceHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class CephxServiceHandler : public AuthServiceHandler {
~CephxServiceHandler() {}

int start_session(EntityName& name, bufferlist::iterator& indata, bufferlist& result_bl, AuthCapsInfo& caps);
int handle_request(bufferlist::iterator& indata, bufferlist& result_bl, uint64_t& global_id, AuthCapsInfo& caps);
int handle_request(bufferlist::iterator& indata, bufferlist& result_bl, uint64_t& global_id, AuthCapsInfo& caps, __u64 *auid = NULL);
void build_cephx_response_header(int request_type, int status, bufferlist& bl);
};

Expand Down
3 changes: 2 additions & 1 deletion src/auth/none/AuthNoneAuthorizeHandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

bool AuthNoneAuthorizeHandler::verify_authorizer(KeyStore *keys,
bufferlist& authorizer_data, bufferlist& authorizer_reply,
EntityName& entity_name, uint64_t& global_id, AuthCapsInfo& caps_info)
EntityName& entity_name, uint64_t& global_id, AuthCapsInfo& caps_info,
__u64 *auid)
{
bufferlist::iterator iter = authorizer_data.begin();

Expand Down
3 changes: 2 additions & 1 deletion src/auth/none/AuthNoneAuthorizeHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
struct AuthNoneAuthorizeHandler : public AuthAuthorizeHandler {
bool verify_authorizer(KeyStore *keys,
bufferlist& authorizer_data, bufferlist& authorizer_reply,
EntityName& entity_name, uint64_t& global_id, AuthCapsInfo& caps_info);
EntityName& entity_name, uint64_t& global_id,
AuthCapsInfo& caps_info, __u64 *auid=NULL);
};


Expand Down
2 changes: 1 addition & 1 deletion src/auth/none/AuthNoneServiceHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class AuthNoneServiceHandler : public AuthServiceHandler {
caps.allow_all = true;
return CEPH_AUTH_NONE;
}
int handle_request(bufferlist::iterator& indata, bufferlist& result_bl, uint64_t& global_id, AuthCapsInfo& caps) {
int handle_request(bufferlist::iterator& indata, bufferlist& result_bl, uint64_t& global_id, AuthCapsInfo& caps, __u64 *auid = NULL) {
assert(0); // shouldn't get called
return 0;
}
Expand Down

0 comments on commit 846acac

Please sign in to comment.