XRootD
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 FSctl (int cmd, int alen, const char *args, char **resp=0) override
bool getErrMsg (std::string &eText) 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 XrdOssDFnewDir (const char *tident) override
virtual XrdOssDFnewFile (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 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 XrdOucTListManList = 0
static const char * myHost
static const char * myName
static XrdNetSecurityPolice [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 161 of file XrdPss.hh.

Member Enumeration Documentation

◆ PolAct

Enumerator
PolPath 
PolObj 

Definition at line 196 of file XrdPss.hh.

196{PolPath = 0, PolObj = 1};

Constructor & Destructor Documentation

◆ XrdPssSys()

XrdPssSys::XrdPssSys ( )

Definition at line 166 of file XrdPss.cc.

166 : HostArena(0), LocalRoot(0), theN2N(0), DirFlags(0),
167 myVersion(&XrdVERSIONINFOVAR(XrdOssGetStorageSystem2)),
170 {}
#define XRDOSS_HASPRXY
Definition XrdOss.hh:538
#define XRDOSS_HASXERT
Definition XrdOss.hh:543
#define XRDOSS_HASNOSF
Definition XrdOss.hh:539
#define XRDOSS_HASPGRW
Definition XrdOss.hh:536
XrdOss * XrdOssGetStorageSystem2(XrdOss *native_oss, XrdSysLogger *Logger, const char *cFN, const char *parms, XrdOucEnv *envp)
Definition XrdPss.cc:145

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

Here is the call graph for this function:

◆ ~XrdPssSys()

virtual XrdPssSys::~XrdPssSys ( )
inlinevirtual

Definition at line 229 of file XrdPss.hh.

229{}

Member Function Documentation

◆ Chmod()

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

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 225 of file XrdPss.cc.

226{
227// We currently do not support chmod()
228//
229 return -ENOTSUP;
230}

◆ ConfigMapID()

bool XrdPssSys::ConfigMapID ( )

Definition at line 382 of file XrdPssConfig.cc.

383{
384 XrdSecsssCon *conTracker;
385 bool isOK, Debug = (SysTrace.What & TRACEPSS_Debug) != 0;
386
387// If this is a generic static ID mapping, we are done
388//
389 if (sssMap == XrdSecsssID::idStatic) return true;
390
391// For optimzation we also note if we have a cache in he way of the map
392//
393 deferID = psxConfig->hasCache();
394
395// Now that we did the cache thing, currently we don't support client personas
396// with a cache because aren't able to tell which client will be used.
397//
398 if (deferID)
399 {eDest.Emsg("Config", "Client personas are not supported for "
400 "caching proxy servers.");
401 return false;
402 }
403
404// If this server is only a forwarding proxy server, we can't support client
405// personas either because we don't control the URL. However, if we have an
406// origin then simply warn that the client persona applies to the origin.
407//
408 if (outProxy)
409 {if (!ManList)
410 {eDest.Emsg("Config", "Client personas are not supported for "
411 "strictly forwarding proxy servers.");
412 return false;
413 }
414 eDest.Say("Config warning: client personas only apply to "
415 "the origin server!");
416 }
417
418// We need to get a connection tracker object from the posix interface.
419// However, we only need it if we are actually mapping id's.
420//
421 if (sssMap == XrdSecsssID::idStaticM) conTracker = 0;
422 else conTracker = XrdPosixConfig::conTracker(Debug);
423
424// Get an mapper object
425//
426 idMapper = new XrdSecsssID(sssMap, 0, conTracker, &isOK);
427 if (!isOK)
428 {eDest.Emsg("Config", "Unable to render persona; persona mapper failed!");
429 return false;
430 }
431
432// If ths is a server persona then we don't need the mapper; abandon it.
433//
434 if (sssMap == XrdSecsssID::idStaticM) idMapper = 0;
435 else XrdPssUrlInfo::setMapID(true);
436
437// We are all done
438//
439 return true;
440}
static XrdSysError eDest(0,"crypto_")
#define TRACEPSS_Debug
bool Debug
static XrdSecsssCon * conTracker(bool debug=false)
static bool deferID
Definition XrdPss.hh:225
static XrdOucTList * ManList
Definition XrdPss.hh:212
static void setMapID(bool onoff)
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
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)
XrdSysTrace SysTrace("Pss", 0)
Definition XrdPssCks.cc:55
bool outProxy
Definition XrdPss.cc:126

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)
overridevirtual

Notify storage system that a client has connected.

Parameters
env- Reference to environmental information.

Reimplemented from XrdOss.

Definition at line 236 of file XrdPss.cc.

237{
238 EPNAME("Connect");
239 const XrdSecEntity *client = theEnv.secEnv();
240
241// If we need to personify the client, set it up
242//
243 if (idMapper && client)
244 {const char *fmt = (client->ueid & 0xf0000000 ? "%x" : "U%x");
245 char uName[32];
246 snprintf(uName, sizeof(uName), fmt, client->ueid);
247 DEBUG(client->tident,"Registering as ID "<<uName);
248 idMapper->Register(uName, client, deferID);
249 }
250}
#define DEBUG(x)
#define EPNAME(x)
const XrdSecEntity * secEnv() const
Definition XrdOucEnv.hh:107
const char * tident
Trace identifier always preset.
unsigned int ueid
Unique ID of entity instance.
XrdOucEnv theEnv

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 )
overridevirtual

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_coloc - Colocate file using the URL encoded path in env "oss.coloc" 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 274 of file XrdPss.cc.

276{
277
278 return -ENOTSUP;
279}

References Mode, and tident.

◆ Disc()

void XrdPssSys::Disc ( XrdOucEnv & env)
overridevirtual

Notify storage system that a client has disconnected.

Parameters
env- Reference to environmental information.

Reimplemented from XrdOss.

Definition at line 285 of file XrdPss.cc.

286{
287 EPNAME("Disc");
288 const XrdSecEntity *client = theEnv.secEnv();
289
290// If we personified a client, remove that persona.
291//
292 if (idMapper && client)
293 {const char *fmt = (client->ueid & 0xf0000000 ? "%x" : "U%x");
294 char uName[32];
295 snprintf(uName, sizeof(uName), fmt, client->ueid);
296 DEBUG(client->tident,"Unregistering as ID "<<uName);
297 idMapper->Register(uName, 0);
298 }
299}

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

Here is the call graph for this function:

◆ EnvInfo()

void XrdPssSys::EnvInfo ( XrdOucEnv * envP)
overridevirtual

Notify storage system of initialization information (deprecated).

Parameters
envP- Pointer to environmental information.

Reimplemented from XrdOss.

Definition at line 305 of file XrdPss.cc.

306{
307// We only need to extract the scheduler pointer from the environment. Propogate
308// the information to the POSIX layer.
309//
310 if (envP)
311 {schedP = (XrdScheduler *)envP->GetPtr("XrdScheduler*");
313 }
314}
void * GetPtr(const char *varname)
Definition XrdOucEnv.cc:263
static void EnvInfo(XrdOucEnv &theEnv)
XrdScheduler * schedP
Definition XrdPss.cc:106
XrdOucEnv * envP
Definition XrdPss.cc:110

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

Here is the call graph for this function:

◆ Features()

uint64_t XrdPssSys::Features ( )
inlineoverridevirtual

Return storage system features.

Returns
Storage system features (see XRDOSS_HASxxx flags).

Reimplemented from XrdOss.

Definition at line 178 of file XrdPss.hh.

178{return myFeatures;}

◆ FSctl()

int XrdPssSys::FSctl ( int cmd,
int alen,
const char * args,
char ** resp = 0 )
overridevirtual

Execute a special storage system operation.

Parameters
cmd- The operation to be performed: XRDOSS_FSCTLFA - Perform proxy file attribute operation XRDOSS_FSCTLFS - Perform proxy file system operation
alen- Length of data pointed to by args.
args- Data sent with request, zero if alen is zero.
resp- Where the response is to be set, if any.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOss.

Definition at line 320 of file XrdPss.cc.

321{
322 EPNAME("FSctl");
324 int rc;
325
326// Get correct argument to use
327//
328 switch(cmd)
330 break;
331 default:
332 *resp = 0;
333 return -ENOTSUP;
334 break;
335 }
336
337// Perform setup
338//
339 std::string thePath(args, alen); // Gaurd against missing null byte
340 std::string theResp;
341 XrdPssUrlInfo uInfo(0, args); // CGI is already appended
342 char pbuff[PBsz];
343
344// Convert path to URL
345//
346 if ((rc = P2URL(pbuff, PBsz, uInfo, xLfn2Pfn))) return rc;
347 thePath = pbuff;
348
349// Some tracing
350//
351 if(DEBUGON) {
352 auto urlObf = obfuscateAuth(pbuff);
353 DEBUG(uInfo.Tident(),"url="<<urlObf);
354 }
355
356// Invoke the file control. Make sure it goes through the cache if it exists.
357//
358 if (XrdPosixExtra::FSctl(opc, thePath, theResp, true) < 0) return -errno;
359
360// Convert the response
361//
362 if (resp)
363 {int n = theResp.size() + 1;
364 *resp = new char[n];
365 strcpy(*resp, theResp.c_str());
366 }
367 return XrdOssOK;
368}
#define XRDOSS_FSCTLFS
Definition XrdOss.hh:555
#define XrdOssOK
Definition XrdOss.hh:54
std::string obfuscateAuth(const std::string &input)
#define DEBUGON
static int FSctl(XrdOucCacheOp::Code opc, const std::string &args, std::string &resp, bool viaCache=false, bool viaRedir=false)
static int P2URL(char *pbuff, int pblen, XrdPssUrlInfo &uInfo, bool doN2N=true)
Definition XrdPss.cc:1621
static bool xLfn2Pfn
Definition XrdPss.hh:222
static const int PBsz
Definition XrdPss.cc:120

References DEBUG, DEBUGON, EPNAME, XrdPosixExtra::FSctl(), obfuscateAuth(), P2URL(), XrdProxy::PBsz, XrdOucCacheOp::QFSinfo, XrdPssUrlInfo::Tident(), xLfn2Pfn, XRDOSS_FSCTLFS, and XrdOssOK.

Here is the call graph for this function:

◆ getErrMsg()

bool XrdPssSys::getErrMsg ( std::string & eText)
overridevirtual

Obtain detailed error message text for the immediately preceeding error returned by any method in this class.

Parameters
eText- Where the message text is to be returned.
Returns
True if message text is available, false otherwise.
Note
This method should be called using the same thread that encountered the error; otherwise, missleading error text may be returned.
Upon return, the internal error message text is cleared.

Reimplemented from XrdOss.

Definition at line 374 of file XrdPss.cc.

375{
376// Return what we have but make sure to reset whatever we have
377//
378 if (XrdProxy::ecMsg.Get() <= 0 || !XrdProxy::ecMsg.hasMsg()) return false;
379 XrdProxy::ecMsg.Get(eText);
380 return true;
381}
int Get(std::string &ecm, bool rst=true)
XrdOucECMsg ecMsg("[pss]")

References XrdProxy::ecMsg.

◆ Info()

int XrdPssSys::Info ( int rc)
static

Definition at line 1517 of file XrdPss.cc.

1518{
1519 std::string psxMsg;
1520 int n = XrdPosixXrootd::QueryError(psxMsg);
1521
1522 XrdProxy::ecMsg.Set(n, psxMsg);
1523 return -rc;
1524}
void Set(int ecc, const char *ecm="")
static int QueryError(std::string &emsg, int fd=-1, bool reset=true)

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

Referenced by Mkdir(), Remdir(), Rename(), Stat(), Truncate(), and Unlink().

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 )
inlineoverridevirtual

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 181 of file XrdPss.hh.

181{return -ENOTSUP;}

◆ Init() [2/2]

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

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 183 of file XrdPss.cc.

184{
185 int NoGo;
186 const char *tmp;
187
188// Do the herald thing
189//
191 eDest.logger(lp);
192 eDest.Say("Copr. 2019, Stanford University, Pss Version " XrdVSTRING);
193
194// Initialize the subsystems
195//
196 tmp = ((NoGo = Configure(cFN, envP)) ? "failed." : "completed.");
197 eDest.Say("------ Proxy storage system initialization ", tmp);
198
199// Extract Pfc control, if it is there.
200//
201 if (!NoGo)
202 cacheFSctl = (XrdOfsFSctl_PI*)envP->GetPtr("XrdFSCtl_PC*");
203
204
205// All done.
206//
207 return NoGo;
208}
XrdSysLogger * logger(XrdSysLogger *lp=0)
void SetLogger(XrdSysLogger *logp)
XrdOfsFSctl_PI * cacheFSctl
Definition XrdPss.cc:112

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

◆ Lfn2Pfn() [1/2]

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

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 387 of file XrdPss.cc.

388{
389 if (theN2N) return -(theN2N->lfn2pfn(oldp, newp, blen));
390 if ((int)strlen(oldp) >= blen) return -ENAMETOOLONG;
391 strcpy(newp, oldp);
392 return 0;
393}

◆ Lfn2Pfn() [2/2]

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

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 395 of file XrdPss.cc.

396{
397 if (!theN2N) {rc = 0; return oldp;}
398 if ((rc = -(theN2N->lfn2pfn(oldp, newp, blen)))) return 0;
399 return newp;
400}

◆ Mkdir()

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

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 419 of file XrdPss.cc.

420{
421 EPNAME("Mkdir");
422 XrdPssUrlInfo uInfo(eP, path);
423 int rc;
424 char pbuff[PBsz];
425
426// Verify we can write here
427//
428 if (isREADONLY(path)) return -EROFS;
429
430// Convert path to URL
431//
432 if ((rc = P2URL(pbuff, PBsz, uInfo, xLfn2Pfn))) return rc;
433
434// Some tracing
435//
436 if(DEBUGON) {
437 auto urlObf = obfuscateAuth(pbuff);
438 DEBUG(uInfo.Tident(),"url="<<urlObf);
439 }
440
441// Simply return the proxied result here
442//
443 return (XrdPosixXrootd::Mkdir(pbuff, mode) ? Info(errno) : XrdOssOK);
444}
#define isREADONLY(_x_)
Definition XrdPss.cc:90
static int Mkdir(const char *path, mode_t mode)
Mkdir() conforms to POSIX.1-2001 mkdir().
static int Info(int rc)
Definition XrdPss.cc:1517

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)
inlineoverridevirtual

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 164 of file XrdPss.hh.

165 {return (XrdOssDF *)new XrdPssDir(tident);}
#define tident

References tident.

◆ newFile()

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

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 166 of file XrdPss.hh.

167 {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 1530 of file XrdPss.cc.

1532{
1533 const char *Slash;
1534 int n;
1535
1536// Extract out the destination
1537//
1538 Slash = index(path, '/');
1539 if (!Slash || (n = (Slash - path)) == 0) {retc = -EINVAL; return 0;}
1540 if (n >= hBlen) {retc = -ENAMETOOLONG; return 0;}
1541 strncpy(hBuff, path, n); hBuff[n] = 0;
1542
1543// Check if we need to authorize the outgoing connection
1544//
1545 if (Police[pEnt] && !Police[pEnt]->Authorize(hBuff))
1546 {retc = -EACCES; return 0;}
1547
1548// All is well
1549//
1550 return n;
1551}
XrdAccAuthorize * Authorize
Definition XrdAccTest.cc:61
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 1557 of file XrdPss.cc.

1558{ const char *theID = uInfo.getID();
1559 const char *pname, *path, *thePath;
1560 char hBuff[288];
1561 int retc, n;
1562
1563// Setup the path
1564//
1565 thePath = path = uInfo.thePath();
1566
1567// Make sure the path is valid for an outgoing proxy
1568//
1569 if (*path == '/') path++;
1570 if ((pname = XrdPssUtils::valProt(path, n, 1))) path += n;
1571 else {if (!hdrLen) return -ENOTSUP;
1572 n = snprintf(pbuff, pblen, hdrData, theID, thePath);
1573 if (n >= pblen || !uInfo.addCGI(pbuff, pbuff+n, pblen-n))
1574 return -ENAMETOOLONG;
1575 return 0;
1576 }
1577
1578// Objectid must be handled differently as they have not been refalgomized
1579//
1580 if (*thePath != '/')
1581 {if (*path == '/')
1582 {path++;
1583 if (*path == '/') theID = "";
1584 }
1585 if (Police[PolObj] && !P2DST(retc, hBuff, sizeof(hBuff), PolObj,
1586 path+(*path == '/' ? 1:0))) return 0;
1587 n = snprintf(pbuff, pblen, "%s%s%s", pname, theID, path);
1588 if (n >= pblen || !uInfo.addCGI(pbuff, pbuff+n, pblen-n))
1589 return -ENAMETOOLONG;
1590 return 0;
1591 }
1592
1593// Extract out the destination. We need to do this because the front end
1594// will have extracted out double slashes and we need to add them back. We
1595// also authorize the outgoing connection if we need to in the process.
1596//
1597 if (!(n = P2DST(retc, hBuff, sizeof(hBuff), PolPath, path))) return 0;
1598 path += n;
1599
1600// Create the new path. If the url already contains a userid then use it
1601// instead or our internally generated one. We may need an option for this
1602// as it may result in unintended side-effects but for now we do that.
1603//
1604 if (index(hBuff, '@')) theID= "";
1605 n = snprintf(pbuff,pblen,"%s%s%s/%s",pname,theID,hBuff,path);
1606
1607// Make sure the path will fit
1608//
1609 if (n >= pblen || !uInfo.addCGI(pbuff, pbuff+n, pblen-n))
1610 return -ENAMETOOLONG;
1611
1612// All done
1613//
1614 return 0;
1615}
static int hdrLen
Definition XrdPss.hh:216
static const char * hdrData
Definition XrdPss.hh:215
static int P2DST(int &retc, char *hBuff, int hBlen, PolAct pType, const char *path)
Definition XrdPss.cc:1530
const char * getID()
const char * thePath()
bool addCGI(const char *prot, char *buff, int blen)
static const char * valProt(const char *pname, int &plen, int adj=0)

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 1621 of file XrdPss.cc.

1622{
1623
1624// If this is an outgoing proxy then we need to do someother work
1625//
1626 if (outProxy) return P2OUT(pbuff, pblen, uInfo);
1627
1628// Do url generation for actual known origin
1629//
1630 const char *path = uInfo.thePath();
1631 int retc, pfxLen;
1632 char Apath[MAXPATHLEN+1];
1633
1634// Setup to process url generation
1635//
1636 path = uInfo.thePath();
1637
1638// First, apply the N2N mapping if necessary. If N2N fails then the whole
1639// mapping fails and ENAMETOOLONG will be returned.
1640//
1641 if (doN2N && XrdProxySS.theN2N)
1642 {if ((retc = XrdProxySS.theN2N->lfn2pfn(path, Apath, sizeof(Apath))))
1643 {if (retc > 0) return -retc;}
1644 path = Apath;
1645 }
1646
1647// Format the header into the buffer and check if we overflowed. Note that we
1648// defer substitution of the path as we need to know where the path is.
1649//
1650 if (fileOrgn) pfxLen = snprintf(pbuff, pblen, hdrData, path);
1651 else pfxLen = snprintf(pbuff, pblen, hdrData, uInfo.getID(), path);
1652 if (pfxLen >= pblen) return -ENAMETOOLONG;
1653
1654// Add any cgi information
1655//
1656 if (!fileOrgn && uInfo.hasCGI())
1657 {if (!uInfo.addCGI(pbuff, pbuff+pfxLen, pblen-pfxLen))
1658 return -ENAMETOOLONG;
1659 }
1660
1661// All done
1662//
1663 return 0;
1664}
virtual int lfn2pfn(const char *lfn, char *buff, int blen)=0
static int P2OUT(char *pbuff, int pblen, XrdPssUrlInfo &uInfo)
Definition XrdPss.cc:1557
static char * fileOrgn
Definition XrdPss.hh:213
static XrdPssSys XrdProxySS
Definition XrdPss.cc:102

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

Referenced by FSctl(), 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 )
overridevirtual

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 458 of file XrdPss.cc.

459{
460 EPNAME("Remdir");
461 const char *Cgi = "";
462 int rc;
463 char pbuff[PBsz];
464
465// Verify we can write here
466//
467 if (isREADONLY(path)) return -EROFS;
468
469// Setup any required cgi information
470//
471 if (*path == '/' && !outProxy && (Opts & XRDOSS_Online)) Cgi = ofslclCGI;
472
473// Setup url information
474//
475 XrdPssUrlInfo uInfo(eP, path, Cgi);
476
477// Convert path to URL
478//
479 if ((rc = P2URL(pbuff, PBsz, uInfo, xLfn2Pfn))) return rc;
480
481// Do some tracing
482//
483 if(DEBUGON) {
484 auto urlObf = obfuscateAuth(pbuff);
485 DEBUG(uInfo.Tident(),"url="<<urlObf);
486 }
487// Issue unlink and return result
488//
489 return (XrdPosixXrootd::Rmdir(pbuff) ? Info(errno) : XrdOssOK);
490}
#define XRDOSS_Online
Definition XrdOss.hh:528
static int Rmdir(const char *path)
Rmdir() conforms to POSIX.1-2001 rmdir().
static const char * ofslclCGI
Definition XrdPss.cc:116

References DEBUG, DEBUGON, EPNAME, Info(), 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 )
overridevirtual

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 506 of file XrdPss.cc.

508{
509 EPNAME("Rename");
510 int rc;
511 char oldName[PBsz], newName[PBsz];
512
513// Verify we can write in the source and target
514//
515 if (isREADONLY(oldname) || isREADONLY(newname)) return -EROFS;
516
517// Setup url info
518//
519 XrdPssUrlInfo uInfoOld(oldenvP, oldname);
520 XrdPssUrlInfo uInfoNew(newenvP, newname, "", true, false);
521
522// Convert path to URL
523//
524 if ((rc = P2URL(oldName, PBsz, uInfoOld, xLfn2Pfn))
525 || (rc = P2URL(newName, PBsz, uInfoNew, xLfn2Pfn))) return rc;
526
527// Do some tracing
528//
529 if(DEBUGON) {
530 auto oldNameObf = obfuscateAuth(oldName);
531 auto newNameObf = obfuscateAuth(newName);
532 DEBUG(uInfoOld.Tident(),"old url="<<oldNameObf <<" new url=" <<newNameObf);
533 }
534
535
536// Execute the rename and return result
537//
538 return (XrdPosixXrootd::Rename(oldName, newName) ? Info(errno) : XrdOssOK);
539}
static int Rename(const char *oldpath, const char *newpath)
Rename() conforms to POSIX.1-2001 rename().

References DEBUG, DEBUGON, EPNAME, Info(), 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 )
overridevirtual

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 559 of file XrdPss.cc.

560{
561 EPNAME("Stat");
562 const char *Cgi = "";
563 int rc;
564 char pbuff[PBsz];
565
566// Setup any required special cgi information
567//
568 if (*path == '/' && !outProxy && ((Opts & XRDOSS_resonly)||isNOSTAGE(path)))
569 Cgi = osslclCGI;
570
571// We can now establish the url information to be used
572//
573 XrdPssUrlInfo uInfo(eP, path, Cgi);
574
575// Generate an ID if we need to. We can use the server's identity unless that
576// has been prohibited because client ID mapping is taking place.
577//
578 if (idMapAll) uInfo.setID();
579 else if (sidP) uInfo.setID(sidP);
580
581// Convert path to URL
582//
583 if ((rc = P2URL(pbuff, PBsz, uInfo, xLfn2Pfn))) return rc;
584
585// Do some tracing
586//
587 if(DEBUGON) {
588 auto urlObf = obfuscateAuth(pbuff);
589 DEBUG(uInfo.Tident(),"url="<<urlObf);
590 }
591
592// Return proxied stat
593//
594 return (XrdPosixXrootd::Stat(pbuff, buff) ? Info(errno) : XrdOssOK);
595}
#define XRDOSS_resonly
Definition XrdOss.hh:548
#define isNOSTAGE(_x_)
Definition XrdPss.cc:88
static int Stat(const char *path, struct stat *buf)
Stat() conforms to POSIX.1-2001 stat().
XrdOucSid * sidP
Definition XrdPss.cc:108
static const char * osslclCGI
Definition XrdPss.cc:118
bool idMapAll
Definition XrdPss.cc:124

References DEBUG, DEBUGON, EPNAME, XrdProxy::idMapAll, Info(), 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 )
overridevirtual

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 610 of file XrdPss.cc.

611{
612 return XrdPosixConfig::Stats("pss", bp, bl);
613}
static int Stats(const char *theID, char *buff, int blen)

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 )
overridevirtual

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 628 of file XrdPss.cc.

630{
631 EPNAME("Trunc");
632 XrdPssUrlInfo uInfo(envP, path);
633 int rc;
634 char pbuff[PBsz];
635
636// Make sure we can write here
637//
638 if (isREADONLY(path)) return -EROFS;
639
640// Convert path to URL
641//
642 if ((rc = P2URL(pbuff, PBsz, uInfo, xLfn2Pfn))) return rc;
643
644// Do some tracing
645//
646 if(DEBUGON) {
647 auto urlObf = obfuscateAuth(pbuff);
648 DEBUG(uInfo.Tident(),"url="<<urlObf);
649 }
650
651// Return proxied truncate. We only do this on a single machine because the
652// redirector will forbid the trunc() if multiple copies exist.
653//
654 return (XrdPosixXrootd::Truncate(pbuff, flen) ? Info(errno) : XrdOssOK);
655}
static int Truncate(const char *path, off_t offset)
Telldir() conforms to POSIX.1-2001 telldir().

References DEBUG, DEBUGON, XrdProxy::envP, EPNAME, Info(), 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 )
overridevirtual

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 669 of file XrdPss.cc.

670{
671 EPNAME("Unlink");
672 const char *Cgi = "";
673 int rc;
674 char pbuff[PBsz];
675
676// Make sure we can write here
677//
678 if (isREADONLY(path)) return -EROFS;
679
680// Setup any required cgi information
681//
682 if (*path == '/' && !outProxy && (Opts & XRDOSS_Online)) Cgi = ofslclCGI;
683
684// Setup url info
685//
686 XrdPssUrlInfo uInfo(envP, path, Cgi);
687
688// Convert path to URL
689//
690 if ((rc = P2URL(pbuff, PBsz, uInfo, xLfn2Pfn))) return rc;
691
692// Do some tracing
693//
694 if(DEBUGON) {
695 auto urlObf = obfuscateAuth(pbuff);
696 DEBUG(uInfo.Tident(),"url="<<urlObf);
697 }
698
699// Unlink the file and return result.
700//
701 return (XrdPosixXrootd::Unlink(pbuff) ? Info(errno) : XrdOssOK);
702}
static int Unlink(const char *path)
Unlink() conforms to POSIX.1-2001 unlink().

References DEBUG, DEBUGON, XrdProxy::envP, EPNAME, Info(), 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 205 of file XrdPss.hh.

◆ dcaCheck

bool XrdPssSys::dcaCheck = false
static

Definition at line 223 of file XrdPss.hh.

Referenced by XrdPssFile::Open().

◆ dcaCTime

int XrdPssSys::dcaCTime = 0
static

Definition at line 220 of file XrdPss.hh.

◆ dcaWorld

bool XrdPssSys::dcaWorld = false
static

Definition at line 224 of file XrdPss.hh.

Referenced by XrdPssFile::Open().

◆ deferID

bool XrdPssSys::deferID = false
static

Definition at line 225 of file XrdPss.hh.

Referenced by ConfigMapID(), and Connect().

◆ fileOrgn

char * XrdPssSys::fileOrgn = 0
static

Definition at line 213 of file XrdPss.hh.

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

◆ hdrData

const char * XrdPssSys::hdrData = ""
static

Definition at line 215 of file XrdPss.hh.

Referenced by P2OUT(), and P2URL().

◆ hdrLen

int XrdPssSys::hdrLen = 0
static

Definition at line 216 of file XrdPss.hh.

Referenced by P2OUT().

◆ ManList

XrdOucTList * XrdPssSys::ManList = 0
static

Definition at line 212 of file XrdPss.hh.

Referenced by ConfigMapID().

◆ myHost

const char * XrdPssSys::myHost
static

Definition at line 206 of file XrdPss.hh.

◆ myName

const char * XrdPssSys::myName
static

Definition at line 207 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 195 of file XrdPss.hh.

◆ protName

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

Definition at line 214 of file XrdPss.hh.

◆ reProxy

bool XrdPssSys::reProxy = false
static

Definition at line 226 of file XrdPss.hh.

Referenced by XrdPssFile::Open().

◆ Streams

int XrdPssSys::Streams =512
static

Definition at line 217 of file XrdPss.hh.

◆ Trace

int XrdPssSys::Trace = 0
static

Definition at line 219 of file XrdPss.hh.

◆ Workers

int XrdPssSys::Workers = 16
static

Definition at line 218 of file XrdPss.hh.

◆ xLfn2Pfn

bool XrdPssSys::xLfn2Pfn = false
static

◆ XPList

XrdOucPListAnchor XrdPssSys::XPList
static

Definition at line 209 of file XrdPss.hh.

Referenced by XrdPssFile::Open().


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