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 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 FSctl (int cmd, int alen, const char *args, char **resp=0)
 
virtual int Reloc (const char *tident, const char *path, const char *cgName, const char *anchor=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 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 152 of file XrdPss.hh.

Member Enumeration Documentation

◆ PolAct

Enumerator
PolPath 
PolObj 

Definition at line 185 of file XrdPss.hh.

185{PolPath = 0, PolObj = 1};

Constructor & Destructor Documentation

◆ XrdPssSys()

XrdPssSys::XrdPssSys ( )

Definition at line 165 of file XrdPss.cc.

165 : HostArena(0), LocalRoot(0), theN2N(0), DirFlags(0),
166 myVersion(&XrdVERSIONINFOVAR(XrdOssGetStorageSystem2)),
168 {}
#define XRDOSS_HASPRXY
Definition XrdOss.hh:477
#define XRDOSS_HASNOSF
Definition XrdOss.hh:478
#define XRDOSS_HASPGRW
Definition XrdOss.hh:475
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 ( )
inlinevirtual

Definition at line 218 of file XrdPss.hh.

218{}

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

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

◆ ConfigMapID()

bool XrdPssSys::ConfigMapID ( )

Definition at line 375 of file XrdPssConfig.cc.

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

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.

235{
236 EPNAME("Connect");
237 const XrdSecEntity *client = theEnv.secEnv();
238
239// If we need to personify the client, set it up
240//
241 if (idMapper && client)
242 {const char *fmt = (client->ueid & 0xf0000000 ? "%x" : "U%x");
243 char uName[32];
244 snprintf(uName, sizeof(uName), fmt, client->ueid);
245 DEBUG(client->tident,"Registering as ID "<<uName);
246 idMapper->Register(uName, client, deferID);
247 }
248}
#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_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.

274{
275
276 return -ENOTSUP;
277}

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

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

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

304{
305// We only need to extract the scheduler pointer from the environment. Propogate
306// the information to the POSIX layer.
307//
308 if (envP)
309 {schedP = (XrdScheduler *)envP->GetPtr("XrdScheduler*");
311 }
312}
void * GetPtr(const char *varname)
Definition XrdOucEnv.cc:263
static void EnvInfo(XrdOucEnv &theEnv)
XrdScheduler * schedP
Definition XrdPss.cc:105
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 ( )
inlineoverridevirtual

Return storage system features.

Returns
Storage system features (see XRDOSS_HASxxx flags).

Reimplemented from XrdOss.

Definition at line 169 of file XrdPss.hh.

169{return myFeatures;}

◆ Info()

int XrdPssSys::Info ( int rc)
static

Definition at line 1313 of file XrdPss.cc.

1314{
1316 return -rc;
1317}
static int QueryError(std::string &emsg, int fd=-1, bool reset=true)
thread_local 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 )
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 170 of file XrdPss.hh.

170{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 181 of file XrdPss.cc.

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

319{
320 if (theN2N) return -(theN2N->lfn2pfn(oldp, newp, blen));
321 if ((int)strlen(oldp) >= blen) return -ENAMETOOLONG;
322 strcpy(newp, oldp);
323 return 0;
324}

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

327{
328 if (!theN2N) {rc = 0; return oldp;}
329 if ((rc = -(theN2N->lfn2pfn(oldp, newp, blen)))) return 0;
330 return newp;
331}

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

351{
352 EPNAME("Mkdir");
353 XrdPssUrlInfo uInfo(eP, path);
354 int rc;
355 char pbuff[PBsz];
356
357// Verify we can write here
358//
359 if (isREADONLY(path)) return -EROFS;
360
361// Convert path to URL
362//
363 if ((rc = P2URL(pbuff, PBsz, uInfo, xLfn2Pfn))) return rc;
364
365// Some tracing
366//
367 if(DEBUGON) {
368 auto urlObf = obfuscateAuth(pbuff);
369 DEBUG(uInfo.Tident(),"url="<<urlObf);
370 }
371
372// Simply return the proxied result here
373//
374 return (XrdPosixXrootd::Mkdir(pbuff, mode) ? Info(errno) : XrdOssOK);
375}
#define XrdOssOK
Definition XrdOss.hh:50
std::string obfuscateAuth(const std::string &input)
#define DEBUGON
#define isREADONLY(_x_)
Definition XrdPss.cc:89
static int Mkdir(const char *path, mode_t mode)
Mkdir() conforms to POSIX.1-2001 mkdir()
static int Info(int rc)
Definition XrdPss.cc:1313
static int P2URL(char *pbuff, int pblen, XrdPssUrlInfo &uInfo, bool doN2N=true)
Definition XrdPss.cc:1414
static bool xLfn2Pfn
Definition XrdPss.hh:211
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)
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 155 of file XrdPss.hh.

156 {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 157 of file XrdPss.hh.

158 {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 1323 of file XrdPss.cc.

1325{
1326 const char *Slash;
1327 int n;
1328
1329// Extract out the destination
1330//
1331 Slash = index(path, '/');
1332 if (!Slash || (n = (Slash - path)) == 0) {retc = -EINVAL; return 0;}
1333 if (n >= hBlen) {retc = -ENAMETOOLONG; return 0;}
1334 strncpy(hBuff, path, n); hBuff[n] = 0;
1335
1336// Check if we need to authorize the outgoing connection
1337//
1338 if (Police[pEnt] && !Police[pEnt]->Authorize(hBuff))
1339 {retc = -EACCES; return 0;}
1340
1341// All is well
1342//
1343 return n;
1344}
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 1350 of file XrdPss.cc.

1351{ const char *theID = uInfo.getID();
1352 const char *pname, *path, *thePath;
1353 char hBuff[288];
1354 int retc, n;
1355
1356// Setup the path
1357//
1358 thePath = path = uInfo.thePath();
1359
1360// Make sure the path is valid for an outgoing proxy
1361//
1362 if (*path == '/') path++;
1363 if ((pname = XrdPssUtils::valProt(path, n, 1))) path += n;
1364 else {if (!hdrLen) return -ENOTSUP;
1365 n = snprintf(pbuff, pblen, hdrData, theID, thePath);
1366 if (n >= pblen || !uInfo.addCGI(pbuff, pbuff+n, pblen-n))
1367 return -ENAMETOOLONG;
1368 return 0;
1369 }
1370
1371// Objectid must be handled differently as they have not been refalgomized
1372//
1373 if (*thePath != '/')
1374 {if (*path == '/')
1375 {path++;
1376 if (*path == '/') theID = "";
1377 }
1378 if (Police[PolObj] && !P2DST(retc, hBuff, sizeof(hBuff), PolObj,
1379 path+(*path == '/' ? 1:0))) return 0;
1380 n = snprintf(pbuff, pblen, "%s%s%s", pname, theID, path);
1381 if (n >= pblen || !uInfo.addCGI(pbuff, pbuff+n, pblen-n))
1382 return -ENAMETOOLONG;
1383 return 0;
1384 }
1385
1386// Extract out the destination. We need to do this because the front end
1387// will have extracted out double slashes and we need to add them back. We
1388// also authorize the outgoing connection if we need to in the process.
1389//
1390 if (!(n = P2DST(retc, hBuff, sizeof(hBuff), PolPath, path))) return 0;
1391 path += n;
1392
1393// Create the new path. If the url already contains a userid then use it
1394// instead or our internally generated one. We may need an option for this
1395// as it may result in unintended side-effects but for now we do that.
1396//
1397 if (index(hBuff, '@')) theID= "";
1398 n = snprintf(pbuff,pblen,"%s%s%s/%s",pname,theID,hBuff,path);
1399
1400// Make sure the path will fit
1401//
1402 if (n >= pblen || !uInfo.addCGI(pbuff, pbuff+n, pblen-n))
1403 return -ENAMETOOLONG;
1404
1405// All done
1406//
1407 return 0;
1408}
static int hdrLen
Definition XrdPss.hh:205
static const char * hdrData
Definition XrdPss.hh:204
static int P2DST(int &retc, char *hBuff, int hBlen, PolAct pType, const char *path)
Definition XrdPss.cc:1323
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 1414 of file XrdPss.cc.

1415{
1416
1417// If this is an outgoing proxy then we need to do someother work
1418//
1419 if (outProxy) return P2OUT(pbuff, pblen, uInfo);
1420
1421// Do url generation for actual known origin
1422//
1423 const char *path = uInfo.thePath();
1424 int retc, pfxLen;
1425 char Apath[MAXPATHLEN+1];
1426
1427// Setup to process url generation
1428//
1429 path = uInfo.thePath();
1430
1431// First, apply the N2N mapping if necessary. If N2N fails then the whole
1432// mapping fails and ENAMETOOLONG will be returned.
1433//
1434 if (doN2N && XrdProxySS.theN2N)
1435 {if ((retc = XrdProxySS.theN2N->lfn2pfn(path, Apath, sizeof(Apath))))
1436 {if (retc > 0) return -retc;}
1437 path = Apath;
1438 }
1439
1440// Format the header into the buffer and check if we overflowed. Note that we
1441// defer substitution of the path as we need to know where the path is.
1442//
1443 if (fileOrgn) pfxLen = snprintf(pbuff, pblen, hdrData, path);
1444 else pfxLen = snprintf(pbuff, pblen, hdrData, uInfo.getID(), path);
1445 if (pfxLen >= pblen) return -ENAMETOOLONG;
1446
1447// Add any cgi information
1448//
1449 if (!fileOrgn && uInfo.hasCGI())
1450 {if (!uInfo.addCGI(pbuff, pbuff+pfxLen, pblen-pfxLen))
1451 return -ENAMETOOLONG;
1452 }
1453
1454// All done
1455//
1456 return 0;
1457}
virtual int lfn2pfn(const char *lfn, char *buff, int blen)=0
static int P2OUT(char *pbuff, int pblen, XrdPssUrlInfo &uInfo)
Definition XrdPss.cc:1350
static char * fileOrgn
Definition XrdPss.hh:202
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 )
overridevirtual

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.

390{
391 EPNAME("Remdir");
392 const char *Cgi = "";
393 int rc;
394 char pbuff[PBsz];
395
396// Verify we can write here
397//
398 if (isREADONLY(path)) return -EROFS;
399
400// Setup any required cgi information
401//
402 if (*path == '/' && !outProxy && (Opts & XRDOSS_Online)) Cgi = ofslclCGI;
403
404// Setup url information
405//
406 XrdPssUrlInfo uInfo(eP, path, Cgi);
407
408// Convert path to URL
409//
410 if ((rc = P2URL(pbuff, PBsz, uInfo, xLfn2Pfn))) return rc;
411
412// Do some tracing
413//
414 if(DEBUGON) {
415 auto urlObf = obfuscateAuth(pbuff);
416 DEBUG(uInfo.Tident(),"url="<<urlObf);
417 }
418// Issue unlink and return result
419//
420 return (XrdPosixXrootd::Rmdir(pbuff) ? -errno : XrdOssOK);
421}
#define XRDOSS_Online
Definition XrdOss.hh:468
static int Rmdir(const char *path)
Rmdir() conforms to POSIX.1-2001 rmdir()
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 )
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 437 of file XrdPss.cc.

439{
440 EPNAME("Rename");
441 int rc;
442 char oldName[PBsz], newName[PBsz];
443
444// Verify we can write in the source and target
445//
446 if (isREADONLY(oldname) || isREADONLY(newname)) return -EROFS;
447
448// Setup url info
449//
450 XrdPssUrlInfo uInfoOld(oldenvP, oldname);
451 XrdPssUrlInfo uInfoNew(newenvP, newname, "", true, false);
452
453// Convert path to URL
454//
455 if ((rc = P2URL(oldName, PBsz, uInfoOld, xLfn2Pfn))
456 || (rc = P2URL(newName, PBsz, uInfoNew, xLfn2Pfn))) return rc;
457
458// Do some tracing
459//
460 if(DEBUGON) {
461 auto oldNameObf = obfuscateAuth(oldName);
462 auto newNameObf = obfuscateAuth(newName);
463 DEBUG(uInfoOld.Tident(),"old url="<<oldNameObf <<" new url=" <<newNameObf);
464 }
465
466
467// Execute the rename and return result
468//
469 return (XrdPosixXrootd::Rename(oldName, newName) ? -errno : XrdOssOK);
470}
static int Rename(const char *oldpath, const char *newpath)
Rename() conforms to POSIX.1-2001 rename()

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

491{
492 EPNAME("Stat");
493 const char *Cgi = "";
494 int rc;
495 char pbuff[PBsz];
496
497// Setup any required special cgi information
498//
499 if (*path == '/' && !outProxy && ((Opts & XRDOSS_resonly)||isNOSTAGE(path)))
500 Cgi = osslclCGI;
501
502// We can now establish the url information to be used
503//
504 XrdPssUrlInfo uInfo(eP, path, Cgi);
505
506// Generate an ID if we need to. We can use the server's identity unless that
507// has been prohibited because client ID mapping is taking place.
508//
509 if (idMapAll) uInfo.setID();
510 else if (sidP) uInfo.setID(sidP);
511
512// Convert path to URL
513//
514 if ((rc = P2URL(pbuff, PBsz, uInfo, xLfn2Pfn))) return rc;
515
516// Do some tracing
517//
518 if(DEBUGON) {
519 auto urlObf = obfuscateAuth(pbuff);
520 DEBUG(uInfo.Tident(),"url="<<urlObf);
521 }
522
523// Return proxied stat
524//
525 return (XrdPosixXrootd::Stat(pbuff, buff) ? -errno : XrdOssOK);
526}
#define XRDOSS_resonly
Definition XrdOss.hh:486
#define isNOSTAGE(_x_)
Definition XrdPss.cc:87
static int Stat(const char *path, struct stat *buf)
Stat() conforms to POSIX.1-2001 stat()
XrdOucSid * sidP
Definition XrdPss.cc:107
static const char * osslclCGI
Definition XrdPss.cc:117
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 )
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 541 of file XrdPss.cc.

542{
543 return XrdPosixConfig::Stats("pss", bp, bl);
544}
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 559 of file XrdPss.cc.

561{
562 EPNAME("Trunc");
563 XrdPssUrlInfo uInfo(envP, path);
564 int rc;
565 char pbuff[PBsz];
566
567// Make sure we can write here
568//
569 if (isREADONLY(path)) return -EROFS;
570
571// Convert path to URL
572//
573 if ((rc = P2URL(pbuff, PBsz, uInfo, xLfn2Pfn))) return rc;
574
575// Do some tracing
576//
577 if(DEBUGON) {
578 auto urlObf = obfuscateAuth(pbuff);
579 DEBUG(uInfo.Tident(),"url="<<urlObf);
580 }
581
582// Return proxied truncate. We only do this on a single machine because the
583// redirector will forbid the trunc() if multiple copies exist.
584//
585 return (XrdPosixXrootd::Truncate(pbuff, flen) ? -errno : XrdOssOK);
586}
static int Truncate(const char *path, off_t offset)
Telldir() conforms to POSIX.1-2001 telldir()

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

601{
602 EPNAME("Unlink");
603 const char *Cgi = "";
604 int rc;
605 char pbuff[PBsz];
606
607// Make sure we can write here
608//
609 if (isREADONLY(path)) return -EROFS;
610
611// Setup any required cgi information
612//
613 if (*path == '/' && !outProxy && (Opts & XRDOSS_Online)) Cgi = ofslclCGI;
614
615// Setup url info
616//
617 XrdPssUrlInfo uInfo(envP, path, Cgi);
618
619// Convert path to URL
620//
621 if ((rc = P2URL(pbuff, PBsz, uInfo, xLfn2Pfn))) return rc;
622
623// Do some tracing
624//
625 if(DEBUGON) {
626 auto urlObf = obfuscateAuth(pbuff);
627 DEBUG(uInfo.Tident(),"url="<<urlObf);
628 }
629
630// Unlink the file and return result.
631//
632 return (XrdPosixXrootd::Unlink(pbuff) ? -errno : XrdOssOK);
633}
static int Unlink(const char *path)
Unlink() conforms to POSIX.1-2001 unlink()

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: