36 #include <unordered_set>
43 #include "XrdSys/XrdWin32.hh"
48 #include <sys/types.h>
65 #define ENODATA ENOATTR
78 idInfo(
const char *name, time_t keep)
79 : Expr(time(0)+keep), Name(strdup(name)) {}
80 ~idInfo() {free(Name);}
83 typedef std::map<unsigned int, struct idInfo*> idMap_t;
89 void AddID(idMap_t &idMap,
unsigned int id,
const char *name, time_t keepT)
91 std::pair<idMap_t::iterator,bool> ret;
92 idInfo *infoP =
new idInfo(name, keepT);
95 ret = idMap.insert(std::pair<unsigned int, struct idInfo*>(
id, infoP));
96 if (ret.second ==
false)
delete infoP;
100 int LookUp(idMap_t &idMap,
unsigned int id,
char *buff,
int blen)
102 idMap_t::iterator it;
107 if (it != idMap.end())
108 {
if (it->second->Expr <= time(0))
112 if (blen > 0) luRet = snprintf(buff, blen,
"%s", it->second->Name);
131 for (j = 0; j < argC; j++)
132 {
while(*aP ==
' ') aP++;
135 if (*aP ==
'"' || *aP ==
'\'')
137 aP = index(aP+1, *aP);
138 if (!aP || (*(aP+1) !=
' ' && *(aP+1)))
139 {
if (!j) argV[0] = 0;
return -EINVAL;}
143 if ((aP = index(aP+1,
' '))) *aP++ =
'\0';
151 if (j > argC-1)
return -E2BIG;
166 static char hv[] =
"0123456789abcdef";
167 char *outbuff = buff;
168 for (
int i = 0; i < dlen && blen > 2; i++) {
169 *outbuff++ = hv[(inbuff[i] >> 4) & 0x0f];
170 *outbuff++ = hv[ inbuff[i] & 0x0f];
172 if (sep && blen > 1 && ((i & 0x03) == 0x03 || i+1 == dlen))
173 {*outbuff++ =
' '; blen--;}
185 int tlen = strlen(text);
187 return (tlen >= endlen && !strcmp(text+(tlen-endlen), ending));
232 const char *what,
const char *hname,
233 const char *nname,
const char *pname)
235 static const char *brk[] = {
"defined",
"exec",
"named", 0};
242 if (!(val =
Config.GetWord()))
243 {
if (
eDest)
eDest->
Emsg(
"Config",
"Host name missing after 'if' in", what);
249 if (!
is1of(val, brk))
252 }
while(!hostok && val && !
is1of(val, brk));
254 {
while(val && !
is1of(val, brk)) val =
Config.GetWord();
262 while(!strcmp(val,
"defined"))
263 {
if (!(val =
Config.GetWord()) || *val !=
'?')
265 {
eDest->
Emsg(
"Config",
"'?var' missing after 'defined' in",what);}
271 if (!
theEnv && *(val+1) !=
'~')
return 0;
276 while(val && *val ==
'?')
277 {
if (*(val+1) ==
'~' ? getenv(val+2) :
theEnv->
Get(val+1)) isDef=1;
280 if (!val || !isDef)
return isDef;
281 if (strcmp(val,
"&&"))
283 {
eDest->
Emsg(
"Config",val,
"is invalid for defined test in",what);}
286 if (!(val =
Config.GetWord()))
288 {
eDest->
Emsg(
"Config",
"missing keyword after '&&' in",what);}
292 if (!
is1of(val, brk))
294 {
eDest->
Emsg(
"Config",val,
"is invalid after '&&' in",what);}
302 if (!strcmp(val,
"exec"))
303 {
if (!(val =
Config.GetWord()) || !strcmp(val,
"&&"))
305 {
eDest->
Emsg(
"Config",
"Program name missing after 'if exec' in",what);}
311 if (!pname)
return 0;
312 while(val && strcmp(val, pname))
313 if (!strcmp(val,
"&&"))
return 0;
314 else val =
Config.GetWord();
316 while(val && strcmp(val,
"&&")) val =
Config.GetWord();
319 if (!(val =
Config.GetWord()))
321 {
eDest->
Emsg(
"Config",
"Keyword missing after '&&' in",what);}
324 if (strcmp(val,
"named"))
326 {
eDest->
Emsg(
"Config",val,
"is invalid after '&&' in",what);}
334 if (!(val =
Config.GetWord()))
336 {
eDest->
Emsg(
"Config",
"Instance name missing after 'if named' in", what);}
342 if (!nname)
return 0;
343 while(val && strcmp(val, nname)) val =
Config.GetWord();
361 {
if (
stat(pgm, &
Stat) || !(
Stat.st_mode & S_IXOTH))
return false;
368 const char *pEnv = getenv(
"PATH");
369 if (!pEnv)
return false;
375 prog +=
'/'; prog += pgm;
379 while((from = pList.
tokenize(path, from,
':')) != -1)
392 static const long long Kval = 1024LL;
393 static const long long Mval = 1024LL*1024LL;
394 static const long long Gval = 1024LL*1024LL*1024LL;
395 static const long long Tval = 1024LL*1024LL*1024LL*1024LL;
401 if (val < 1024)
return snprintf(buff, bsz,
"%lld", val);
402 if (val < Mval) {val = val*10/Kval; sName =
'K';}
403 else if (val < Gval) {val = val*10/Mval; sName =
'M';}
404 else if (val < Tval) {val = val*10/Gval; sName =
'G';}
405 else {val = val*10/Tval; sName =
'T';}
406 resid = val%10LL; val = val/10LL;
410 return snprintf(buff, bsz,
"%lld.%d%c", val, resid, sName);
421 int i =
strlcpy(buff, p_path,
sizeof(buff));
423 if (buff[i-1] !=
'/') {buff[i++] =
'/'; buff[i] =
'\0';}
424 if (inst) {strcpy(buff+i, inst); strcat(buff,
"/");}
425 if (s_path) strcat(buff, s_path);
428 if (buff[i-1] !=
'/') {buff[i++] =
'/'; buff[i] =
'\0';}
440 j = (psfx ? strlen(psfx) : 0);
441 if (i+j+3 > blen)
return -ENAMETOOLONG;
445 {
if (buff[i-1] !=
'/') buff[i++] =
'/';
446 strcpy(&buff[i], psfx);
447 if (psfx[j-1] !=
'/') strcat(buff,
"/");
462 ~fdHelper() {
if (fd >= 0)
close(fd);}
473 if ((file.fd =
open(path, O_RDONLY)) < 0) {rc = errno;
return 0;}
477 if (
fstat(file.fd, &
Stat)) {rc = errno;
return 0;}
481 if (
Stat.st_size > maxsz) {rc = EFBIG;
return 0;}
485 if (
Stat.st_size == 0 && notempty) {rc =
ENODATA;
return 0;}
489 if ((buff = (
char *)malloc(
Stat.st_size+1)) == 0)
490 {rc = errno;
return 0;}
495 {
if ((flen =
read(file.fd, buff,
Stat.st_size)) < 0)
496 {rc = errno; free(buff);
return 0;}
515 struct group Grp, *result;
518 getgrnam_r(gName, &Grp, buff,
sizeof(buff), &result);
519 if (!result)
return false;
531 struct passwd pwd, *result;
534 getpwnam_r(uName, &pwd, buff,
sizeof(buff), &result);
535 if (!result)
return false;
538 if (gID) *gID = pwd.pw_gid;
549 static const int maxgBsz = 256*1024;
550 static const int addGsz = 4096;
551 struct group *gEnt, gStruct;
552 char gBuff[1024], *gBp = gBuff;
553 int glen = 0, gBsz =
sizeof(gBuff), aOK = 1;
559 {
int n = LookUp(gidMap,
static_cast<unsigned int>(gID),gName,gNsz);
560 if (n > 0)
return (n < gNsz ? n : 0);
566 while(( retVal = getgrgid_r(gID, &gStruct, gBp, gBsz, &gEnt) ) == ERANGE)
567 {
if (gBsz >= maxgBsz) {aOK = 0;
break;}
568 if (gBsz > addGsz) free(gBp);
570 if (!(gBp = (
char *)malloc(gBsz))) {aOK = 0;
break;}
575 if (aOK && retVal == 0 && gEnt != NULL)
577 AddID(gidMap,
static_cast<unsigned int>(gID), gEnt->gr_name, keepT);
578 glen = strlen(gEnt->gr_name);
579 if (glen >= gNsz) glen = 0;
580 else strcpy(gName, gEnt->gr_name);
582 n = snprintf(gName, gNsz,
"%ud",
static_cast<unsigned int>(gID));
583 if (n >= gNsz) glen = 0;
588 if (gBsz > addGsz && gBp) free(gBp);
598 static const int maxgBsz = 256*1024;
599 static const int addGsz = 4096;
600 struct group *gEnt, gStruct;
601 char gBuff[1024], *gBp = gBuff;
602 int glen, gBsz =
sizeof(gBuff), aOK = 1;
608 while(( retVal = getgrgid_r(gID, &gStruct, gBp, gBsz, &gEnt) ) == ERANGE)
609 {
if (gBsz >= maxgBsz) {aOK = 0;
break;}
610 if (gBsz > addGsz) free(gBp);
612 if (!(gBp = (
char *)malloc(gBsz))) {aOK = 0;
break;}
617 if (aOK && retVal == 0 && gEnt != NULL)
618 {glen = strlen(gEnt->gr_name);
619 if (glen >= gNsz) glen = 0;
620 else strcpy(gName, gEnt->gr_name);
625 if (gBsz > addGsz && gBp) free(gBp);
635 char zo[2] = {
'0',
'1'};
637 if (blen < 2)
return "";
640 if (!val) buff[blen--] =
'0';
641 else while(val && blen >= 0)
642 {buff[blen--] = zo[val & 0x01];
646 if (blen >= 0 && pad)
while(blen >= 0) buff[blen--] =
'0';
648 return &buff[blen+1];
657 long long genSID(
char *&urSID,
const char *iHost,
int iPort,
658 const char *iName,
const char *iProg)
661 static const uint32_t fpOffs = 2, fpSize = 6;
663 const char *iSite = getenv(
"XRDSITE");
664 unsigned char mDigest[mdLen];
666 union {uint64_t mdLL;
unsigned char mdUC[8];};
670 if (iSite) myID = iSite;
673 if (iName) myID += iName;
678 memset(mDigest, 0,
sizeof(mDigest));
688 uint64_t fpPos =
crc32c % (((uint32_t)mdLen) - fpSize);
690 memcpy(mdUC+fpOffs, mDigest+fpPos, fpSize);
691 long long fpVal =
static_cast<long long>(ntohll(mdLL));
696 snprintf(fpBuff,
sizeof(fpBuff),
"%lld", fpVal);
697 urSID = strdup(fpBuff);
703 const char *iHost,
const char *iProg,
704 const char *iName,
int iPort)
707 static long long theSID = genSID(theSIN, iHost, iPort, iName, iProg);
708 const char *sP = getenv(
"XRDSITE");
710 int myPid =
static_cast<int>(getpid());
714 if (
UserName(getuid(), uName,
sizeof(uName)))
715 sprintf(uName,
"%d",
static_cast<int>(getuid()));
719 snprintf(iBuff,iBlen,
"%s.%d:%s@%s\n&site=%s&port=%d&inst=%s&pgm=%s",
720 uName, myPid, theSIN, iHost, (sP ? sP :
""), iPort, iName, iProg);
724 h2nll(theSID,
mySID);
725 return strdup(theSIN);
734 const char *iName = getenv(
"XRDNAME");
738 if (!TranOpt)
return iName;
743 if (TranOpt > 0) {
if (!iName || !*iName) iName =
"anon";}
744 else if (iName && !strcmp(iName,
"anon")) iName = 0;
750 {
return (Fillit ? name && *name ? name :
"anon"
751 : name && strcmp(name,
"anon") && *name ? name : 0);
761 while(clist[i])
if (!strcmp(val, clist[i]))
return 1;
773 const char *hName, *hNend, *hPort, *hPend, *hP = path;
777 if (*path ==
'/') hP++;
778 if (*hP ==
'x') hP++;
779 if (strncmp(
"root:/", hP, 6))
return 0;
780 if (hBuff == 0 || hBLen <= 0)
return (hP - path) + 6;
784 if (*hNend ==
']') hNend++;
785 else {
if (!(*hNend) && !(hNend = index(hName,
'/')))
return 0;
786 if (!(*hPend)) hPend = hNend;
789 if (pTrim || !(*hPort)) n = hNend - hP;
791 if (n >= hBLen)
return 0;
792 strncpy(hBuff, hP, n);
796 {
if (*hNend !=
':') *port = 0;
797 else {*port = strtol(hPort, &eP, 10);
798 if (*port < 0 || *port > 65535 || eP != hPend)
return 0;
822 #define SHFT(k) if (n >= (1ULL << k)) { i += k; n >>= k; }
837 #define SHFT(k, m) if (n >= m) { i += k; n /= m; }
839 SHFT(16,10000000000000000ULL);
SHFT(8,100000000ULL);
854 if (!inst || !getcwd(buff,
sizeof(buff)))
return;
856 strcat(buff,
"/"); strcat(buff, inst);
858 {
eDest.
Emsg(
"Config", errno,
"create home directory", buff);
863 eDest.
Emsg(
"Config", errno,
"chdir to home directory", buff);
869 const char *path, mode_t mode)
872 const char *slash =
"", *slash2 =
"";
878 if (!path || !(n = strlen(path)))
885 if (path[n-1] !=
'/') slash =
"/";
886 if (!inst || !(n = strlen(inst))) inst =
"";
888 n = snprintf(cwDir,
sizeof(cwDir),
"%s%s%s%s", path, slash, inst, slash2);
889 if (n >= (
int)
sizeof(cwDir))
890 {
eDest.
Emsg(
"Config", ENAMETOOLONG,
"create home directory", cwDir);
896 if ((rc =
makePath(cwDir, mode,
true)))
897 {
eDest.
Emsg(
"Config", rc,
"create home directory", cwDir);
903 if (
chdir(cwDir) < 0)
904 {
eDest.
Emsg(
"Config", errno,
"chdir to home directory", cwDir);
919 char *next_path = path+1;
921 bool dochmod =
false;
925 if (!reset && !
stat(path, &buf))
return 0;
929 while((next_path = index(next_path,
int(
'/'))))
932 if (errno != EEXIST)
return -errno;
933 if (dochmod)
CHMOD(path, mode);
936 next_path = next_path+1;
950 mode_t mval[3] = {0}, mbit[3] = {0x04, 0x02, 0x01};
951 const char *mok =
"rwx";
958 mask = strtol(mode, &eP, 8);
964 int n = strlen(mode);
965 if (!n || n > 9 || n/3*3 != n)
return false;
970 do {
for (
int i = 0; i < 3; i++)
973 {
if (mlet != mok[i])
return false;
977 }
while(++k < 3 && *mode);
981 mask = mval[0]<<6 | mval[1]<<3 | mval[2];
990 const char *libName,
char *&libPath,
char **libParm)
992 char *val, parms[2048];
1000 if (val && !strcmp(
"++", val))
1001 {
eDest.
Say(
"Config warning: stacked plugins are not supported in "
1002 "this context; directive ignored!");
1008 while(val && *val && *val ==
'+') val =
Config.GetWord();
1012 if (!val || !val[0])
1013 {
eDest.
Emsg(
"Config", libName,
"not specified");
return false;}
1017 if (libPath) free(libPath);
1018 libPath = strdup(val);
1022 if (!libParm)
return true;
1023 if (*libParm) free(*libParm);
1029 if (!
Config.GetRest(parms,
sizeof(parms)))
1030 {
eDest.
Emsg(
"Config", libName,
"parameters too long");
return false;}
1031 if (*parms) *libParm = strdup(parms);
1041 char *pval, *val, *HomePath = 0;
1046 if (!pval || !pval[0])
1047 {
eDest.
Emsg(
"Config",
"home path not specified");
return 0;}
1052 {
eDest.
Emsg(
"Config",
"home path not absolute");
return 0;}
1056 HomePath = strdup(pval);
1061 if ((val =
Config.GetWord()) && val[0])
1062 {
if (!strcmp(
"group", val)) mode |= (S_IRGRP | S_IXGRP);
1063 else {
eDest.
Emsg(
"Config",
"invalid home path modifier -", val);
1077 const mode_t AMode = S_IRWXU;
1078 char pbuff[MAXPATHLEN+64];
1084 if (n >= (
int)
sizeof(pbuff))
return ENAMETOOLONG;
1085 strcpy(pbuff, path);
1090 makePath(pbuff, (mode ? mode : AMode));
1091 if (symlink(target, path))
return errno;
1106 {
if (*str ==
'-') *str = subc;
1107 else if (*str ==
' ') *str = subc;
1108 char *blank = rindex(str,
' ');
1109 if (blank)
while(*blank ==
' ') *blank-- = 0;
1111 {
if (!isalnum(*str) && index(
"_-.", *str) == 0) *str = subc;
1123 const mode_t lfm = S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH;
1124 char buff[2048], *sp;
1127 if (!inst || !*inst)
return logfn;
1128 if (!(sp = rindex(logfn,
'/'))) strcpy(buff,
"./");
1129 else {*sp =
'\0'; strcpy(buff, logfn); strcat(buff,
"/");}
1131 strcat(buff, inst); strcat(buff,
"/");
1134 {
eDest.
Emsg(
"Config", rc,
"create log file path", buff);
1138 if (sp) {*sp =
'/'; strcat(buff, sp+1);}
1139 else strcat(buff, logfn);
1142 return strdup(buff);
1151 unsigned char* ustr = (
unsigned char*)str;
1155 while(*ustr) {*ustr = tolower(*ustr); ustr++;}
1164 const char *eP, *bP = *str;
1169 while(*bP && *bP == delim) bP++;
1170 if (*bP == 0) {*buff = 0;
return 0;}
1175 while(*eP && *eP != delim) eP++;
1179 if (*eP == 0) *str = eP;
1185 if (aLen >= bsz) mLen = bsz-1;
1190 strncpy(buff, bP, mLen);
1214 if (noLog)
eDest.
Emsg(
"Config",
"Warning! No log file specified; "
1215 "backgrounding disables all logging!");
1219 if ((mypid = fork()) < 0)
1220 {
eDest.
Emsg(
"Config", errno,
"fork process 1 for backgrounding");
1234 if(
read( pipeFD[0], &status,
sizeof(status) ) !=
sizeof(status) )
1248 {
eDest.
Emsg(
"Config", errno,
"doing setsid() for backgrounding");
1254 if ((mypid = fork()) < 0)
1255 {
eDest.
Emsg(
"Config", errno,
"fork process 2 for backgrounding");
1258 else if (mypid) _exit(0);
1263 if ((myfd =
open(
"/dev/null", O_RDWR)) < 0)
1264 {
eDest.
Emsg(
"Config", errno,
"open /dev/null for backgrounding");
1267 dup2(myfd, 0); dup2(myfd, 1); dup2(myfd, 2); dup2(myfd, logFD);
1272 for (myfd = 3; myfd <
maxFiles; myfd++)
1273 if( (!pipeFD || myfd != pipeFD[1]) && myfd != logFD )
close(myfd);
1282 struct passwd *pEnt, pStruct;
1289 {
int n = LookUp(uidMap,
static_cast<unsigned int>(uID),uName,uNsz);
1290 if (n > 0)
return (n < uNsz ? n : 0);
1296 rc = getpwuid_r(uID, &pStruct, pBuff,
sizeof(pBuff), &pEnt);
1298 {n = snprintf(uName, uNsz,
"%ud",
static_cast<unsigned int>(uID));
1299 return (n >= uNsz ? 0 : n);
1305 AddID(uidMap,
static_cast<unsigned int>(uID), pEnt->pw_name, keepT);
1309 n = strlen(pEnt->pw_name);
1310 if (uNsz <= (
int)strlen(pEnt->pw_name))
return 0;
1311 strcpy(uName, pEnt->pw_name);
1321 struct passwd *pEnt, pStruct;
1328 rc = getpwuid_r(uID, &pStruct, pBuff,
sizeof(pBuff), &pEnt);
1330 if (!pEnt)
return ESRCH;
1334 if (uNsz <= (
int)strlen(pEnt->pw_name))
return ENAMETOOLONG;
1335 strcpy(uName, pEnt->pw_name);
1345 static const mode_t mMask = S_IRWXU | S_IRWXG | S_IRWXO;
1350 if (
stat(path, &buf))
1351 {
if (errno == ENOENT)
return "does not exist.";
1358 {
if (!S_ISDIR(buf.st_mode))
return "is not a directory.";
1360 if (!S_ISREG(buf.st_mode))
return "is not a file.";
1365 if ((buf.st_mode & mMask) & ~allow)
return "has excessive access rights.";
1381 if( (fd =
open( path, O_WRONLY|O_CREAT|O_TRUNC, 0644 )) < 0 )
1383 eDest.
Emsg(
"Config", errno,
"create pidfile" );
1387 if(
write( fd, buff, snprintf( buff,
sizeof(buff),
"%d",
1388 static_cast<int>(getpid()) ) ) < 0 )
1390 eDest.
Emsg(
"Config", errno,
"write to pidfile" );
1403 int statRet =
::stat(path,&buf);
1405 modificationTime = buf.st_mtime;
1412 while( str.size() && !isgraph(str[0]) ) str.erase(str.begin());
1416 while( str.size() && !isgraph(str[str.size()-1]) )
1417 str.resize (str.size () - 1);
1430 static constexpr
char token_chars[] =
"-._~+/=:";
1432 for (
char ch : token_chars)
1449 static const regex_t auth_regex = []() {
1450 constexpr
char re[] =
1451 "(access_token=|authz=|(transferheader)?(www-|proxy-)?auth(orization|enticate)[[:space:]]*:[[:space:]]*)"
1452 "(Bearer([[:space:]]|%20)?(token([[:space:]]|%20)?)?)?";
1456 if (regcomp(®ex, re, REG_EXTENDED | REG_ICASE) != 0)
1457 throw std::runtime_error(
"Failed to compile regular expression");
1464 std::string redacted;
1465 const char *
const text = input.c_str();
1467 while (regexec(&auth_regex, text + offset, 1, &match, 0) == 0) {
1468 redacted.append(text + offset, match.rm_eo).append(
"REDACTED");
1470 offset += match.rm_eo;
1476 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 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)