XRootD
Loading...
Searching...
No Matches
XrdSsiFileResource.cc
Go to the documentation of this file.
1/******************************************************************************/
2/* */
3/* X r d S s i F i l e R e s o u r c e . c c */
4/* */
5/* (c) 2017 by the Board of Trustees of the Leland Stanford, Jr., University */
6/* Produced by Andrew Hanushevsky for Stanford University under contract */
7/* DE-AC02-76-SFO0515 with the Department of Energy */
8/* */
9/* This file is part of the XRootD software suite. */
10/* */
11/* XRootD is free software: you can redistribute it and/or modify it under */
12/* the terms of the GNU Lesser General Public License as published by the */
13/* Free Software Foundation, either version 3 of the License, or (at your */
14/* option) any later version. */
15/* */
16/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
17/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
18/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
19/* License for more details. */
20/* */
21/* You should have received a copy of the GNU Lesser General Public License */
22/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
23/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
24/* */
25/* The copyright holder's institutional names and contributor's names may not */
26/* be used to endorse or promote products derived from this software without */
27/* specific prior written permission of the institution or contributor. */
28/******************************************************************************/
29
30#include <cstdlib>
31
32#include "XrdOuc/XrdOucEnv.hh"
33
37
38/******************************************************************************/
39/* I n i t */
40/******************************************************************************/
41
42void XrdSsiFileResource::Init(const char *path, XrdOucEnv &envX, bool aDNS)
43{
44 const XrdSecEntity *entP = envX.secEnv();
45 const char *rVal;
46 int n;
47
48// Construct the security information
49//
50 if (entP)
51 {strncpy(mySec.prot, entP->prot, XrdSsiPROTOIDSIZE);
52 mySec.name = entP->name;
53 mySec.host = (!aDNS ? entP->host : entP->addrInfo->Name(entP->host));
54 mySec.role = entP->vorg;
55 mySec.role = entP->role;
56 mySec.grps = entP->grps;
57 mySec.endorsements = entP->endorsements;
58 mySec.creds = entP->creds;
59 mySec.credslen = entP->credslen;
60 } else mySec.tident = "ssi";
61 client = &mySec;
62
63// Fill out the resource name and user
64//
65 rName = path;
66 if ((rVal = envX.Get("ssi.user"))) rUser = rVal;
67 else rUser.clear();
68
69// Fill out the the optional cgi info
70//
71 if (!(rVal = envX.Get("ssi.cgi"))) rInfo.clear();
72 else {rVal = envX.Env(n);
73 if (!(rVal = strstr(rVal, "ssi.cgi="))) rInfo.clear();
74 else rInfo = rVal+8;
75 }
76}
#define XrdSsiPROTOIDSIZE
const char * Name(const char *eName=0, const char **eText=0)
char * Env(int &envlen)
Definition XrdOucEnv.hh:48
const XrdSecEntity * secEnv() const
Definition XrdOucEnv.hh:107
char * Get(const char *varname)
Definition XrdOucEnv.hh:69
char * vorg
Entity's virtual organization(s)
int credslen
Length of the 'creds' data.
XrdNetAddrInfo * addrInfo
Entity's connection details.
char prot[XrdSecPROTOIDSIZE]
Auth protocol used (e.g. krb5)
char * creds
Raw entity credentials or cert.
char * grps
Entity's group name(s)
char * name
Entity's name.
char * role
Entity's role(s)
char * endorsements
Protocol specific endorsements.
char * host
Entity's host name dnr dependent.
const char * creds
Raw client credentials or cert.
const char * host
Entity's host name or address.
const char * tident
Trace identifier always preset.
const char * name
Entity's name.
const char * role
Entity's role.
char prot[XrdSsiPROTOIDSIZE]
Protocol used.
int credslen
Length of the 'creds' field.
const char * endorsements
Protocol specific endorsements.
const char * grps
Entity's group names.
void Init(const char *path, XrdOucEnv &envP, bool aDNS)
std::string rUser
-> Name of the resource user (nil if anonymous)
XrdSsiEntity * client
-> Pointer to client identification (server-side)
std::string rInfo
-> Additional information in CGI format
std::string rName
-> Name of the resource to be used