Loading...
Searching...
No Matches
XrdPssSys Class Reference

`#include <XrdPss.hh>`

Inheritance diagram for XrdPssSys:
Collaboration diagram for XrdPssSys:

## Public Types

enum | PolAct { PolPath = 0 , PolObj = 1 }

## Public Member Functions

| XrdPssSys ()
virtual | ~XrdPssSys ()
int | Chmod (const char *, mode_t mode, XrdOucEnv *eP=0) override
bool | ConfigMapID ()
virtual void | Connect (XrdOucEnv &) override
virtual int | Create (const char *, const char *, mode_t, XrdOucEnv &, int opts=0) override
virtual void | Disc (XrdOucEnv &) override
void | EnvInfo (XrdOucEnv *envP) override
uint64_t | Features () override
int | Init (XrdSysLogger *, const char *) override
int | Init (XrdSysLogger *, const char *, XrdOucEnv *envP) override
int | Lfn2Pfn (const char *Path, char *buff, int blen) override
const char * | Lfn2Pfn (const char *Path, char *buff, int blen, int &rc) override
int | Mkdir (const char *, mode_t mode, int mkpath=0, XrdOucEnv *eP=0) override
virtual XrdOssDF * | newDir (const char *tident) override
virtual XrdOssDF * | newFile (const char *tident) override
int | Remdir (const char *, int Opts=0, XrdOucEnv *eP=0) override
int | Rename (const char *, const char *, XrdOucEnv *eP1=0, XrdOucEnv *eP2=0) override
int | Stat (const char *, struct stat *, int opts=0, XrdOucEnv *eP=0) override
int | Stats (char *bp, int bl) override
int | Truncate (const char *, unsigned long long, XrdOucEnv *eP=0) override
int | Unlink (const char *, int Opts=0, XrdOucEnv *eP=0) override
Public Member Functions inherited from XrdOss
| XrdOss ()
| Constructor and Destructor.
virtual | ~XrdOss ()
virtual int | FSctl (int cmd, int alen, const char *args, char **resp=0)
virtual int | StatFS (const char *path, char *buff, int &blen, XrdOucEnv *envP=0)
virtual int | StatLS (XrdOucEnv &env, const char *path, char *buff, int &blen)
virtual int | StatPF (const char *path, struct stat *buff)
virtual int | StatPF (const char *path, struct stat *buff, int opts)
virtual int | StatVS (XrdOssVSInfo *vsP, const char *sname=0, int updt=0)
virtual int | StatXA (const char *path, char *buff, int &blen, XrdOucEnv *envP=0)
virtual int | StatXP (const char *path, unsigned long long &attr, XrdOucEnv *envP=0)

## Static Public Member Functions

static int | Info (int rc)
static int | P2DST (int &retc, char *hBuff, int hBlen, PolAct pType, const char *path)
static int | P2OUT (char *pbuff, int pblen, XrdPssUrlInfo &uInfo)
static int | P2URL (char *pbuff, int pblen, XrdPssUrlInfo &uInfo, bool doN2N=true)

## Static Public Attributes

static const char * | ConfigFN
static bool | dcaCheck = false
static int | dcaCTime = 0
static bool | dcaWorld = false
static bool | deferID = false
static char * | fileOrgn = 0
static const char * | hdrData = ""
static int | hdrLen = 0
static XrdOucTList * | ManList = 0
static const char * | myHost
static const char * | myName
static XrdNetSecurity * | Police [PolNum] = {0, 0}
static const int | PolNum = 2
static const char * | protName = "root:"
static bool | reProxy = false
static int | Streams =512
static int | Trace = 0
static int | Workers = 16
static bool | xLfn2Pfn = false
static XrdOucPListAnchor | XPList
Static Public Attributes inherited from XrdOss
static const int | PF_csVer = 0x00000001
| verified file checksums present
static const int | PF_csVun = 0x00000002
| unverified file checksums present
static const int | PF_dInfo = 0x00000001
static const int | PF_dNums = 0x00000002
static const int | PF_dStat = 0x00000008
static const int | PF_isLFN = 0x00000004

## Detailed Description

Definition at line 152 of file XrdPss.hh.

## Member Enumeration Documentation

## PolAct

enum XrdPssSys::PolAct

Enumerator
PolPath |
PolObj |

Definition at line 185 of file XrdPss.hh.

{PolPath = 0, PolObj = 1};
XrdPssSys::PolObj
@ PolObj
Definition XrdPss.hh:185
XrdPssSys::PolPath
@ PolPath
Definition XrdPss.hh:185

## Constructor & Destructor Documentation

## XrdPssSys()

XrdPssSys::XrdPssSys | ( |  | ) |

Definition at line 165 of file XrdPss.cc.

: HostArena(0), LocalRoot(0), theN2N(0), DirFlags(0),
myVersion(&XrdVERSIONINFOVAR(XrdOssGetStorageSystem2)),
myFeatures(XRDOSS_HASPRXY|XRDOSS_HASPGRW|XRDOSS_HASNOSF)
{}
XRDOSS_HASPRXY
#define XRDOSS_HASPRXY
Definition XrdOss.hh:477
XRDOSS_HASNOSF
#define XRDOSS_HASNOSF
Definition XrdOss.hh:478
XRDOSS_HASPGRW
#define XRDOSS_HASPGRW
Definition XrdOss.hh:475
XrdOssGetStorageSystem2
XrdOss * XrdOssGetStorageSystem2(XrdOss *native_oss, XrdSysLogger *Logger, const char *cFN, const char *parms, XrdOucEnv *envp)
Definition XrdPss.cc:144

References XRDOSS_HASNOSF, XRDOSS_HASPGRW, XRDOSS_HASPRXY, and XrdOssGetStorageSystem2().

Here is the call graph for this function:

## ~XrdPssSys()

virtual XrdPssSys::~XrdPssSys | ( |  | ) |

inline virtual

Definition at line 218 of file XrdPss.hh.

{}

## Member Function Documentation

## Chmod()

int XrdPssSys::Chmod | ( | const char * | path,
|  | mode_t | mode,
|  | XrdOucEnv * | envP = 0 )

override virtual

Change file mode settings.

Parameters

  path | - Pointer to the path of the file in question.
  mode | - The new file mode setting.
  envP | - Pointer to environmental information.

Returns
  0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 223 of file XrdPss.cc.

{
// We currently do not support chmod()
//
return -ENOTSUP;
}

## ConfigMapID()

bool XrdPssSys::ConfigMapID | ( |  | ) |

Definition at line 375 of file XrdPssConfig.cc.

{
XrdSecsssCon *conTracker;
bool isOK, Debug = (SysTrace.What & TRACEPSS_Debug) != 0;
// If this is a generic static ID mapping, we are done
//
if (sssMap == XrdSecsssID::idStatic) return true;
// For optimzation we also note if we have a cache in he way of the map
//
deferID = psxConfig->hasCache();
// Now that we did the cache thing, currently we don't support client personas
// with a cache because aren't able to tell which client will be used.
//
if (deferID)
{eDest.Emsg("Config", "Client personas are not supported for "
"caching proxy servers.");
return false;
}
// If this server is only a forwarding proxy server, we can't support client
// personas either because we don't control the URL. However, if we have an
// origin then simply warn that the client persona applies to the origin.
//
if (outProxy)
{if (!ManList)
{eDest.Emsg("Config", "Client personas are not supported for "
"strictly forwarding proxy servers.");
return false;
}
eDest.Say("Config warning: client personas only apply to "
"the origin server!");
}
// We need to get a connection tracker object from the posix interface.
// However, we only need it if we are actually mapping id's.
//
if (sssMap == XrdSecsssID::idStaticM) conTracker = 0;
else conTracker = XrdPosixConfig::conTracker(Debug);
// Get an mapper object
//
idMapper = new XrdSecsssID(sssMap, 0, conTracker, &isOK);
if (!isOK)
{eDest.Emsg("Config", "Unable to render persona; persona mapper failed!");
return false;
}
// If ths is a server persona then we don't need the mapper; abandon it.
//
if (sssMap == XrdSecsssID::idStaticM) idMapper = 0;
else XrdPssUrlInfo::setMapID(true);
// We are all done
//
return true;
}
eDest
static XrdSysError eDest(0,"crypto_")
TRACEPSS_Debug
#define TRACEPSS_Debug
Definition XrdPssTrace.hh:34
Debug
bool Debug
Definition XrdSecgsiProxy.cc:95
XrdPosixConfig::conTracker
static XrdSecsssCon * conTracker(bool debug=false)
Definition XrdPosixConfig.cc:150
XrdPssSys::deferID
static bool deferID
Definition XrdPss.hh:214
XrdPssSys::ManList
static XrdOucTList * ManList
Definition XrdPss.hh:201
XrdPssUrlInfo::setMapID
static void setMapID(bool onoff)
Definition XrdPssUrlInfo.hh:57
XrdSecsssID::idStatic
@ idStatic
Definition XrdSecsssID.hh:86
XrdSecsssID::idStaticM
@ idStaticM
Definition XrdSecsssID.hh:89
XrdSysError::Emsg
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition XrdSysError.cc:95
XrdSysError::Say
void Say(const char *text1, const char *text2=0, const char *txt3=0, const char *text4=0, const char *text5=0, const char *txt6=0)
Definition XrdSysError.cc:141
XrdSysTrace::What
int What
Definition XrdSysTrace.hh:64
XrdProxy::SysTrace
XrdSysTrace SysTrace("Pss", 0)
Definition XrdPssCks.cc:55
XrdProxy::outProxy
bool outProxy
Definition XrdPss.cc:125

References XrdPosixConfig::conTracker(), Debug, deferID, eDest, XrdSecsssID::idStatic, XrdSecsssID::idStaticM, ManList, XrdProxy::outProxy, XrdPssUrlInfo::setMapID(), XrdProxy::SysTrace, and TRACEPSS_Debug.

Here is the call graph for this function:

## Connect()

void XrdPssSys::Connect | ( | XrdOucEnv & | env | ) |

override virtual

Notify storage system that a client has connected.

Parameters

  env | - Reference to environmental information.

Reimplemented from XrdOss.

Definition at line 234 of file XrdPss.cc.

{
EPNAME("Connect");
const XrdSecEntity *client = theEnv.secEnv();
// If we need to personify the client, set it up
//
if (idMapper && client)
{const char *fmt = (client->ueid & 0xf0000000 ? "%x" : "U%x");
char uName[32];
snprintf(uName, sizeof(uName), fmt, client->ueid);
DEBUG(client->tident,"Registering as ID "<<uName);
idMapper->Register(uName, client, deferID);
}
}
DEBUG
#define DEBUG(x)
Definition XrdBwmTrace.hh:54
EPNAME
#define EPNAME(x)
Definition XrdBwmTrace.hh:56
XrdOucEnv::secEnv
const XrdSecEntity * secEnv() const
Definition XrdOucEnv.hh:107
XrdSecEntity::tident
const char * tident
Trace identifier always preset.
Definition XrdSecEntity.hh:81
XrdSecEntity::ueid
unsigned int ueid
Unique ID of entity instance.
Definition XrdSecEntity.hh:79
XrdCms::theEnv
XrdOucEnv theEnv
Definition XrdCmsConfig.cc:102

References DEBUG, deferID, EPNAME, XrdOucEnv::secEnv(), XrdSecEntity::tident, and XrdSecEntity::ueid.

Here is the call graph for this function:

## Create()

int XrdPssSys::Create | ( | const char * | tid,
|  | const char * | path,
|  | mode_t | mode,
|  | XrdOucEnv & | env,
|  | int | opts = 0 )

override virtual

Create file.

Parameters

  tid | - Pointer to the trace identifier.
  path | - Pointer to the path of the file to create.
  mode | - The new file mode setting.
  env | - Reference to environmental information.
  opts | - Create options: XRDOSS_mkpath - create dir path if it does not exist. XRDOSS_new - the file must not already exist. oflags<<8 - open flags shifted 8 bits to the left/

Returns
  0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 272 of file XrdPss.cc.

{
return -ENOTSUP;
}

References Mode, and tident.

## Disc()

void XrdPssSys::Disc | ( | XrdOucEnv & | env | ) |

override virtual

Notify storage system that a client has disconnected.

Parameters

  env | - Reference to environmental information.

Reimplemented from XrdOss.

Definition at line 283 of file XrdPss.cc.

{
EPNAME("Disc");
const XrdSecEntity *client = theEnv.secEnv();
// If we personified a client, remove that persona.
//
if (idMapper && client)
{const char *fmt = (client->ueid & 0xf0000000 ? "%x" : "U%x");
char uName[32];
snprintf(uName, sizeof(uName), fmt, client->ueid);
DEBUG(client->tident,"Unregistering as ID "<<uName);
idMapper->Register(uName, 0);
}
}

References DEBUG, EPNAME, XrdOucEnv::secEnv(), XrdSecEntity::tident, and XrdSecEntity::ueid.

Here is the call graph for this function:

## EnvInfo()

void XrdPssSys::EnvInfo | ( | XrdOucEnv * | envP | ) |

override virtual

Notify storage system of initialization information (deprecated).

Parameters

  envP | - Pointer to environmental information.

Reimplemented from XrdOss.

Definition at line 303 of file XrdPss.cc.

{
// We only need to extract the scheduler pointer from the environment. Propogate
// the information to the POSIX layer.
//
if (envP)
{schedP = (XrdScheduler *)envP->GetPtr("XrdScheduler*");
XrdPosixConfig::EnvInfo(*envP);
}
}
XrdOucEnv::GetPtr
void * GetPtr(const char *varname)
Definition XrdOucEnv.cc:263
XrdPosixConfig::EnvInfo
static void EnvInfo(XrdOucEnv &theEnv)
Definition XrdPosixConfig.cc:170
XrdProxy::schedP
XrdScheduler * schedP
Definition XrdPss.cc:105
XrdProxy::envP
XrdOucEnv * envP
Definition XrdPss.cc:109

References XrdPosixConfig::EnvInfo(), XrdProxy::envP, and XrdProxy::schedP.

Here is the call graph for this function:

## Features()

uint64_t XrdPssSys::Features | ( |  | ) |

inline override virtual

Return storage system features.

Returns
  Storage system features (see XRDOSS_HASxxx flags).

Reimplemented from XrdOss.

Definition at line 169 of file XrdPss.hh.

{return myFeatures;}

## Info()

int XrdPssSys::Info | ( | int | rc | ) |

static

Definition at line 1313 of file XrdPss.cc.

{
std::string psxMsg;
int n = XrdPosixXrootd::QueryError(psxMsg);
XrdProxy::ecMsg.Set(n, psxMsg);
return -rc;
}
XrdOucECMsg::Set
void Set(int ecc, const char *ecm="")
Definition XrdOucECMsg.hh:145
XrdPosixXrootd::QueryError
static int QueryError(std::string &emsg, int fd=-1, bool reset=true)
Definition XrdPosixXrootd.cc:1507
XrdProxy::ecMsg
XrdOucECMsg ecMsg("[pss]")

References XrdProxy::ecMsg, and XrdPosixXrootd::QueryError().

Referenced by Mkdir().

Here is the call graph for this function:
Here is the caller graph for this function:

## Init() [1/2]

int XrdPssSys::Init | ( | XrdSysLogger * | lp,
|  | const char * | cfn )

inline override virtual

Initialize the storage system V1 (deprecated).

Parameters

  lp | - Pointer to the message logging object.
  cfn | - Pointer to the configuration file.

Returns
  0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 170 of file XrdPss.hh.

{return -ENOTSUP;}

## Init() [2/2]

int XrdPssSys::Init | ( | XrdSysLogger * | lp,
|  | const char * | cfn,
|  | XrdOucEnv * | envP )

override virtual

Initialize the storage system V2.

Parameters

  lp | - Pointer to the message logging object.
  cfn | - Pointer to the configuration file.
  envP | - Pointer to environmental information.

Returns
  0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOss.

Definition at line 181 of file XrdPss.cc.

{
int NoGo;
const char *tmp;
// Do the herald thing
//
SysTrace.SetLogger(lp);
eDest.logger(lp);
eDest.Say("Copr. 2019, Stanford University, Pss Version " XrdVSTRING);
// Initialize the subsystems
//
tmp = ((NoGo = Configure(cFN, envP)) ? "failed." : "completed.");
eDest.Say("------ Proxy storage system initialization ", tmp);
// Extract Pfc control, if it is there.
//
if (!NoGo)
cacheFSctl = (XrdOfsFSctl_PI*)envP->GetPtr("XrdFSCtl_PC*");
// All done.
//
return NoGo;
}
XrdSysError::logger
XrdSysLogger * logger(XrdSysLogger *lp=0)
Definition XrdSysError.hh:141
XrdSysTrace::SetLogger
void SetLogger(XrdSysLogger *logp)
Definition XrdSysTrace.cc:65
XrdProxy::cacheFSctl
XrdOfsFSctl_PI * cacheFSctl
Definition XrdPss.cc:111

References XrdProxy::cacheFSctl, eDest, XrdProxy::envP, and XrdProxy::SysTrace.

## Lfn2Pfn() [1/2]

int XrdPssSys::Lfn2Pfn | ( | const char * | Path,
|  | char * | buff,
|  | int | blen )

override virtual

Translate logical name to physical name V1 (deprecated).

Parameters

  Path | - Path in whose information is wanted.
  buff | - Pointer to the buffer to hold the new path.
  blen | - Length of the buffer.

Returns
  0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOss.

Definition at line 318 of file XrdPss.cc.

{
if (theN2N) return -(theN2N->lfn2pfn(oldp, newp, blen));
if ((int)strlen(oldp) >= blen) return -ENAMETOOLONG;
strcpy(newp, oldp);
return 0;
}

## Lfn2Pfn() [2/2]

const char * XrdPssSys::Lfn2Pfn | ( | const char * | Path,
|  | char * | buff,
|  | int | blen,
|  | int & | rc )

override virtual

Translate logical name to physical name V2.

Parameters

  Path | - Path in whose information is wanted.
  buff | - Pointer to the buffer to hold the new path.
  blen | - Length of the buffer.
  rc | - Place where failure return code is to be returned: -errno or -osserr (see XrdOssError.hh).

Returns
  Pointer to the translated path upon success or nil on failure.

Reimplemented from XrdOss.

Definition at line 326 of file XrdPss.cc.

{
if (!theN2N) {rc = 0; return oldp;}
if ((rc = -(theN2N->lfn2pfn(oldp, newp, blen)))) return 0;
return newp;
}

## Mkdir()

int XrdPssSys::Mkdir | ( | const char * | path,
|  | mode_t | mode,
|  | int | mkpath = 0,
|  | XrdOucEnv * | envP = 0 )

override virtual

Create a directory.

Parameters

  path | - Pointer to the path of the directory to be created.
  mode | - The directory mode setting.
  mkpath | - When true the path is created if it does not exist.
  envP | - Pointer to environmental information.

Returns
  0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 350 of file XrdPss.cc.

{
EPNAME("Mkdir");
XrdPssUrlInfo uInfo(eP, path);
int rc;
char pbuff[PBsz];
// Verify we can write here
//
if (isREADONLY(path)) return -EROFS;
// Convert path to URL
//
if ((rc = P2URL(pbuff, PBsz, uInfo, xLfn2Pfn))) return rc;
// Some tracing
//
if(DEBUGON) {
auto urlObf = obfuscateAuth(pbuff);
DEBUG(uInfo.Tident(),"url="<<urlObf);
}
// Simply return the proxied result here
//
return (XrdPosixXrootd::Mkdir(pbuff, mode) ? Info(errno) : XrdOssOK);
}
XrdOssOK
#define XrdOssOK
Definition XrdOss.hh:50
obfuscateAuth
std::string obfuscateAuth(const std::string &input)
Definition XrdOucUtils.cc:1534
DEBUGON
#define DEBUGON
Definition XrdPosixTrace.hh:41
isREADONLY
#define isREADONLY(_x_)
Definition XrdPss.cc:89
XrdPosixXrootd::Mkdir
static int Mkdir(const char *path, mode_t mode)
Mkdir() conforms to POSIX.1-2001 mkdir().
Definition XrdPosixXrootd.cc:528
XrdPssSys::Info
static int Info(int rc)
Definition XrdPss.cc:1313
XrdPssSys::P2URL
static int P2URL(char *pbuff, int pblen, XrdPssUrlInfo &uInfo, bool doN2N=true)
Definition XrdPss.cc:1417
XrdPssSys::xLfn2Pfn
static bool xLfn2Pfn
Definition XrdPss.hh:211
XrdProxy::PBsz
static const int PBsz
Definition XrdPss.cc:119

References DEBUG, DEBUGON, EPNAME, Info(), isREADONLY, XrdPosixXrootd::Mkdir(), obfuscateAuth(), P2URL(), XrdProxy::PBsz, XrdPssUrlInfo::Tident(), xLfn2Pfn, and XrdOssOK.

Here is the call graph for this function:

## newDir()

virtual XrdOssDF * XrdPssSys::newDir | ( | const char * | tident | ) |

inline override virtual

Obtain a new director object to be used for future directory requests.

Parameters

  tident | - The trace identifier.

Returns
  pointer- Pointer to an XrdOssDF object.
  nil - Insufficient memory to allocate an object.

Implements XrdOss.

Definition at line 155 of file XrdPss.hh.

{return (XrdOssDF *)new XrdPssDir(tident);}
tident
#define tident
Definition XrdBwmHandle.cc:109

References tident.

## newFile()

virtual XrdOssDF * XrdPssSys::newFile | ( | const char * | tident | ) |

inline override virtual

Obtain a new file object to be used for a future file requests.

Parameters

  tident | - The trace identifier.

Returns
  pointer- Pointer to an XrdOssDF object.
  nil - Insufficient memory to allocate an object.

Implements XrdOss.

Definition at line 157 of file XrdPss.hh.

{return (XrdOssDF *)new XrdPssFile(tident);}

References tident.

## P2DST()

int XrdPssSys::P2DST | ( | int & | retc,
|  | char * | hBuff,
|  | int | hBlen,
|  | XrdPssSys::PolAct | pEnt,
|  | const char * | path )

static

Definition at line 1326 of file XrdPss.cc.

{
const char *Slash;
int n;
// Extract out the destination
//
Slash = index(path, '/');
if (!Slash || (n = (Slash - path)) == 0) {retc = -EINVAL; return 0;}
if (n >= hBlen) {retc = -ENAMETOOLONG; return 0;}
strncpy(hBuff, path, n); hBuff[n] = 0;
// Check if we need to authorize the outgoing connection
//
if (Police[pEnt] && !Police[pEnt]->Authorize(hBuff))
{retc = -EACCES; return 0;}
// All is well
//
return n;
}
Authorize
XrdAccAuthorize * Authorize
Definition XrdAccTest.cc:61
XrdPssSys::Police
static XrdNetSecurity * Police[PolNum]
Definition XrdPss.hh:101

References Authorize, and Police.

Referenced by P2OUT().

Here is the caller graph for this function:

## P2OUT()

int XrdPssSys::P2OUT | ( | char * | pbuff,
|  | int | pblen,
|  | XrdPssUrlInfo & | uInfo )

static

Definition at line 1353 of file XrdPss.cc.

{ const char *theID = uInfo.getID();
const char *pname, *path, *thePath;
char hBuff[288];
int retc, n;
// Setup the path
//
thePath = path = uInfo.thePath();
// Make sure the path is valid for an outgoing proxy
//
if (*path == '/') path++;
if ((pname = XrdPssUtils::valProt(path, n, 1))) path += n;
else {if (!hdrLen) return -ENOTSUP;
n = snprintf(pbuff, pblen, hdrData, theID, thePath);
if (n >= pblen || !uInfo.addCGI(pbuff, pbuff+n, pblen-n))
return -ENAMETOOLONG;
return 0;
}
// Objectid must be handled differently as they have not been refalgomized
//
if (*thePath != '/')
{if (*path == '/')
{path++;
if (*path == '/') theID = "";
}
if (Police[PolObj] && !P2DST(retc, hBuff, sizeof(hBuff), PolObj,
path+(*path == '/' ? 1:0))) return 0;
n = snprintf(pbuff, pblen, "%s%s%s", pname, theID, path);
if (n >= pblen || !uInfo.addCGI(pbuff, pbuff+n, pblen-n))
return -ENAMETOOLONG;
return 0;
}
// Extract out the destination. We need to do this because the front end
// will have extracted out double slashes and we need to add them back. We
// also authorize the outgoing connection if we need to in the process.
//
if (!(n = P2DST(retc, hBuff, sizeof(hBuff), PolPath, path))) return 0;
path += n;
// Create the new path. If the url already contains a userid then use it
// instead or our internally generated one. We may need an option for this
// as it may result in unintended side-effects but for now we do that.
//
if (index(hBuff, '@')) theID= "";
n = snprintf(pbuff,pblen,"%s%s%s/%s",pname,theID,hBuff,path);
// Make sure the path will fit
//
if (n >= pblen || !uInfo.addCGI(pbuff, pbuff+n, pblen-n))
return -ENAMETOOLONG;
// All done
//
return 0;
}
XrdPssSys::hdrLen
static int hdrLen
Definition XrdPss.hh:205
XrdPssSys::hdrData
static const char * hdrData
Definition XrdPss.hh:204
XrdPssSys::P2DST
static int P2DST(int &retc, char *hBuff, int hBlen, PolAct pType, const char *path)
Definition XrdPss.cc:1326
XrdPssUrlInfo::getID
const char * getID()
Definition XrdPssUrlInfo.hh:45
XrdPssUrlInfo::thePath
const char * thePath()
Definition XrdPssUrlInfo.hh:59
XrdPssUrlInfo::addCGI
bool addCGI(const char *prot, char *buff, int blen)
Definition XrdPssUrlInfo.cc:155
XrdPssUtils::valProt
static const char * valProt(const char *pname, int &plen, int adj=0)
Definition XrdPssUtils.cc:82

References XrdPssUrlInfo::addCGI(), XrdPssUrlInfo::getID(), hdrData, hdrLen, P2DST(), Police, PolObj, PolPath, XrdPssUrlInfo::thePath(), and XrdPssUtils::valProt().

Referenced by P2URL().

Here is the call graph for this function:
Here is the caller graph for this function:

## P2URL()

int XrdPssSys::P2URL | ( | char * | pbuff,
|  | int | pblen,
|  | XrdPssUrlInfo & | uInfo,
|  | bool | doN2N = true )

static

Definition at line 1417 of file XrdPss.cc.

{
// If this is an outgoing proxy then we need to do someother work
//
if (outProxy) return P2OUT(pbuff, pblen, uInfo);
// Do url generation for actual known origin
//
const char *path = uInfo.thePath();
int retc, pfxLen;
char Apath[MAXPATHLEN+1];
// Setup to process url generation
//
path = uInfo.thePath();
// First, apply the N2N mapping if necessary. If N2N fails then the whole
// mapping fails and ENAMETOOLONG will be returned.
//
if (doN2N && XrdProxySS.theN2N)
{if ((retc = XrdProxySS.theN2N->lfn2pfn(path, Apath, sizeof(Apath))))
{if (retc > 0) return -retc;}
path = Apath;
}
// Format the header into the buffer and check if we overflowed. Note that we
// defer substitution of the path as we need to know where the path is.
//
if (fileOrgn) pfxLen = snprintf(pbuff, pblen, hdrData, path);
else pfxLen = snprintf(pbuff, pblen, hdrData, uInfo.getID(), path);
if (pfxLen >= pblen) return -ENAMETOOLONG;
// Add any cgi information
//
if (!fileOrgn && uInfo.hasCGI())
{if (!uInfo.addCGI(pbuff, pbuff+pfxLen, pblen-pfxLen))
return -ENAMETOOLONG;
}
// All done
//
return 0;
}
XrdOucName2Name::lfn2pfn
virtual int lfn2pfn(const char *lfn, char *buff, int blen)=0
XrdPssSys::P2OUT
static int P2OUT(char *pbuff, int pblen, XrdPssUrlInfo &uInfo)
Definition XrdPss.cc:1353
XrdPssSys::fileOrgn
static char * fileOrgn
Definition XrdPss.hh:202
XrdPssUrlInfo::hasCGI
bool hasCGI()
Definition XrdPssUrlInfo.hh:47
XrdProxy::XrdProxySS
static XrdPssSys XrdProxySS
Definition XrdPss.cc:101

References XrdPssUrlInfo::addCGI(), fileOrgn, XrdPssUrlInfo::getID(), XrdPssUrlInfo::hasCGI(), hdrData, XrdProxy::outProxy, P2OUT(), XrdPssUrlInfo::thePath(), and XrdProxy::XrdProxySS.

Referenced by XrdPssCks::Get(), Mkdir(), XrdPssFile::Open(), XrdPssDir::Opendir(), Remdir(), Rename(), Stat(), Truncate(), and Unlink().

Here is the call graph for this function:
Here is the caller graph for this function:

## Remdir()

int XrdPssSys::Remdir | ( | const char * | path,
|  | int | Opts = 0,
|  | XrdOucEnv * | envP = 0 )

override virtual

Relocate/Copy the file at `path' to a new location.

Parameters

  tident | - -> trace identifier for this operation.
  path | - -> fully qualified name of the file to relocate.
  cgName | - -> target space name[:path]
  anchor | - Processing directions (see XrdOssReloc.cc example).

Returns
  0 upon success or -errno or -osserr (see XrdOssError.hh). //--------------------------------------------------------------------------—

virtual int Reloc(const char *tident, const char *path, */ const char *cgName, const char *anchor=0);

/*! Remove a directory.

Parameters

  path | - Pointer to the path of the directory to be removed.
  Opts | - The processing options: XRDOSS_Online - only remove online copy XRDOSS_isPFN - path is already translated.
  envP | - Pointer to environmental information.

Returns
  0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 389 of file XrdPss.cc.

{
EPNAME("Remdir");
const char *Cgi = "";
int rc;
char pbuff[PBsz];
// Verify we can write here
//
if (isREADONLY(path)) return -EROFS;
// Setup any required cgi information
//
if (*path == '/' && !outProxy && (Opts & XRDOSS_Online)) Cgi = ofslclCGI;
// Setup url information
//
XrdPssUrlInfo uInfo(eP, path, Cgi);
// Convert path to URL
//
if ((rc = P2URL(pbuff, PBsz, uInfo, xLfn2Pfn))) return rc;
// Do some tracing
//
if(DEBUGON) {
auto urlObf = obfuscateAuth(pbuff);
DEBUG(uInfo.Tident(),"url="<<urlObf);
}
// Issue unlink and return result
//
return (XrdPosixXrootd::Rmdir(pbuff) ? -errno : XrdOssOK);
}
XRDOSS_Online
#define XRDOSS_Online
Definition XrdOss.hh:468
XrdPosixXrootd::Rmdir
static int Rmdir(const char *path)
Rmdir() conforms to POSIX.1-2001 rmdir().
Definition XrdPosixXrootd.cc:1117
XrdProxy::ofslclCGI
static const char * ofslclCGI
Definition XrdPss.cc:115

References DEBUG, DEBUGON, EPNAME, isREADONLY, obfuscateAuth(), XrdProxy::ofslclCGI, XrdProxy::outProxy, P2URL(), XrdProxy::PBsz, XrdPosixXrootd::Rmdir(), XrdPssUrlInfo::Tident(), xLfn2Pfn, XRDOSS_Online, and XrdOssOK.

Here is the call graph for this function:

## Rename()

int XrdPssSys::Rename | ( | const char * | oPath,
|  | const char * | nPath,
|  | XrdOucEnv * | oEnvP = 0,
|  | XrdOucEnv * | nEnvP = 0 )

override virtual

Rename a file or directory.

Parameters

  oPath | - Pointer to the path to be renamed.
  nPath | - Pointer to the path oPath is to have.
  oEnvP | - Environmental information for oPath.
  nEnvP | - Environmental information for nPath.

Returns
  0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 437 of file XrdPss.cc.

{
EPNAME("Rename");
int rc;
char oldName[PBsz], newName[PBsz];
// Verify we can write in the source and target
//
if (isREADONLY(oldname) || isREADONLY(newname)) return -EROFS;
// Setup url info
//
XrdPssUrlInfo uInfoOld(oldenvP, oldname);
XrdPssUrlInfo uInfoNew(newenvP, newname, "", true, false);
// Convert path to URL
//
if ((rc = P2URL(oldName, PBsz, uInfoOld, xLfn2Pfn))
|| (rc = P2URL(newName, PBsz, uInfoNew, xLfn2Pfn))) return rc;
// Do some tracing
//
if(DEBUGON) {
auto oldNameObf = obfuscateAuth(oldName);
auto newNameObf = obfuscateAuth(newName);
DEBUG(uInfoOld.Tident(),"old url="<<oldNameObf <<" new url=" <<newNameObf);
}
// Execute the rename and return result
//
return (XrdPosixXrootd::Rename(oldName, newName) ? -errno : XrdOssOK);
}
XrdPosixXrootd::Rename
static int Rename(const char *oldpath, const char *newpath)
Rename() conforms to POSIX.1-2001 rename().
Definition XrdPosixXrootd.cc:1067

References DEBUG, DEBUGON, EPNAME, isREADONLY, obfuscateAuth(), P2URL(), XrdProxy::PBsz, XrdPosixXrootd::Rename(), XrdPssUrlInfo::Tident(), xLfn2Pfn, and XrdOssOK.

Here is the call graph for this function:

## Stat()

int XrdPssSys::Stat | ( | const char * | path,
|  | struct stat * | buff,
|  | int | opts = 0,
|  | XrdOucEnv * | envP = 0 )

override virtual

Return state information on a file or directory.

Parameters

  path | - Pointer to the path in question.
  buff | - Pointer to the structure where info it to be returned.
  opts | - Options: XRDOSS_preop - this is a stat prior to open. XRDOSS_resonly - only look for resident files. XRDOSS_updtatm - update file access time.
  envP | - Pointer to environmental information.

Returns
  0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 490 of file XrdPss.cc.

{
EPNAME("Stat");
const char *Cgi = "";
int rc;
char pbuff[PBsz];
// Setup any required special cgi information
//
if (*path == '/' && !outProxy && ((Opts & XRDOSS_resonly)||isNOSTAGE(path)))
Cgi = osslclCGI;
// We can now establish the url information to be used
//
XrdPssUrlInfo uInfo(eP, path, Cgi);
// Generate an ID if we need to. We can use the server's identity unless that
// has been prohibited because client ID mapping is taking place.
//
if (idMapAll) uInfo.setID();
else if (sidP) uInfo.setID(sidP);
// Convert path to URL
//
if ((rc = P2URL(pbuff, PBsz, uInfo, xLfn2Pfn))) return rc;
// Do some tracing
//
if(DEBUGON) {
auto urlObf = obfuscateAuth(pbuff);
DEBUG(uInfo.Tident(),"url="<<urlObf);
}
// Return proxied stat
//
return (XrdPosixXrootd::Stat(pbuff, buff) ? -errno : XrdOssOK);
}
XRDOSS_resonly
#define XRDOSS_resonly
Definition XrdOss.hh:486
isNOSTAGE
#define isNOSTAGE(_x_)
Definition XrdPss.cc:87
XrdPosixXrootd::Stat
static int Stat(const char *path, struct stat *buf)
Stat() conforms to POSIX.1-2001 stat().
Definition XrdPosixXrootd.cc:1166
XrdProxy::sidP
XrdOucSid * sidP
Definition XrdPss.cc:107
XrdProxy::osslclCGI
static const char * osslclCGI
Definition XrdPss.cc:117
XrdProxy::idMapAll
bool idMapAll
Definition XrdPss.cc:123

References DEBUG, DEBUGON, EPNAME, XrdProxy::idMapAll, isNOSTAGE, obfuscateAuth(), XrdProxy::osslclCGI, XrdProxy::outProxy, P2URL(), XrdProxy::PBsz, XrdPssUrlInfo::setID(), XrdProxy::sidP, XrdPosixXrootd::Stat(), stat, XrdPssUrlInfo::Tident(), xLfn2Pfn, XRDOSS_resonly, and XrdOssOK.

Here is the call graph for this function:

## Stats()

int XrdPssSys::Stats | ( | char * | buff,
|  | int | blen )

override virtual

Return statistics.

Parameters

  buff | - Pointer to the buffer to hold statistics.
  blen | - Length of the buffer.

Returns
  The number of bytes placed in the buffer excluding null byte.

Reimplemented from XrdOss.

Definition at line 541 of file XrdPss.cc.

{
return XrdPosixConfig::Stats("pss", bp, bl);
}
XrdPosixConfig::Stats
static int Stats(const char *theID, char *buff, int blen)
Definition XrdPosixConfig.cc:558

References XrdPosixConfig::Stats().

Here is the call graph for this function:

## Truncate()

int XrdPssSys::Truncate | ( | const char * | path,
|  | unsigned long long | fsize,
|  | XrdOucEnv * | envP = 0 )

override virtual

Truncate a file.

Parameters

  path | - Pointer to the path of the file to be truncated.
  fsize | - The size that the file is to have.
  envP | - Pointer to environmental information.

Returns
  0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 559 of file XrdPss.cc.

{
EPNAME("Trunc");
XrdPssUrlInfo uInfo(envP, path);
int rc;
char pbuff[PBsz];
// Make sure we can write here
//
if (isREADONLY(path)) return -EROFS;
// Convert path to URL
//
if ((rc = P2URL(pbuff, PBsz, uInfo, xLfn2Pfn))) return rc;
// Do some tracing
//
if(DEBUGON) {
auto urlObf = obfuscateAuth(pbuff);
DEBUG(uInfo.Tident(),"url="<<urlObf);
}
// Return proxied truncate. We only do this on a single machine because the
// redirector will forbid the trunc() if multiple copies exist.
//
return (XrdPosixXrootd::Truncate(pbuff, flen) ? -errno : XrdOssOK);
}
XrdPosixXrootd::Truncate
static int Truncate(const char *path, off_t offset)
Telldir() conforms to POSIX.1-2001 telldir().
Definition XrdPosixXrootd.cc:1353

References DEBUG, DEBUGON, XrdProxy::envP, EPNAME, isREADONLY, obfuscateAuth(), P2URL(), XrdProxy::PBsz, XrdPssUrlInfo::Tident(), XrdPosixXrootd::Truncate(), xLfn2Pfn, and XrdOssOK.

Here is the call graph for this function:

## Unlink()

int XrdPssSys::Unlink | ( | const char * | path,
|  | int | Opts = 0,
|  | XrdOucEnv * | envP = 0 )

override virtual

Remove a file.

Parameters

  path | - Pointer to the path of the file to be removed.
  Opts | - Options: XRDOSS_isMIG - this is a migratable path. XRDOSS_isPFN - do not apply name2name to path. XRDOSS_Online - remove only the online copy.
  envP | - Pointer to environmental information.

Returns
  0 upon success or -errno or -osserr (see XrdOssError.hh).

Implements XrdOss.

Definition at line 600 of file XrdPss.cc.

{
EPNAME("Unlink");
const char *Cgi = "";
int rc;
char pbuff[PBsz];
// Make sure we can write here
//
if (isREADONLY(path)) return -EROFS;
// Setup any required cgi information
//
if (*path == '/' && !outProxy && (Opts & XRDOSS_Online)) Cgi = ofslclCGI;
// Setup url info
//
XrdPssUrlInfo uInfo(envP, path, Cgi);
// Convert path to URL
//
if ((rc = P2URL(pbuff, PBsz, uInfo, xLfn2Pfn))) return rc;
// Do some tracing
//
if(DEBUGON) {
auto urlObf = obfuscateAuth(pbuff);
DEBUG(uInfo.Tident(),"url="<<urlObf);
}
// Unlink the file and return result.
//
return (XrdPosixXrootd::Unlink(pbuff) ? -errno : XrdOssOK);
}
XrdPosixXrootd::Unlink
static int Unlink(const char *path)
Unlink() conforms to POSIX.1-2001 unlink().
Definition XrdPosixXrootd.cc:1381

References DEBUG, DEBUGON, XrdProxy::envP, EPNAME, isREADONLY, obfuscateAuth(), XrdProxy::ofslclCGI, XrdProxy::outProxy, P2URL(), XrdProxy::PBsz, XrdPssUrlInfo::Tident(), XrdPosixXrootd::Unlink(), xLfn2Pfn, XRDOSS_Online, and XrdOssOK.

Here is the call graph for this function:

## Member Data Documentation

## ConfigFN

const char * XrdPssSys::ConfigFN

static

Definition at line 194 of file XrdPss.hh.

## dcaCheck

bool XrdPssSys::dcaCheck = false

static

Definition at line 212 of file XrdPss.hh.

Referenced by XrdPssFile::Open().

## dcaCTime

int XrdPssSys::dcaCTime = 0

static

Definition at line 209 of file XrdPss.hh.

## dcaWorld

bool XrdPssSys::dcaWorld = false

static

Definition at line 213 of file XrdPss.hh.

Referenced by XrdPssFile::Open().

## deferID

bool XrdPssSys::deferID = false

static

Definition at line 214 of file XrdPss.hh.

Referenced by ConfigMapID(), and Connect().

## fileOrgn

char * XrdPssSys::fileOrgn = 0

static

Definition at line 202 of file XrdPss.hh.

Referenced by XrdPssFile::Open(), and P2URL().

## hdrData

const char * XrdPssSys::hdrData = ""

static

Definition at line 204 of file XrdPss.hh.

Referenced by P2OUT(), and P2URL().

## hdrLen

int XrdPssSys::hdrLen = 0

static

Definition at line 205 of file XrdPss.hh.

Referenced by P2OUT().

## ManList

XrdOucTList * XrdPssSys::ManList = 0

static

Definition at line 201 of file XrdPss.hh.

Referenced by ConfigMapID().

## myHost

const char * XrdPssSys::myHost

static

Definition at line 195 of file XrdPss.hh.

## myName

const char * XrdPssSys::myName

static

Definition at line 196 of file XrdPss.hh.

## Police

XrdNetSecurity * XrdPssSys::Police = {0, 0}

static

Definition at line 101 of file XrdPss.hh.

Referenced by P2DST(), and P2OUT().

## PolNum

const int XrdPssSys::PolNum = 2

static

Definition at line 184 of file XrdPss.hh.

## protName

const char * XrdPssSys::protName = "root:"

static

Definition at line 203 of file XrdPss.hh.

## reProxy

bool XrdPssSys::reProxy = false

static

Definition at line 215 of file XrdPss.hh.

Referenced by XrdPssFile::Open().

## Streams

int XrdPssSys::Streams =512

static

Definition at line 206 of file XrdPss.hh.

## Trace

int XrdPssSys::Trace = 0

static

Definition at line 208 of file XrdPss.hh.

## Workers

int XrdPssSys::Workers = 16

static

Definition at line 207 of file XrdPss.hh.

## xLfn2Pfn

bool XrdPssSys::xLfn2Pfn = false

static

Definition at line 211 of file XrdPss.hh.

Referenced by Mkdir(), XrdPssFile::Open(), XrdPssDir::Opendir(), Remdir(), Rename(), Stat(), Truncate(), and Unlink().

## XPList

XrdOucPListAnchor XrdPssSys::XPList

static

Definition at line 198 of file XrdPss.hh.

Referenced by XrdPssFile::Open().

The documentation for this class was generated from the following files:

- XrdPss.hh
- XrdPss.cc
- XrdPssConfig.cc