diff --git a/cta.spec.in b/cta.spec.in index 138f2971a5d890bb7bc0db05ab7350636b960aba..3e8d05bf3a9826a4e7c6e8c6a99835698e301993 100644 --- a/cta.spec.in +++ b/cta.spec.in @@ -124,6 +124,7 @@ The xroot plugin %files -n cta-cli %defattr(-,root,root) %attr(0755,root,root) %{_bindir}/cta +%attr(0755,root,root) %{_bindir}/cta_admin %attr(0755,root,root) %{_bindir}/eoscta_stub %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/cta/cta-cli.conf @@ -187,6 +188,7 @@ The xroot plugin %files -n cta-cli %defattr(-,root,root) %attr(0755,root,root) %{_bindir}/cta +%attr(0755,root,root) %{_bindir}/cta_admin %attr(0755,root,root) %{_bindir}/eoscta_stub %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/cta/cta-cli.conf diff --git a/xroot_plugins/XrdSsiCtaRequestProc.cpp b/xroot_plugins/XrdSsiCtaRequestProc.cpp index 61ef4447efa57f63d8af672dc0a673a6f1f27b08..e4c4feef329ffd2e9898e895730ad7560fb8837a 100644 --- a/xroot_plugins/XrdSsiCtaRequestProc.cpp +++ b/xroot_plugins/XrdSsiCtaRequestProc.cpp @@ -23,7 +23,6 @@ #include "XrdSsiPbDebug.hpp" #endif #include "XrdSsiPbException.hpp" -#include "XrdSsiPbResource.hpp" #include "XrdSsiPbRequestProc.hpp" #include "xroot_plugins/messages/cta_frontend.pb.h" @@ -72,7 +71,7 @@ void RequestProc<cta::xrd::Request, cta::xrd::Response, cta::xrd::Alert>::Execut //const cta::eos::Notification ¬ification = m_request.notification(); - cta::frontend::EosNotificationRequest eos_rq(getClient(m_resource), cta_service_ptr); + cta::frontend::EosNotificationRequest eos_rq(*(m_resource.client), cta_service_ptr); eos_rq.process(m_request.notification(), m_metadata); } catch(std::exception &ex) diff --git a/xroot_ssi_pb/XrdSsiPbResource.hpp b/xroot_ssi_pb/XrdSsiPbResource.hpp deleted file mode 100644 index 3317a82f012ace1ade0eb175295b1ea609dc0c39..0000000000000000000000000000000000000000 --- a/xroot_ssi_pb/XrdSsiPbResource.hpp +++ /dev/null @@ -1,80 +0,0 @@ -/*! - * @project The CERN Tape Archive (CTA) - * @brief Interface to XRootD SSI Resource class - * @copyright Copyright 2017 CERN - * @license This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#pragma once - -#include <XrdSsi/XrdSsiResource.hh> -#include <XrdSsi/XrdSsiEntity.hh> -#include "XrdSsiPbException.hpp" - - - -namespace XrdSsiPb { - -/*! - * Get the client username from the Resource. - * - * The following fields are available in the client: - * - * prot char* Protocol used - * name const char* Entity's name - * host const char* Entity's host name or address - * vorg const char* Entity's virtual organization - * role const char* Entity's role - * grps const char* Entity's group names - * endorsements const char* Protocol-specific endorsements - * creds const char* Raw client credentials or certificate - * credslen int Length of the 'creds' field - * rsvd int Reserved - * tident const char* Trace identifier (always preset) - */ - -static const XrdSsiEntity &getClient(const XrdSsiResource &resource) -{ -#ifdef XRDSSI_DEBUG - std::cerr << "[DEBUG] Resource name: " << resource.rName << std::endl - << "[DEBUG] Resource user: " << resource.rUser << std::endl - << "[DEBUG] Resource info: " << resource.rInfo << std::endl - << "[DEBUG] Hosts to avoid: " << resource.hAvoid << std::endl - << "[DEBUG] Affinity: "; - - switch(resource.affinity) - { - case XrdSsiResource::None: std::cerr << "None" << std::endl; break; - case XrdSsiResource::Default: std::cerr << "Default" << std::endl; break; - case XrdSsiResource::Weak: std::cerr << "Weak" << std::endl; break; - case XrdSsiResource::Strong: std::cerr << "Strong" << std::endl; break; - case XrdSsiResource::Strict: std::cerr << "Strict" << std::endl; break; - } - - std::cerr << "[DEBUG] Resource options: " - << (resource.rOpts & XrdSsiResource::Reusable ? "Resuable " : "") - << (resource.rOpts & XrdSsiResource::Discard ? "Discard" : "") - << std::endl; -#endif - - if(resource.client == nullptr) - { - throw XrdSsiException("getClient(): resource.client is a null pointer"); - } - - return *(resource.client); -} - -} // namespace XrdSsiPb - diff --git a/xroot_ssi_pb/XrdSsiPbService.hpp b/xroot_ssi_pb/XrdSsiPbService.hpp index 5c292c32fee4e7ebe83071b45d679f5aecf857c9..9ea1ebb7ace998e74f0652475ff4e1687cd89e8d 100644 --- a/xroot_ssi_pb/XrdSsiPbService.hpp +++ b/xroot_ssi_pb/XrdSsiPbService.hpp @@ -19,6 +19,7 @@ #pragma once #include <XrdSsi/XrdSsiService.hh> +#include <XrdSsi/XrdSsiEntity.hh> #include "XrdSsiPbRequestProc.hpp" namespace XrdSsiPb { @@ -28,7 +29,6 @@ namespace XrdSsiPb { * * Obtained using GetService() method of the XrdSsiPbServiceProvider factory */ - template <typename RequestType, typename MetadataType, typename AlertType> class Service : public XrdSsiService { @@ -51,7 +51,6 @@ public: * Currently not implemented as it would require tracking all in-flight Requests by the application * when this is really the job of the framework. */ - virtual bool Stop() override { #ifdef XRDSSI_DEBUG @@ -65,12 +64,37 @@ public: /*! * Perform Request pre-authorisation and/or resource optimisation. */ - - virtual bool Prepare(XrdSsiErrInfo &eInfo, const XrdSsiResource &rDesc) override + virtual bool Prepare(XrdSsiErrInfo &eInfo, const XrdSsiResource &resource) override { #ifdef XRDSSI_DEBUG - std::cout << "[DEBUG] Service::Prepare()" << std::endl; + std::cout << "[DEBUG] Service::Prepare():" << std::endl; + std::cerr << "[DEBUG] Resource name: " << resource.rName << std::endl + << "[DEBUG] Resource user: " << resource.rUser << std::endl + << "[DEBUG] Resource info: " << resource.rInfo << std::endl + << "[DEBUG] Hosts to avoid: " << resource.hAvoid << std::endl + << "[DEBUG] Affinity: "; + + switch(resource.affinity) + { + case XrdSsiResource::None: std::cerr << "None" << std::endl; break; + case XrdSsiResource::Default: std::cerr << "Default" << std::endl; break; + case XrdSsiResource::Weak: std::cerr << "Weak" << std::endl; break; + case XrdSsiResource::Strong: std::cerr << "Strong" << std::endl; break; + case XrdSsiResource::Strict: std::cerr << "Strict" << std::endl; break; + } + + std::cerr << "[DEBUG] Resource options: " + << (resource.rOpts & XrdSsiResource::Reusable ? "Resuable " : "") + << (resource.rOpts & XrdSsiResource::Discard ? "Discard" : "") + << std::endl; #endif + if(resource.client == nullptr || resource.client->name == nullptr) + { + eInfo.Set("Service::Prepare(): XRootD client name is not set. " + "Possible misconfiguration of the KRB5 or SSS keyfile.", EACCES); + return false; + } + return true; } @@ -80,7 +104,6 @@ public: * This is required only if the service needs to make decisions on how to run a request based on whether * it is attached or detached. See Sect. 3.3.1 "Detached Requests" in the XRootD SSI documentation. */ - virtual bool Attach(XrdSsiErrInfo &eInfo, const std::string &handle, XrdSsiRequest &reqRef, XrdSsiResource *resp) override { @@ -100,7 +123,6 @@ public: * Request and Resource objects are transmitted to the server and passed into the service's ProcessRequest() * method. */ - template <typename RequestType, typename MetadataType, typename AlertType> void Service<RequestType, MetadataType, AlertType>::ProcessRequest(XrdSsiRequest &reqRef, XrdSsiResource &resRef) {