Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / auth / unknown / AuthUnknownClientHandler.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_AUTHUNKNOWNCLIENTHANDLER_H
16 #define CEPH_AUTHUNKNOWNCLIENTHANDLER_H
17
18 #include "auth/AuthClientHandler.h"
19 #include "AuthUnknownProtocol.h"
20
21 class CephContext;
22
23 class AuthUnknownClientHandler : public AuthClientHandler {
24 public:
25   AuthUnknownClientHandler(CephContext *cct_, RotatingKeyRing *rkeys) 
26     : AuthClientHandler(cct_) {}
27
28   void reset() { }
29
30   void prepare_build_request() {}
31   int build_request(bufferlist& bl) const { return 0; }
32   int handle_response(int ret, bufferlist::iterator& iter) { return 0; }
33   bool build_rotating_request(bufferlist& bl) const { return false; }
34
35   int get_protocol() const { return CEPH_AUTH_UNKNOWN; }
36   
37   AuthAuthorizer *build_authorizer(uint32_t service_id) const {
38     RWLock::RLocker l(lock);
39     AuthUnknownAuthorizer *auth = new AuthUnknownAuthorizer();
40     if (auth) {
41       auth->build_authorizer(cct->_conf->name, global_id);
42     }
43     return auth;
44   }
45
46   bool need_tickets() { return false; }
47
48   void set_global_id(uint64_t id) {
49     RWLock::WLocker l(lock);
50     global_id = id;
51   }
52 private:
53   void validate_tickets() { }
54 };
55
56 #endif