36 #include <unordered_set>
43 #include "XrdSys/XrdWin32.hh"
49 #include <sys/types.h>
66 #define ENODATA ENOATTR
79 idInfo(
const char *name, time_t keep)
80 : Expr(time(0)+keep), Name(strdup(name)) {}
81 ~idInfo() {free(Name);}
84 typedef std::map<unsigned int, struct idInfo*> idMap_t;
90 void AddID(idMap_t &idMap,
unsigned int id,
const char *name, time_t keepT)
92 std::pair<idMap_t::iterator,bool> ret;
93 idInfo *infoP =
new idInfo(name, keepT);
96 ret = idMap.insert(std::pair<unsigned int, struct idInfo*>(
id, infoP));
97 if (ret.second ==
false)
delete infoP;
101 int LookUp(idMap_t &idMap,
unsigned int id,
char *buff,
int blen)
103 idMap_t::iterator it;
108 if (it != idMap.end())
109 {
if (it->second->Expr <= time(0))
113 if (blen > 0) luRet = snprintf(buff, blen,
"%s", it->second->Name);
132 for (j = 0; j < argC; j++)
133 {
while(*aP ==
' ') aP++;
136 if (*aP ==
'"' || *aP ==
'\'')
138 aP = index(aP+1, *aP);
139 if (!aP || (*(aP+1) !=
' ' && *(aP+1)))
140 {
if (!j) argV[0] = 0;
return -EINVAL;}
144 if ((aP = index(aP+1,
' '))) *aP++ =
'\0';
152 if (j > argC-1)
return -E2BIG;
167 static char hv[] =
"0123456789abcdef";
168 char *outbuff = buff;
169 for (
int i = 0; i < dlen && blen > 2; i++) {
170 *outbuff++ = hv[(inbuff[i] >> 4) & 0x0f];
171 *outbuff++ = hv[ inbuff[i] & 0x0f];
173 if (sep && blen > 1 && ((i & 0x03) == 0x03 || i+1 == dlen))
174 {*outbuff++ =
' '; blen--;}
186 int tlen = strlen(text);
188 return (tlen >= endlen && !strcmp(text+(tlen-endlen), ending));
233 const char *what,
const char *hname,
234 const char *nname,
const char *pname)
236 static const char *brk[] = {
"defined",
"exec",
"named", 0};
243 if (!(val =
Config.GetWord()))
244 {
if (
eDest)
eDest->
Emsg(
"Config",
"Host name missing after 'if' in", what);
250 if (!
is1of(val, brk))
253 }
while(!hostok && val && !
is1of(val, brk));
255 {
while(val && !
is1of(val, brk)) val =
Config.GetWord();
263 while(!strcmp(val,
"defined"))
264 {
if (!(val =
Config.GetWord()) || *val !=
'?')
266 {
eDest->
Emsg(
"Config",
"'?var' missing after 'defined' in",what);}
272 if (!
theEnv && *(val+1) !=
'~')
return 0;
277 while(val && *val ==
'?')
278 {
if (*(val+1) ==
'~' ? getenv(val+2) :
theEnv->
Get(val+1)) isDef=1;
281 if (!val || !isDef)
return isDef;
282 if (strcmp(val,
"&&"))
284 {
eDest->
Emsg(
"Config",val,
"is invalid for defined test in",what);}
287 if (!(val =
Config.GetWord()))
289 {
eDest->
Emsg(
"Config",
"missing keyword after '&&' in",what);}
293 if (!
is1of(val, brk))
295 {
eDest->
Emsg(
"Config",val,
"is invalid after '&&' in",what);}
303 if (!strcmp(val,
"exec"))
304 {
if (!(val =
Config.GetWord()) || !strcmp(val,
"&&"))
306 {
eDest->
Emsg(
"Config",
"Program name missing after 'if exec' in",what);}
312 if (!pname)
return 0;
313 while(val && strcmp(val, pname))
314 if (!strcmp(val,
"&&"))
return 0;
315 else val =
Config.GetWord();
317 while(val && strcmp(val,
"&&")) val =
Config.GetWord();
320 if (!(val =
Config.GetWord()))
322 {
eDest->
Emsg(
"Config",
"Keyword missing after '&&' in",what);}
325 if (strcmp(val,
"named"))
327 {
eDest->
Emsg(
"Config",val,
"is invalid after '&&' in",what);}
335 if (!(val =
Config.GetWord()))
337 {
eDest->
Emsg(
"Config",
"Instance name missing after 'if named' in", what);}
343 if (!nname)
return 0;
344 while(val && strcmp(val, nname)) val =
Config.GetWord();
362 {
if (
stat(pgm, &
Stat) || !(
Stat.st_mode & S_IXOTH))
return false;
369 const char *pEnv = getenv(
"PATH");
370 if (!pEnv)
return false;
376 prog +=
'/'; prog += pgm;
380 while((from = pList.
tokenize(path, from,
':')) != -1)
393 static const long long Kval = 1024LL;
394 static const long long Mval = 1024LL*1024LL;
395 static const long long Gval = 1024LL*1024LL*1024LL;
396 static const long long Tval = 1024LL*1024LL*1024LL*1024LL;
402 if (val < 1024)
return snprintf(buff, bsz,
"%lld", val);
403 if (val < Mval) {val = val*10/Kval; sName =
'K';}
404 else if (val < Gval) {val = val*10/Mval; sName =
'M';}
405 else if (val < Tval) {val = val*10/Gval; sName =
'G';}
406 else {val = val*10/Tval; sName =
'T';}
407 resid = val%10LL; val = val/10LL;
411 return snprintf(buff, bsz,
"%lld.%d%c", val, resid, sName);
422 int i =
strlcpy(buff, p_path,
sizeof(buff));
424 if (buff[i-1] !=
'/') {buff[i++] =
'/'; buff[i] =
'\0';}
425 if (inst) {strcpy(buff+i, inst); strcat(buff,
"/");}
426 if (s_path) strcat(buff, s_path);
429 if (buff[i-1] !=
'/') {buff[i++] =
'/'; buff[i] =
'\0';}
441 j = (psfx ? strlen(psfx) : 0);
442 if (i+j+3 > blen)
return -ENAMETOOLONG;
446 {
if (buff[i-1] !=
'/') buff[i++] =
'/';
447 strcpy(&buff[i], psfx);
448 if (psfx[j-1] !=
'/') strcat(buff,
"/");
463 ~fdHelper() {
if (fd >= 0)
close(fd);}
474 if ((file.fd =
open(path, O_RDONLY)) < 0) {rc = errno;
return 0;}
478 if (
fstat(file.fd, &
Stat)) {rc = errno;
return 0;}
482 if (
Stat.st_size > maxsz) {rc = EFBIG;
return 0;}
486 if (
Stat.st_size == 0 && notempty) {rc =
ENODATA;
return 0;}
490 if ((buff = (
char *)malloc(
Stat.st_size+1)) == 0)
491 {rc = errno;
return 0;}
496 {
if ((flen =
read(file.fd, buff,
Stat.st_size)) < 0)
497 {rc = errno; free(buff);
return 0;}
516 struct group Grp, *result;
519 getgrnam_r(gName, &Grp, buff,
sizeof(buff), &result);
520 if (!result)
return false;
532 struct passwd pwd, *result;
535 getpwnam_r(uName, &pwd, buff,
sizeof(buff), &result);
536 if (!result)
return false;
539 if (gID) *gID = pwd.pw_gid;
550 static const int maxgBsz = 256*1024;
551 static const int addGsz = 4096;
552 struct group *gEnt, gStruct;
553 char gBuff[1024], *gBp = gBuff;
554 int glen = 0, gBsz =
sizeof(gBuff), aOK = 1;
560 {
int n = LookUp(gidMap,
static_cast<unsigned int>(gID),gName,gNsz);
561 if (n > 0)
return (n < gNsz ? n : 0);
567 while(( retVal = getgrgid_r(gID, &gStruct, gBp, gBsz, &gEnt) ) == ERANGE)
568 {
if (gBsz >= maxgBsz) {aOK = 0;
break;}
569 if (gBsz > addGsz) free(gBp);
571 if (!(gBp = (
char *)malloc(gBsz))) {aOK = 0;
break;}
576 if (aOK && retVal == 0 && gEnt != NULL)
578 AddID(gidMap,
static_cast<unsigned int>(gID), gEnt->gr_name, keepT);
579 glen = strlen(gEnt->gr_name);
580 if (glen >= gNsz) glen = 0;
581 else strcpy(gName, gEnt->gr_name);
583 n = snprintf(gName, gNsz,
"%ud",
static_cast<unsigned int>(gID));
584 if (n >= gNsz) glen = 0;
589 if (gBsz > addGsz && gBp) free(gBp);
599 static const int maxgBsz = 256*1024;
600 static const int addGsz = 4096;
601 struct group *gEnt, gStruct;
602 char gBuff[1024], *gBp = gBuff;
603 int glen, gBsz =
sizeof(gBuff), aOK = 1;
609 while(( retVal = getgrgid_r(gID, &gStruct, gBp, gBsz, &gEnt) ) == ERANGE)
610 {
if (gBsz >= maxgBsz) {aOK = 0;
break;}
611 if (gBsz > addGsz) free(gBp);
613 if (!(gBp = (
char *)malloc(gBsz))) {aOK = 0;
break;}
618 if (aOK && retVal == 0 && gEnt != NULL)
619 {glen = strlen(gEnt->gr_name);
620 if (glen >= gNsz) glen = 0;
621 else strcpy(gName, gEnt->gr_name);
626 if (gBsz > addGsz && gBp) free(gBp);
640 {snprintf(buff, bsz,
"%zu", bytes);
646 const char *suffix =
" KMGTPEYZ";
647 double dBytes =
static_cast<double>(bytes);
649 do{dBytes /= 1024.0; suffix++;
650 }
while(dBytes >= 1024.0 && *(suffix+1));
655 double whole, frac = modf(dBytes, &whole);
656 if (frac >= .005) snprintf(buff, bsz,
"%.02lf%c", dBytes, *suffix);
657 else snprintf(buff, bsz,
"%g%c", whole, *suffix);
667 char zo[2] = {
'0',
'1'};
669 if (blen < 2)
return "";
672 if (!val) buff[blen--] =
'0';
673 else while(val && blen >= 0)
674 {buff[blen--] = zo[val & 0x01];
678 if (blen >= 0 && pad)
while(blen >= 0) buff[blen--] =
'0';
680 return &buff[blen+1];
689 long long genSID(
char *&urSID,
const char *iHost,
int iPort,
690 const char *iName,
const char *iProg)
693 static const uint32_t fpOffs = 2, fpSize = 6;
695 const char *iSite = getenv(
"XRDSITE");
696 unsigned char mDigest[mdLen];
698 union {uint64_t mdLL;
unsigned char mdUC[8];};
702 if (iSite) myID = iSite;
705 if (iName) myID += iName;
710 memset(mDigest, 0,
sizeof(mDigest));
720 uint64_t fpPos =
crc32c % (((uint32_t)mdLen) - fpSize);
722 memcpy(mdUC+fpOffs, mDigest+fpPos, fpSize);
723 long long fpVal =
static_cast<long long>(ntohll(mdLL));
728 snprintf(fpBuff,
sizeof(fpBuff),
"%lld", fpVal);
729 urSID = strdup(fpBuff);
735 const char *iHost,
const char *iProg,
736 const char *iName,
int iPort)
739 static long long theSID = genSID(theSIN, iHost, iPort, iName, iProg);
740 const char *sP = getenv(
"XRDSITE");
742 int myPid =
static_cast<int>(getpid());
746 if (
UserName(getuid(), uName,
sizeof(uName)))
747 sprintf(uName,
"%d",
static_cast<int>(getuid()));
751 snprintf(iBuff,iBlen,
"%s.%d:%s@%s\n&site=%s&port=%d&inst=%s&pgm=%s",
752 uName, myPid, theSIN, iHost, (sP ? sP :
""), iPort, iName, iProg);
756 h2nll(theSID,
mySID);
757 return strdup(theSIN);
766 const char *iName = getenv(
"XRDNAME");
770 if (!TranOpt)
return iName;
775 if (TranOpt > 0) {
if (!iName || !*iName) iName =
"anon";}
776 else if (iName && !strcmp(iName,
"anon")) iName = 0;
782 {
return (Fillit ? name && *name ? name :
"anon"
783 : name && strcmp(name,
"anon") && *name ? name : 0);
793 while(clist[i])
if (!strcmp(val, clist[i]))
return 1;
805 const char *hName, *hNend, *hPort, *hPend, *hP = path;
809 if (*path ==
'/') hP++;
810 if (*hP ==
'x') hP++;
811 if (strncmp(
"root:/", hP, 6))
return 0;
812 if (hBuff == 0 || hBLen <= 0)
return (hP - path) + 6;
816 if (*hNend ==
']') hNend++;
817 else {
if (!(*hNend) && !(hNend = index(hName,
'/')))
return 0;
818 if (!(*hPend)) hPend = hNend;
821 if (pTrim || !(*hPort)) n = hNend - hP;
823 if (n >= hBLen)
return 0;
824 strncpy(hBuff, hP, n);
828 {
if (*hNend !=
':') *port = 0;
829 else {*port = strtol(hPort, &eP, 10);
830 if (*port < 0 || *port > 65535 || eP != hPend)
return 0;
854 #define SHFT(k) if (n >= (1ULL << k)) { i += k; n >>= k; }
869 #define SHFT(k, m) if (n >= m) { i += k; n /= m; }
871 SHFT(16,10000000000000000ULL);
SHFT(8,100000000ULL);
886 if (!inst || !getcwd(buff,
sizeof(buff)))
return;
888 strcat(buff,
"/"); strcat(buff, inst);
890 {
eDest.
Emsg(
"Config", errno,
"create home directory", buff);
895 eDest.
Emsg(
"Config", errno,
"chdir to home directory", buff);
901 const char *path, mode_t mode)
904 const char *slash =
"", *slash2 =
"";
910 if (!path || !(n = strlen(path)))
917 if (path[n-1] !=
'/') slash =
"/";
918 if (!inst || !(n = strlen(inst))) inst =
"";
920 n = snprintf(cwDir,
sizeof(cwDir),
"%s%s%s%s", path, slash, inst, slash2);
921 if (n >= (
int)
sizeof(cwDir))
922 {
eDest.
Emsg(
"Config", ENAMETOOLONG,
"create home directory", cwDir);
928 if ((rc =
makePath(cwDir, mode,
true)))
929 {
eDest.
Emsg(
"Config", rc,
"create home directory", cwDir);
935 if (
chdir(cwDir) < 0)
936 {
eDest.
Emsg(
"Config", errno,
"chdir to home directory", cwDir);
951 char *next_path = path+1;
953 bool dochmod =
false;
957 if (!reset && !
stat(path, &buf))
return 0;
961 while((next_path = index(next_path,
int(
'/'))))
964 if (errno != EEXIST)
return -errno;
965 if (dochmod)
CHMOD(path, mode);
968 next_path = next_path+1;
982 mode_t mval[3] = {0}, mbit[3] = {0x04, 0x02, 0x01};
983 const char *mok =
"rwx";
990 mask = strtol(mode, &eP, 8);
996 int n = strlen(mode);
997 if (!n || n > 9 || n/3*3 != n)
return false;
1002 do {
for (
int i = 0; i < 3; i++)
1005 {
if (mlet != mok[i])
return false;
1009 }
while(++k < 3 && *mode);
1013 mask = mval[0]<<6 | mval[1]<<3 | mval[2];
1022 const char *libName,
char *&libPath,
char **libParm)
1024 char *val, parms[2048];
1032 if (val && !strcmp(
"++", val))
1033 {
eDest.
Say(
"Config warning: stacked plugins are not supported in "
1034 "this context; directive ignored!");
1040 while(val && *val && *val ==
'+') val =
Config.GetWord();
1044 if (!val || !val[0])
1045 {
eDest.
Emsg(
"Config", libName,
"not specified");
return false;}
1049 if (libPath) free(libPath);
1050 libPath = strdup(val);
1054 if (!libParm)
return true;
1055 if (*libParm) free(*libParm);
1061 if (!
Config.GetRest(parms,
sizeof(parms)))
1062 {
eDest.
Emsg(
"Config", libName,
"parameters too long");
return false;}
1063 if (*parms) *libParm = strdup(parms);
1073 char *pval, *val, *HomePath = 0;
1078 if (!pval || !pval[0])
1079 {
eDest.
Emsg(
"Config",
"home path not specified");
return 0;}
1084 {
eDest.
Emsg(
"Config",
"home path not absolute");
return 0;}
1088 HomePath = strdup(pval);
1093 if ((val =
Config.GetWord()) && val[0])
1094 {
if (!strcmp(
"group", val)) mode |= (S_IRGRP | S_IXGRP);
1095 else {
eDest.
Emsg(
"Config",
"invalid home path modifier -", val);
1109 const mode_t AMode = S_IRWXU;
1110 char pbuff[MAXPATHLEN+64];
1116 if (n >= (
int)
sizeof(pbuff))
return ENAMETOOLONG;
1117 strcpy(pbuff, path);
1122 makePath(pbuff, (mode ? mode : AMode));
1123 if (symlink(target, path))
return errno;
1138 {
if (*str ==
'-') *str = subc;
1139 else if (*str ==
' ') *str = subc;
1140 char *blank = rindex(str,
' ');
1141 if (blank)
while(*blank ==
' ') *blank-- = 0;
1143 {
if (!isalnum(*str) && index(
"_-.", *str) == 0) *str = subc;
1155 const mode_t lfm = S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH;
1156 char buff[2048], *sp;
1159 if (!inst || !*inst)
return logfn;
1160 if (!(sp = rindex(logfn,
'/'))) strcpy(buff,
"./");
1161 else {*sp =
'\0'; strcpy(buff, logfn); strcat(buff,
"/");}
1163 strcat(buff, inst); strcat(buff,
"/");
1166 {
eDest.
Emsg(
"Config", rc,
"create log file path", buff);
1170 if (sp) {*sp =
'/'; strcat(buff, sp+1);}
1171 else strcat(buff, logfn);
1174 return strdup(buff);
1183 unsigned char* ustr = (
unsigned char*)str;
1187 while(*ustr) {*ustr = tolower(*ustr); ustr++;}
1196 const char *eP, *bP = *str;
1201 while(*bP && *bP == delim) bP++;
1202 if (*bP == 0) {*buff = 0;
return 0;}
1207 while(*eP && *eP != delim) eP++;
1211 if (*eP == 0) *str = eP;
1217 if (aLen >= bsz) mLen = bsz-1;
1222 strncpy(buff, bP, mLen);
1246 if (noLog)
eDest.
Emsg(
"Config",
"Warning! No log file specified; "
1247 "backgrounding disables all logging!");
1251 if ((mypid = fork()) < 0)
1252 {
eDest.
Emsg(
"Config", errno,
"fork process 1 for backgrounding");
1266 if(
read( pipeFD[0], &status,
sizeof(status) ) !=
sizeof(status) )
1280 {
eDest.
Emsg(
"Config", errno,
"doing setsid() for backgrounding");
1286 if ((mypid = fork()) < 0)
1287 {
eDest.
Emsg(
"Config", errno,
"fork process 2 for backgrounding");
1290 else if (mypid) _exit(0);
1295 if ((myfd =
open(
"/dev/null", O_RDWR)) < 0)
1296 {
eDest.
Emsg(
"Config", errno,
"open /dev/null for backgrounding");
1299 dup2(myfd, 0); dup2(myfd, 1); dup2(myfd, 2); dup2(myfd, logFD);
1304 for (myfd = 3; myfd <
maxFiles; myfd++)
1305 if( (!pipeFD || myfd != pipeFD[1]) && myfd != logFD )
close(myfd);
1314 struct passwd *pEnt, pStruct;
1321 {
int n = LookUp(uidMap,
static_cast<unsigned int>(uID),uName,uNsz);
1322 if (n > 0)
return (n < uNsz ? n : 0);
1328 rc = getpwuid_r(uID, &pStruct, pBuff,
sizeof(pBuff), &pEnt);
1330 {n = snprintf(uName, uNsz,
"%ud",
static_cast<unsigned int>(uID));
1331 return (n >= uNsz ? 0 : n);
1337 AddID(uidMap,
static_cast<unsigned int>(uID), pEnt->pw_name, keepT);
1341 n = strlen(pEnt->pw_name);
1342 if (uNsz <= (
int)strlen(pEnt->pw_name))
return 0;
1343 strcpy(uName, pEnt->pw_name);
1353 struct passwd *pEnt, pStruct;
1360 rc = getpwuid_r(uID, &pStruct, pBuff,
sizeof(pBuff), &pEnt);
1362 if (!pEnt)
return ESRCH;
1366 if (uNsz <= (
int)strlen(pEnt->pw_name))
return ENAMETOOLONG;
1367 strcpy(uName, pEnt->pw_name);
1377 static const mode_t mMask = S_IRWXU | S_IRWXG | S_IRWXO;
1382 if (
stat(path, &buf))
1383 {
if (errno == ENOENT)
return "does not exist.";
1390 {
if (!S_ISDIR(buf.st_mode))
return "is not a directory.";
1392 if (!S_ISREG(buf.st_mode))
return "is not a file.";
1397 if ((buf.st_mode & mMask) & ~allow)
return "has excessive access rights.";
1413 if( (fd =
open( path, O_WRONLY|O_CREAT|O_TRUNC, 0644 )) < 0 )
1415 eDest.
Emsg(
"Config", errno,
"create pidfile" );
1419 if(
write( fd, buff, snprintf( buff,
sizeof(buff),
"%d",
1420 static_cast<int>(getpid()) ) ) < 0 )
1422 eDest.
Emsg(
"Config", errno,
"write to pidfile" );
1435 int statRet =
::stat(path,&buf);
1437 modificationTime = buf.st_mtime;
1444 while( str.size() && !isgraph(str[0]) ) str.erase(str.begin());
1448 while( str.size() && !isgraph(str[str.size()-1]) )
1449 str.resize (str.size () - 1);
1462 static constexpr
char token_chars[] =
"-._~+/=:";
1464 for (
char ch : token_chars)
1481 static const regex_t auth_regex = []() {
1482 constexpr
char re[] =
1483 "(access_token=|authz=|(transferheader)?(www-|proxy-)?auth(orization|enticate)[[:space:]]*:[[:space:]]*)"
1484 "(Bearer([[:space:]]|%20)?(token([[:space:]]|%20)?)?)?";
1488 if (regcomp(®ex, re, REG_EXTENDED | REG_ICASE) != 0)
1489 throw std::runtime_error(
"Failed to compile regular expression");
1496 std::string redacted;
1497 const char *
const text = input.c_str();
1499 while (regexec(&auth_regex, text + offset, 1, &match, 0) == 0) {
1500 redacted.append(text + offset, match.rm_eo).append(
"REDACTED");
1502 offset += match.rm_eo;
1508 return redacted.append(text + offset);
static XrdSysError eDest(0,"crypto_")
uint32_t crc32c(uint32_t crc, void const *buf, size_t len)
static bool is_token_character(int c)
std::string obfuscateAuth(const std::string &input)
int stat(const char *path, struct stat *buf)
int open(const char *path, int oflag,...)
int fstat(int fildes, struct stat *buf)
int chdir(const char *path)
int unlink(const char *path)
ssize_t write(int fildes, const void *buf, size_t nbyte)
ssize_t read(int fildes, void *buf, size_t nbyte)
const char * XrdSysE2T(int errcode)
static bool Match(const char *hName, const char *pattern)
static bool Parse(const char *hSpec, const char **hName, const char **hNend, const char **hPort, const char **hPend)
static uint32_t Calc32C(const void *data, size_t count, uint32_t prevcs=0)
char * Get(const char *varname)
MDLen
SHA3 digest lengths (bits to bytes).
static void * Calc(const void *in, size_t inlen, void *md, MDLen mdlen)
const char * c_str() const
int tokenize(XrdOucString &tok, int from, char del=':')
static char * parseHome(XrdSysError &eDest, XrdOucStream &Config, int &mode)
static void Sanitize(char *instr, char subc='_')
static bool getGID(const char *gName, gid_t &gID)
static const mode_t pathMode
static const char * HSize(size_t bytes, char *buff, int bsz)
static int isFWD(const char *path, int *port=0, char *hBuff=0, int hBLen=0, bool pTrim=false)
static int UserName(uid_t uID, char *uName, int uNsz)
static char * Ident(long long &mySID, char *iBuff, int iBlen, const char *iHost, const char *iProg, const char *iName, int Port)
static bool getUID(const char *uName, uid_t &uID, gid_t *gID=0)
static int getModificationTime(const char *path, time_t &modificationTime)
static const char * ValPath(const char *path, mode_t allow, bool isdir)
static char * genPath(const char *path, const char *inst, const char *psfx=0)
static int Token(const char **str, char delim, char *buff, int bsz)
static int ReLink(const char *path, const char *target, mode_t mode=0)
static bool parseLib(XrdSysError &eDest, XrdOucStream &Config, const char *libName, char *&path, char **libparm)
static int is1of(char *val, const char **clist)
static const char * InstName(int TranOpt=0)
static char * eText(int rc, char *eBuff, int eBlen)
static int argList(char *args, char **argV, int argC)
static bool mode2mask(const char *mode, mode_t &mask)
static int GidName(gid_t gID, char *gName, int gNsz, time_t keepT=0)
static int UidName(uid_t uID, char *uName, int uNsz, time_t keepT=0)
static char * bin2hex(char *inbuff, int dlen, char *buff, int blen, bool sep=true)
static int Log10(unsigned long long n)
static int doIf(XrdSysError *eDest, XrdOucStream &Config, const char *what, const char *hname, const char *nname, const char *pname)
static int makePath(char *path, mode_t mode, bool reset=false)
static int GroupName(gid_t gID, char *gName, int gNsz)
static void trim(std::string &str)
static bool findPgm(const char *pgm, XrdOucString &path)
static bool PidFile(XrdSysError &eDest, const char *path)
static const char * i2bstr(char *buff, int blen, int val, bool pad=false)
static void toLower(char *str)
static int fmtBytes(long long val, char *buff, int bsz)
static int Log2(unsigned long long n)
static void makeHome(XrdSysError &eDest, const char *inst)
static bool endsWith(const char *text, const char *ending, int endlen)
static void Undercover(XrdSysError &eDest, int noLog, int *pipeFD=0)
static char * getFile(const char *path, int &rc, int maxsz=10240, bool notempty=true)
static char * subLogfn(XrdSysError &eDest, const char *inst, char *logfn)
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)