1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2004-2009 Sage Weil <sage@newdream.net>
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.
15 #include "AuthServiceHandler.h"
16 #include "cephx/CephxServiceHandler.h"
18 #include "krb/KrbServiceHandler.hpp"
20 #include "none/AuthNoneServiceHandler.h"
21 #include "common/dout.h"
23 #define dout_subsys ceph_subsys_auth
26 std::ostream
& operator<<(std::ostream
& os
,
27 global_id_status_t global_id_status
)
29 switch (global_id_status
) {
30 case global_id_status_t::NONE
:
32 case global_id_status_t::NEW_PENDING
:
33 return os
<< "new_pending";
34 case global_id_status_t::NEW_OK
:
35 return os
<< "new_ok";
36 case global_id_status_t::NEW_NOT_EXPOSED
:
37 return os
<< "new_not_exposed";
38 case global_id_status_t::RECLAIM_PENDING
:
39 return os
<< "reclaim_pending";
40 case global_id_status_t::RECLAIM_OK
:
41 return os
<< "reclaim_ok";
42 case global_id_status_t::RECLAIM_INSECURE
:
43 return os
<< "reclaim_insecure";
49 int AuthServiceHandler::start_session(const EntityName
& entity_name
,
51 bool is_new_global_id
,
52 ceph::buffer::list
*result
,
55 ceph_assert(!this->entity_name
.get_type() && !this->global_id
&&
56 global_id_status
== global_id_status_t::NONE
);
58 ldout(cct
, 10) << __func__
<< " entity_name=" << entity_name
59 << " global_id=" << global_id
<< " is_new_global_id="
60 << is_new_global_id
<< dendl
;
61 this->entity_name
= entity_name
;
62 this->global_id
= global_id
;
64 return do_start_session(is_new_global_id
, result
, caps
);
67 AuthServiceHandler
*get_auth_service_handler(int type
, CephContext
*cct
, KeyServer
*ks
)
71 return new CephxServiceHandler(cct
, ks
);
73 return new AuthNoneServiceHandler(cct
);
76 return new KrbServiceHandler(cct
, ks
);