]> git.proxmox.com Git - ceph.git/blob - ceph/src/auth/krb/KrbServiceHandler.hpp
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / auth / krb / KrbServiceHandler.hpp
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) 2018 SUSE LLC.
7 * Author: Daniel Oliveira <doliveira@suse.com>
8 *
9 * This is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License version 2.1, as published by the Free Software
12 * Foundation. See file COPYING.
13 *
14 */
15
16 #ifndef KRB_SERVICE_HANDLER_HPP
17 #define KRB_SERVICE_HANDLER_HPP
18
19 #include "auth/AuthServiceHandler.h"
20 #include "auth/Auth.h"
21 #include "auth/cephx/CephxKeyServer.h"
22
23 #include <gssapi.h>
24 #include <gssapi/gssapi_generic.h>
25 #include <gssapi/gssapi_krb5.h>
26 #include <gssapi/gssapi_ext.h>
27
28
29 class KrbServiceHandler : public AuthServiceHandler {
30
31 public:
32 explicit KrbServiceHandler(CephContext* ceph_ctx, KeyServer* kserver) :
33 AuthServiceHandler(ceph_ctx),
34 m_gss_buffer_out({0, nullptr}),
35 m_gss_credentials(GSS_C_NO_CREDENTIAL),
36 m_gss_sec_ctx(GSS_C_NO_CONTEXT),
37 m_gss_service_name(GSS_C_NO_NAME),
38 m_key_server(kserver) { }
39 ~KrbServiceHandler();
40 int handle_request(bufferlist::const_iterator& indata,
41 size_t connection_secret_required_length,
42 bufferlist *buff_list,
43 uint64_t *global_id,
44 AuthCapsInfo *caps,
45 CryptoKey *session_key,
46 std::string *connection_secret) override;
47
48 int start_session(const EntityName& name,
49 size_t connection_secret_required_length,
50 bufferlist *buff_list,
51 AuthCapsInfo *caps,
52 CryptoKey *session_key,
53 std::string *connection_secret) override;
54
55 private:
56 gss_buffer_desc m_gss_buffer_out;
57 gss_cred_id_t m_gss_credentials;
58 gss_ctx_id_t m_gss_sec_ctx;
59 gss_name_t m_gss_service_name;
60 KeyServer* m_key_server;
61
62 };
63
64 #endif //-- KRB_SERVICE_HANDLER_HPP
65