36 #include <unordered_set>
41 #include "XrdSys/XrdWin32.hh"
46 #include <sys/types.h>
62 #define ENODATA ENOATTR
75 idInfo(
const char *name, time_t keep)
76 : Expr(time(0)+keep), Name(strdup(name)) {}
77 ~idInfo() {free(Name);}
80 typedef std::map<unsigned int, struct idInfo*> idMap_t;
86 void AddID(idMap_t &idMap,
unsigned int id,
const char *name, time_t keepT)
88 std::pair<idMap_t::iterator,bool> ret;
89 idInfo *infoP =
new idInfo(name, keepT);
92 ret = idMap.insert(std::pair<unsigned int, struct idInfo*>(
id, infoP));
93 if (ret.second ==
false)
delete infoP;
97 int LookUp(idMap_t &idMap,
unsigned int id,
char *buff,
int blen)
104 if (it != idMap.end())
105 {
if (it->second->Expr <= time(0))
109 if (blen > 0) luRet = snprintf(buff, blen,
"%s", it->second->Name);
128 for (j = 0; j < argC; j++)
129 {
while(*aP ==
' ') aP++;
132 if (*aP ==
'"' || *aP ==
'\'')
134 aP = index(aP+1, *aP);
135 if (!aP || (*(aP+1) !=
' ' && *(aP+1)))
136 {
if (!j) argV[0] = 0;
return -EINVAL;}
140 if ((aP = index(aP+1,
' '))) *aP++ =
'\0';
148 if (j > argC-1)
return -E2BIG;
163 static char hv[] =
"0123456789abcdef";
164 char *outbuff = buff;
165 for (
int i = 0; i < dlen && blen > 2; i++) {
166 *outbuff++ = hv[(inbuff[i] >> 4) & 0x0f];
167 *outbuff++ = hv[ inbuff[i] & 0x0f];
169 if (sep && blen > 1 && ((i & 0x03) == 0x03 || i+1 == dlen))
170 {*outbuff++ =
' '; blen--;}
182 int tlen = strlen(text);
184 return (tlen >= endlen && !strcmp(text+(tlen-endlen), ending));
229 const char *what,
const char *hname,
230 const char *nname,
const char *pname)
232 static const char *brk[] = {
"defined",
"exec",
"named", 0};
239 if (!(val =
Config.GetWord()))
240 {
if (
eDest)
eDest->
Emsg(
"Config",
"Host name missing after 'if' in", what);
246 if (!
is1of(val, brk))
249 }
while(!hostok && val && !
is1of(val, brk));
251 {
while(val && !
is1of(val, brk)) val =
Config.GetWord();
259 while(!strcmp(val,
"defined"))
260 {
if (!(val =
Config.GetWord()) || *val !=
'?')
262 {
eDest->
Emsg(
"Config",
"'?var' missing after 'defined' in",what);}
268 if (!
theEnv && *(val+1) !=
'~')
return 0;
273 while(val && *val ==
'?')
274 {
if (*(val+1) ==
'~' ? getenv(val+2) :
theEnv->
Get(val+1)) isDef=1;
277 if (!val || !isDef)
return isDef;
278 if (strcmp(val,
"&&"))
280 {
eDest->
Emsg(
"Config",val,
"is invalid for defined test in",what);}
283 if (!(val =
Config.GetWord()))
285 {
eDest->
Emsg(
"Config",
"missing keyword after '&&' in",what);}
289 if (!
is1of(val, brk))
291 {
eDest->
Emsg(
"Config",val,
"is invalid after '&&' in",what);}
299 if (!strcmp(val,
"exec"))
300 {
if (!(val =
Config.GetWord()) || !strcmp(val,
"&&"))
302 {
eDest->
Emsg(
"Config",
"Program name missing after 'if exec' in",what);}
308 if (!pname)
return 0;
309 while(val && strcmp(val, pname))
310 if (!strcmp(val,
"&&"))
return 0;
311 else val =
Config.GetWord();
313 while(val && strcmp(val,
"&&")) val =
Config.GetWord();
316 if (!(val =
Config.GetWord()))
318 {
eDest->
Emsg(
"Config",
"Keyword missing after '&&' in",what);}
321 if (strcmp(val,
"named"))
323 {
eDest->
Emsg(
"Config",val,
"is invalid after '&&' in",what);}
331 if (!(val =
Config.GetWord()))
333 {
eDest->
Emsg(
"Config",
"Instance name missing after 'if named' in", what);}
339 if (!nname)
return 0;
340 while(val && strcmp(val, nname)) val =
Config.GetWord();
358 {
if (
stat(pgm, &
Stat) || !(
Stat.st_mode & S_IXOTH))
return false;
365 const char *pEnv = getenv(
"PATH");
366 if (!pEnv)
return false;
372 prog +=
'/'; prog += pgm;
376 while((from = pList.
tokenize(path, from,
':')) != -1)
389 static const long long Kval = 1024LL;
390 static const long long Mval = 1024LL*1024LL;
391 static const long long Gval = 1024LL*1024LL*1024LL;
392 static const long long Tval = 1024LL*1024LL*1024LL*1024LL;
398 if (val < 1024)
return snprintf(buff, bsz,
"%lld", val);
399 if (val < Mval) {val = val*10/Kval; sName =
'K';}
400 else if (val < Gval) {val = val*10/Mval; sName =
'M';}
401 else if (val < Tval) {val = val*10/Gval; sName =
'G';}
402 else {val = val*10/Tval; sName =
'T';}
403 resid = val%10LL; val = val/10LL;
407 return snprintf(buff, bsz,
"%lld.%d%c", val, resid, sName);
418 int i =
strlcpy(buff, p_path,
sizeof(buff));
420 if (buff[i-1] !=
'/') {buff[i++] =
'/'; buff[i] =
'\0';}
421 if (inst) {strcpy(buff+i, inst); strcat(buff,
"/");}
422 if (s_path) strcat(buff, s_path);
425 if (buff[i-1] !=
'/') {buff[i++] =
'/'; buff[i] =
'\0';}
437 j = (psfx ? strlen(psfx) : 0);
438 if (i+j+3 > blen)
return -ENAMETOOLONG;
442 {
if (buff[i-1] !=
'/') buff[i++] =
'/';
443 strcpy(&buff[i], psfx);
444 if (psfx[j-1] !=
'/') strcat(buff,
"/");
459 ~fdHelper() {
if (fd >= 0)
close(fd);}
470 if ((file.fd =
open(path, O_RDONLY)) < 0) {rc = errno;
return 0;}
474 if (
fstat(file.fd, &
Stat)) {rc = errno;
return 0;}
478 if (
Stat.st_size > maxsz) {rc = EFBIG;
return 0;}
482 if (
Stat.st_size == 0 && notempty) {rc =
ENODATA;
return 0;}
486 if ((buff = (
char *)malloc(
Stat.st_size+1)) == 0)
487 {rc = errno;
return 0;}
492 {
if ((flen =
read(file.fd, buff,
Stat.st_size)) < 0)
493 {rc = errno; free(buff);
return 0;}
512 struct group Grp, *result;
515 getgrnam_r(gName, &Grp, buff,
sizeof(buff), &result);
516 if (!result)
return false;
528 struct passwd pwd, *result;
531 getpwnam_r(uName, &pwd, buff,
sizeof(buff), &result);
532 if (!result)
return false;
535 if (gID) *gID = pwd.pw_gid;
546 static const int maxgBsz = 256*1024;
547 static const int addGsz = 4096;
548 struct group *gEnt, gStruct;
549 char gBuff[1024], *gBp = gBuff;
550 int glen = 0, gBsz =
sizeof(gBuff), aOK = 1;
556 {
int n = LookUp(gidMap,
static_cast<unsigned int>(gID),gName,gNsz);
557 if (n > 0)
return (n < gNsz ? n : 0);
563 while(( retVal = getgrgid_r(gID, &gStruct, gBp, gBsz, &gEnt) ) == ERANGE)
564 {
if (gBsz >= maxgBsz) {aOK = 0;
break;}
565 if (gBsz > addGsz) free(gBp);
567 if (!(gBp = (
char *)malloc(gBsz))) {aOK = 0;
break;}
572 if (aOK && retVal == 0 && gEnt != NULL)
574 AddID(gidMap,
static_cast<unsigned int>(gID), gEnt->gr_name, keepT);
575 glen = strlen(gEnt->gr_name);
576 if (glen >= gNsz) glen = 0;
577 else strcpy(gName, gEnt->gr_name);
579 n = snprintf(gName, gNsz,
"%ud",
static_cast<unsigned int>(gID));
580 if (n >= gNsz) glen = 0;
585 if (gBsz > addGsz && gBp) free(gBp);
595 static const int maxgBsz = 256*1024;
596 static const int addGsz = 4096;
597 struct group *gEnt, gStruct;
598 char gBuff[1024], *gBp = gBuff;
599 int glen, gBsz =
sizeof(gBuff), aOK = 1;
605 while(( retVal = getgrgid_r(gID, &gStruct, gBp, gBsz, &gEnt) ) == ERANGE)
606 {
if (gBsz >= maxgBsz) {aOK = 0;
break;}
607 if (gBsz > addGsz) free(gBp);
609 if (!(gBp = (
char *)malloc(gBsz))) {aOK = 0;
break;}
614 if (aOK && retVal == 0 && gEnt != NULL)
615 {glen = strlen(gEnt->gr_name);
616 if (glen >= gNsz) glen = 0;
617 else strcpy(gName, gEnt->gr_name);
622 if (gBsz > addGsz && gBp) free(gBp);
632 char zo[2] = {
'0',
'1'};
634 if (blen < 2)
return "";
637 if (!val) buff[blen--] =
'0';
638 else while(val && blen >= 0)
639 {buff[blen--] = zo[val & 0x01];
643 if (blen >= 0 && pad)
while(blen >= 0) buff[blen--] =
'0';
645 return &buff[blen+1];
654 long long genSID(
char *&urSID,
const char *iHost,
int iPort,
655 const char *iName,
const char *iProg)
658 static const uint32_t fpOffs = 2, fpSize = 6;
660 const char *iSite = getenv(
"XRDSITE");
661 unsigned char mDigest[mdLen];
663 union {uint64_t mdLL;
unsigned char mdUC[8];};
667 if (iSite) myID = iSite;
670 if (iName) myID += iName;
675 memset(mDigest, 0,
sizeof(mDigest));
685 uint64_t fpPos =
crc32c % (((uint32_t)mdLen) - fpSize);
687 memcpy(mdUC+fpOffs, mDigest+fpPos, fpSize);
688 long long fpVal =
static_cast<long long>(ntohll(mdLL));
693 snprintf(fpBuff,
sizeof(fpBuff),
"%lld", fpVal);
694 urSID = strdup(fpBuff);
700 const char *iHost,
const char *iProg,
701 const char *iName,
int iPort)
704 static long long theSID = genSID(theSIN, iHost, iPort, iName, iProg);
705 const char *sP = getenv(
"XRDSITE");
707 int myPid =
static_cast<int>(getpid());
711 if (
UserName(getuid(), uName,
sizeof(uName)))
712 sprintf(uName,
"%d",
static_cast<int>(getuid()));
716 snprintf(iBuff,iBlen,
"%s.%d:%s@%s\n&site=%s&port=%d&inst=%s&pgm=%s",
717 uName, myPid, theSIN, iHost, (sP ? sP :
""), iPort, iName, iProg);
721 h2nll(theSID,
mySID);
722 return strdup(theSIN);
731 const char *iName = getenv(
"XRDNAME");
735 if (!TranOpt)
return iName;
740 if (TranOpt > 0) {
if (!iName || !*iName) iName =
"anon";}
741 else if (iName && !strcmp(iName,
"anon")) iName = 0;
747 {
return (Fillit ? name && *name ? name :
"anon"
748 : name && strcmp(name,
"anon") && *name ? name : 0);
758 while(clist[i])
if (!strcmp(val, clist[i]))
return 1;
770 const char *hName, *hNend, *hPort, *hPend, *hP = path;
774 if (*path ==
'/') hP++;
775 if (*hP ==
'x') hP++;
776 if (strncmp(
"root:/", hP, 6))
return 0;
777 if (hBuff == 0 || hBLen <= 0)
return (hP - path) + 6;
781 if (*hNend ==
']') hNend++;
782 else {
if (!(*hNend) && !(hNend = index(hName,
'/')))
return 0;
783 if (!(*hPend)) hPend = hNend;
786 if (pTrim || !(*hPort)) n = hNend - hP;
788 if (n >= hBLen)
return 0;
789 strncpy(hBuff, hP, n);
793 {
if (*hNend !=
':') *port = 0;
794 else {*port = strtol(hPort, &eP, 10);
795 if (*port < 0 || *port > 65535 || eP != hPend)
return 0;
819 #define SHFT(k) if (n >= (1ULL << k)) { i += k; n >>= k; }
834 #define SHFT(k, m) if (n >= m) { i += k; n /= m; }
836 SHFT(16,10000000000000000ULL);
SHFT(8,100000000ULL);
851 if (!inst || !getcwd(buff,
sizeof(buff)))
return;
853 strcat(buff,
"/"); strcat(buff, inst);
855 {
eDest.
Emsg(
"Config", errno,
"create home directory", buff);
860 eDest.
Emsg(
"Config", errno,
"chdir to home directory", buff);
866 const char *path, mode_t mode)
869 const char *slash =
"", *slash2 =
"";
875 if (!path || !(n = strlen(path)))
882 if (path[n-1] !=
'/') slash =
"/";
883 if (!inst || !(n = strlen(inst))) inst =
"";
885 n = snprintf(cwDir,
sizeof(cwDir),
"%s%s%s%s", path, slash, inst, slash2);
886 if (n >= (
int)
sizeof(cwDir))
887 {
eDest.
Emsg(
"Config", ENAMETOOLONG,
"create home directory", cwDir);
893 if ((rc =
makePath(cwDir, mode,
true)))
894 {
eDest.
Emsg(
"Config", rc,
"create home directory", cwDir);
900 if (
chdir(cwDir) < 0)
901 {
eDest.
Emsg(
"Config", errno,
"chdir to home directory", cwDir);
916 char *next_path = path+1;
918 bool dochmod =
false;
922 if (!reset && !
stat(path, &buf))
return 0;
926 while((next_path = index(next_path,
int(
'/'))))
929 if (errno != EEXIST)
return -errno;
930 if (dochmod)
CHMOD(path, mode);
933 next_path = next_path+1;
947 mode_t mval[3] = {0}, mbit[3] = {0x04, 0x02, 0x01};
948 const char *mok =
"rwx";
955 mask = strtol(mode, &eP, 8);
961 int n = strlen(mode);
962 if (!n || n > 9 || n/3*3 != n)
return false;
967 do {
for (
int i = 0; i < 3; i++)
970 {
if (mlet != mok[i])
return false;
974 }
while(++k < 3 && *mode);
978 mask = mval[0]<<6 | mval[1]<<3 | mval[2];
987 const char *libName,
char *&libPath,
char **libParm)
989 char *val, parms[2048];
997 if (val && !strcmp(
"++", val))
998 {
eDest.
Say(
"Config warning: stacked plugins are not supported in "
999 "this context; directive ignored!");
1005 while(val && *val && *val ==
'+') val =
Config.GetWord();
1009 if (!val || !val[0])
1010 {
eDest.
Emsg(
"Config", libName,
"not specified");
return false;}
1014 if (libPath) free(libPath);
1015 libPath = strdup(val);
1019 if (!libParm)
return true;
1020 if (*libParm) free(*libParm);
1026 if (!
Config.GetRest(parms,
sizeof(parms)))
1027 {
eDest.
Emsg(
"Config", libName,
"parameters too long");
return false;}
1028 if (*parms) *libParm = strdup(parms);
1038 char *pval, *val, *HomePath = 0;
1043 if (!pval || !pval[0])
1044 {
eDest.
Emsg(
"Config",
"home path not specified");
return 0;}
1049 {
eDest.
Emsg(
"Config",
"home path not absolute");
return 0;}
1053 HomePath = strdup(pval);
1058 if ((val =
Config.GetWord()) && val[0])
1059 {
if (!strcmp(
"group", val)) mode |= (S_IRGRP | S_IXGRP);
1060 else {
eDest.
Emsg(
"Config",
"invalid home path modifier -", val);
1074 const mode_t AMode = S_IRWXU;
1075 char pbuff[MAXPATHLEN+64];
1081 if (n >= (
int)
sizeof(pbuff))
return ENAMETOOLONG;
1082 strcpy(pbuff, path);
1087 makePath(pbuff, (mode ? mode : AMode));
1088 if (symlink(target, path))
return errno;
1103 {
if (*str ==
'-') *str = subc;
1104 else if (*str ==
' ') *str = subc;
1105 char *blank = rindex(str,
' ');
1106 if (blank)
while(*blank ==
' ') *blank-- = 0;
1108 {
if (!isalnum(*str) && index(
"_-.", *str) == 0) *str = subc;
1120 const mode_t lfm = S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH;
1121 char buff[2048], *sp;
1124 if (!inst || !*inst)
return logfn;
1125 if (!(sp = rindex(logfn,
'/'))) strcpy(buff,
"./");
1126 else {*sp =
'\0'; strcpy(buff, logfn); strcat(buff,
"/");}
1128 strcat(buff, inst); strcat(buff,
"/");
1131 {
eDest.
Emsg(
"Config", rc,
"create log file path", buff);
1135 if (sp) {*sp =
'/'; strcat(buff, sp+1);}
1136 else strcat(buff, logfn);
1139 return strdup(buff);
1150 while(*str) {*str = tolower(*str); str++;}
1159 const char *eP, *bP = *str;
1164 while(*bP && *bP == delim) bP++;
1165 if (*bP == 0) {*buff = 0;
return 0;}
1170 while(*eP && *eP != delim) eP++;
1174 if (*eP == 0) *str = eP;
1180 if (aLen >= bsz) mLen = bsz-1;
1185 strncpy(buff, bP, mLen);
1209 if (noLog)
eDest.
Emsg(
"Config",
"Warning! No log file specified; "
1210 "backgrounding disables all logging!");
1214 if ((mypid = fork()) < 0)
1215 {
eDest.
Emsg(
"Config", errno,
"fork process 1 for backgrounding");
1229 if(
read( pipeFD[0], &status,
sizeof(status) ) !=
sizeof(status) )
1243 {
eDest.
Emsg(
"Config", errno,
"doing setsid() for backgrounding");
1249 if ((mypid = fork()) < 0)
1250 {
eDest.
Emsg(
"Config", errno,
"fork process 2 for backgrounding");
1253 else if (mypid) _exit(0);
1258 if ((myfd =
open(
"/dev/null", O_RDWR)) < 0)
1259 {
eDest.
Emsg(
"Config", errno,
"open /dev/null for backgrounding");
1262 dup2(myfd, 0); dup2(myfd, 1); dup2(myfd, 2); dup2(myfd, logFD);
1267 for (myfd = 3; myfd <
maxFiles; myfd++)
1268 if( (!pipeFD || myfd != pipeFD[1]) && myfd != logFD )
close(myfd);
1277 struct passwd *pEnt, pStruct;
1284 {
int n = LookUp(uidMap,
static_cast<unsigned int>(uID),uName,uNsz);
1285 if (n > 0)
return (n < uNsz ? n : 0);
1291 rc = getpwuid_r(uID, &pStruct, pBuff,
sizeof(pBuff), &pEnt);
1293 {n = snprintf(uName, uNsz,
"%ud",
static_cast<unsigned int>(uID));
1294 return (n >= uNsz ? 0 : n);
1300 AddID(uidMap,
static_cast<unsigned int>(uID), pEnt->pw_name, keepT);
1304 n = strlen(pEnt->pw_name);
1305 if (uNsz <= (
int)strlen(pEnt->pw_name))
return 0;
1306 strcpy(uName, pEnt->pw_name);
1316 struct passwd *pEnt, pStruct;
1323 rc = getpwuid_r(uID, &pStruct, pBuff,
sizeof(pBuff), &pEnt);
1325 if (!pEnt)
return ESRCH;
1329 if (uNsz <= (
int)strlen(pEnt->pw_name))
return ENAMETOOLONG;
1330 strcpy(uName, pEnt->pw_name);
1340 static const mode_t mMask = S_IRWXU | S_IRWXG | S_IRWXO;
1345 if (
stat(path, &buf))
1346 {
if (errno == ENOENT)
return "does not exist.";
1353 {
if (!S_ISDIR(buf.st_mode))
return "is not a directory.";
1355 if (!S_ISREG(buf.st_mode))
return "is not a file.";
1360 if ((buf.st_mode & mMask) & ~allow)
return "has excessive access rights.";
1376 if( (fd =
open( path, O_WRONLY|O_CREAT|O_TRUNC, 0644 )) < 0 )
1378 eDest.
Emsg(
"Config", errno,
"create pidfile" );
1382 if(
write( fd, buff, snprintf( buff,
sizeof(buff),
"%d",
1383 static_cast<int>(getpid()) ) ) < 0 )
1385 eDest.
Emsg(
"Config", errno,
"write to pidfile" );
1398 int statRet =
::stat(path,&buf);
1400 modificationTime = buf.st_mtime;
1407 while( str.size() && !isgraph(str[0]) ) str.erase(str.begin());
1411 while( str.size() && !isgraph(str[str.size()-1]) )
1412 str.resize (str.size () - 1);
1415 std::string
XrdOucUtils::obfuscate(
const std::string & input,
const std::unordered_set<std::string> & keysToObfuscate,
const char keyValueDelimiter,
const char listDelimiter) {
1417 std::ostringstream result;
1420 std::istringstream inputStream(input);
1425 while (
std::getline(inputStream, pair, listDelimiter)) {
1427 result << listDelimiter;
1433 size_t delimiterPos = pair.find(keyValueDelimiter);
1434 if (delimiterPos != std::string::npos) {
1435 std::string key = pair.substr(0, delimiterPos);
1437 std::string lowerCasedKey = key;
1438 std::transform(lowerCasedKey.begin(),lowerCasedKey.end(),lowerCasedKey.begin(),::tolower);
1439 std::string value = pair.substr(delimiterPos + 1);
1442 if (keysToObfuscate.find(lowerCasedKey) != keysToObfuscate.end()) {
1452 return result.str();
static XrdSysError eDest(0,"crypto_")
uint32_t crc32c(uint32_t crc, void const *buf, size_t len)
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)
void getline(uchar *buff, int blen)
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 std::string OBFUSCATION_STR
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 std::string obfuscate(const std::string &input, const std::unordered_set< std::string > &keysToObfuscate, const char keyValueDelimiter, const char listDelimiter)
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)