XRootD
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. More...
 
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 More...
 
static const int PF_csVun = 0x00000002
 unverified file checksums present More...
 
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 145 of file XrdPss.hh.

Member Enumeration Documentation

◆ PolAct

Enumerator
PolPath 
PolObj 

Definition at line 178 of file XrdPss.hh.

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

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

◆ ~XrdPssSys()

virtual XrdPssSys::~XrdPssSys ( )
inlinevirtual

Definition at line 211 of file XrdPss.hh.

211 {}

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
Definition: XrdPssTrace.hh:34
static XrdSecsssCon * conTracker(bool debug=false)
static bool deferID
Definition: XrdPss.hh:207
static XrdOucTList * ManList
Definition: XrdPss.hh:194
static void setMapID(bool onoff)
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition: XrdSysError.cc:95
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 SysTrace("PrepGPI")
bool outProxy
Definition: XrdPss.cc:125

References XrdPosixConfig::conTracker(), Macaroons::Debug, XrdProxy::eDest, XrdSysError::Emsg(), XrdProxy::idMapper, XrdSecsssID::idStatic, XrdSecsssID::idStaticM, XrdProxy::outProxy, XrdSysError::Say(), XrdPssUrlInfo::setMapID(), XrdProxy::SysTrace, TRACEPSS_Debug, and XrdSysTrace::What.

+ 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)
Definition: XrdBwmTrace.hh:54
#define EPNAME(x)
Definition: XrdBwmTrace.hh:56
const XrdSecEntity * secEnv() const
Definition: XrdOucEnv.hh:107
const char * tident
Trace identifier always preset.
Definition: XrdSecEntity.hh:81
unsigned int ueid
Unique ID of entity instance.
Definition: XrdSecEntity.hh:79
bool Register(const char *lgnid, const XrdSecEntity *Ident, bool doReplace=false, bool defer=false)
Definition: XrdSecsssID.cc:224
XrdOucEnv theEnv

References DEBUG, deferID, EPNAME, XrdSecsssID::Register(), XrdOucEnv::secEnv(), XrdCms::theEnv, 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 }

◆ 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, XrdSecsssID::Register(), XrdOucEnv::secEnv(), XrdCms::theEnv, 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:281
static void EnvInfo(XrdOucEnv &theEnv)
XrdScheduler * schedP
Definition: XrdPss.cc:105
XrdOucEnv * envP
Definition: XrdPss.cc:109

References XrdPosixConfig::EnvInfo(), XrdProxy::envP, XrdOucEnv::GetPtr(), 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 162 of file XrdPss.hh.

162 {return myFeatures;}

◆ Info()

int XrdPssSys::Info ( int  rc)
static

Definition at line 1301 of file XrdPss.cc.

1302 {
1304  return -rc;
1305 }
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 163 of file XrdPss.hh.

163 {return -ENOTSUP;}

Referenced by XrdOssGetStorageSystem2().

+ Here is the caller graph for this function:

◆ 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 //
188  SysTrace.SetLogger(lp);
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)
Definition: XrdSysError.hh:141
void SetLogger(XrdSysLogger *logp)
Definition: XrdSysTrace.cc:65
XrdOfsFSctl_PI * cacheFSctl
Definition: XrdPss.cc:111
XrdSysTrace SysTrace("Pss", 0)
Definition: XrdPssCks.cc:55
XrdSysError eDest(0, "pss_")

References XrdProxy::cacheFSctl, XrdProxy::eDest, XrdProxy::envP, XrdOucEnv::GetPtr(), XrdSysError::logger(), XrdSysError::Say(), XrdSysTrace::SetLogger(), and XrdProxy::SysTrace.

+ Here is the call graph for this function:

◆ 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 }
virtual int lfn2pfn(const char *lfn, char *buff, int blen)=0

References XrdOucName2Name::lfn2pfn().

+ Here is the call graph for this function:

◆ 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 }

References XrdOucName2Name::lfn2pfn().

+ Here is the call graph for this function:

◆ 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:1301
static int P2URL(char *pbuff, int pblen, XrdPssUrlInfo &uInfo, bool doN2N=true)
Definition: XrdPss.cc:1402
static bool xLfn2Pfn
Definition: XrdPss.hh:204
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 148 of file XrdPss.hh.

149  {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 150 of file XrdPss.hh.

151  {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 1311 of file XrdPss.cc.

1313 {
1314  const char *Slash;
1315  int n;
1316 
1317 // Extract out the destination
1318 //
1319  Slash = index(path, '/');
1320  if (!Slash || (n = (Slash - path)) == 0) {retc = -EINVAL; return 0;}
1321  if (n >= hBlen) {retc = -ENAMETOOLONG; return 0;}
1322  strncpy(hBuff, path, n); hBuff[n] = 0;
1323 
1324 // Check if we need to authorize the outgoing connection
1325 //
1326  if (Police[pEnt] && !Police[pEnt]->Authorize(hBuff))
1327  {retc = -EACCES; return 0;}
1328 
1329 // All is well
1330 //
1331  return n;
1332 }
XrdAccAuthorize * Authorize
Definition: XrdAccTest.cc:61
static XrdNetSecurity * Police[PolNum]
Definition: XrdPss.hh:193

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

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

1403 {
1404 
1405 // If this is an outgoing proxy then we need to do someother work
1406 //
1407  if (outProxy) return P2OUT(pbuff, pblen, uInfo);
1408 
1409 // Do url generation for actual known origin
1410 //
1411  const char *path = uInfo.thePath();
1412  int retc, pfxLen;
1413  char Apath[MAXPATHLEN+1];
1414 
1415 // Setup to process url generation
1416 //
1417  path = uInfo.thePath();
1418 
1419 // First, apply the N2N mapping if necessary. If N2N fails then the whole
1420 // mapping fails and ENAMETOOLONG will be returned.
1421 //
1422  if (doN2N && XrdProxySS.theN2N)
1423  {if ((retc = XrdProxySS.theN2N->lfn2pfn(path, Apath, sizeof(Apath))))
1424  {if (retc > 0) return -retc;}
1425  path = Apath;
1426  }
1427 
1428 // Format the header into the buffer and check if we overflowed. Note that we
1429 // defer substitution of the path as we need to know where the path is.
1430 //
1431  if (fileOrgn) pfxLen = snprintf(pbuff, pblen, hdrData, path);
1432  else pfxLen = snprintf(pbuff, pblen, hdrData, uInfo.getID(), path);
1433  if (pfxLen >= pblen) return -ENAMETOOLONG;
1434 
1435 // Add any cgi information
1436 //
1437  if (!fileOrgn && uInfo.hasCGI())
1438  {if (!uInfo.addCGI(pbuff, pbuff+pfxLen, pblen-pfxLen))
1439  return -ENAMETOOLONG;
1440  }
1441 
1442 // All done
1443 //
1444  return 0;
1445 }
static int P2OUT(char *pbuff, int pblen, XrdPssUrlInfo &uInfo)
Definition: XrdPss.cc:1338
static char * fileOrgn
Definition: XrdPss.hh:195
static XrdPssSys XrdProxySS
Definition: XrdPss.cc:101

References XrdPssUrlInfo::addCGI(), fileOrgn, XrdPssUrlInfo::getID(), XrdPssUrlInfo::hasCGI(), hdrData, XrdOucName2Name::lfn2pfn(), 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()
int Opts
Definition: XrdMpxStats.cc:58
static const char * ofslclCGI
Definition: XrdPss.cc:115

References DEBUG, DEBUGON, EPNAME, isREADONLY, obfuscateAuth(), XrdProxy::ofslclCGI, XrdMpx::Opts, 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(), XrdMpx::Opts, XrdProxy::osslclCGI, XrdProxy::outProxy, P2URL(), XrdProxy::PBsz, XrdPssUrlInfo::setID(), XrdProxy::sidP, XrdPosixXrootd::Stat(), XrdPssUrlInfo::Tident(), xLfn2Pfn, XRDOSS_resonly, and XrdOssOK.

Referenced by XrdPssFile::Fstat().

+ Here is the call graph for this function:
+ Here is the caller 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, XrdMpx::Opts, 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 187 of file XrdPss.hh.

◆ dcaCheck

bool XrdPssSys::dcaCheck = false
static

Definition at line 205 of file XrdPss.hh.

Referenced by XrdPssFile::Open().

◆ dcaCTime

int XrdPssSys::dcaCTime = 0
static

Definition at line 202 of file XrdPss.hh.

◆ dcaWorld

bool XrdPssSys::dcaWorld = false
static

Definition at line 206 of file XrdPss.hh.

Referenced by XrdPssFile::Open().

◆ deferID

bool XrdPssSys::deferID = false
static

Definition at line 207 of file XrdPss.hh.

Referenced by Connect().

◆ fileOrgn

char * XrdPssSys::fileOrgn = 0
static

Definition at line 195 of file XrdPss.hh.

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

◆ hdrData

const char * XrdPssSys::hdrData = ""
static

Definition at line 197 of file XrdPss.hh.

Referenced by P2OUT(), and P2URL().

◆ hdrLen

int XrdPssSys::hdrLen = 0
static

Definition at line 198 of file XrdPss.hh.

Referenced by P2OUT().

◆ ManList

XrdOucTList * XrdPssSys::ManList = 0
static

Definition at line 194 of file XrdPss.hh.

◆ myHost

const char * XrdPssSys::myHost
static

Definition at line 188 of file XrdPss.hh.

◆ myName

const char * XrdPssSys::myName
static

Definition at line 189 of file XrdPss.hh.

◆ Police

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

Definition at line 193 of file XrdPss.hh.

Referenced by P2DST(), and P2OUT().

◆ PolNum

const int XrdPssSys::PolNum = 2
static

Definition at line 177 of file XrdPss.hh.

◆ protName

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

Definition at line 196 of file XrdPss.hh.

◆ reProxy

bool XrdPssSys::reProxy = false
static

Definition at line 208 of file XrdPss.hh.

Referenced by XrdPssFile::Open().

◆ Streams

int XrdPssSys::Streams =512
static

Definition at line 199 of file XrdPss.hh.

◆ Trace

int XrdPssSys::Trace = 0
static

Definition at line 201 of file XrdPss.hh.

◆ Workers

int XrdPssSys::Workers = 16
static

Definition at line 200 of file XrdPss.hh.

◆ xLfn2Pfn

bool XrdPssSys::xLfn2Pfn = false
static

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

Referenced by XrdPssFile::Open().


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