Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / auth / none / AuthNoneClientHandler.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
2 // vim: ts=8 sw=2 smarttab
3 /*
4  * Ceph - scalable distributed file system
5  *
6  * Copyright (C) 2004-2009 Sage Weil <sage@newdream.net>
7  *
8  * This is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License version 2.1, as published by the Free Software 
11  * Foundation.  See file COPYING.
12  * 
13  */
14
15 #ifndef CEPH_AUTHNONECLIENTHANDLER_H
16 #define CEPH_AUTHNONECLIENTHANDLER_H
17
18 #include "auth/AuthClientHandler.h"
19 #include "AuthNoneProtocol.h"
20 #include "common/ceph_context.h"
21 #include "common/config.h"
22  
23 class AuthNoneClientHandler : public AuthClientHandler {
24 public:
25   AuthNoneClientHandler(CephContext *cct_, RotatingKeyRing *rkeys) 
26     : AuthClientHandler(cct_) {}
27
28   void reset() override { }
29
30   void prepare_build_request() override {}
31   int build_request(bufferlist& bl) const override { return 0; }
32   int handle_response(int ret, bufferlist::iterator& iter) override { return 0; }
33   bool build_rotating_request(bufferlist& bl) const override { return false; }
34
35   int get_protocol() const override { return CEPH_AUTH_NONE; }
36   
37   AuthAuthorizer *build_authorizer(uint32_t service_id) const override {
38     RWLock::RLocker l(lock);
39     AuthNoneAuthorizer *auth = new AuthNoneAuthorizer();
40     if (auth) {
41       auth->build_authorizer(cct->_conf->name, global_id);
42     }
43     return auth;
44   }
45
46   bool need_tickets() override { return false; }
47
48   void set_global_id(uint64_t id) override {
49     RWLock::WLocker l(lock);
50     global_id = id;
51   }
52 private:
53   void validate_tickets() override {}
54 };
55
56 #endif