36 #include <unordered_set>
41 #include "XrdSys/XrdWin32.hh"
46 #include <sys/types.h>
63 #define ENODATA ENOATTR
76 idInfo(
const char *name, time_t keep)
77 : Expr(time(0)+keep), Name(strdup(name)) {}
78 ~idInfo() {free(Name);}
81 typedef std::map<unsigned int, struct idInfo*> idMap_t;
87 void AddID(idMap_t &idMap,
unsigned int id,
const char *name, time_t keepT)
89 std::pair<idMap_t::iterator,bool> ret;
90 idInfo *infoP =
new idInfo(name, keepT);
93 ret = idMap.insert(std::pair<unsigned int, struct idInfo*>(
id, infoP));
94 if (ret.second ==
false)
delete infoP;
98 int LookUp(idMap_t &idMap,
unsigned int id,
char *buff,
int blen)
100 idMap_t::iterator it;
105 if (it != idMap.end())
106 {
if (it->second->Expr <= time(0))
110 if (blen > 0) luRet = snprintf(buff, blen,
"%s", it->second->Name);
126 std::regex(R
"((authz=)(Bearer\s)?([^ &\",<>#%{}|\^~\[\]`]*))",std::regex_constants::optimize),
128 std::regex(R
"((\s*\w*Authorization\s*:\s*)[^$]*)", std::regex_constants::icase | std::regex_constants::optimize)
142 for (j = 0; j < argC; j++)
143 {
while(*aP ==
' ') aP++;
146 if (*aP ==
'"' || *aP ==
'\'')
148 aP = index(aP+1, *aP);
149 if (!aP || (*(aP+1) !=
' ' && *(aP+1)))
150 {
if (!j) argV[0] = 0;
return -EINVAL;}
154 if ((aP = index(aP+1,
' '))) *aP++ =
'\0';
162 if (j > argC-1)
return -E2BIG;
177 static char hv[] =
"0123456789abcdef";
178 char *outbuff = buff;
179 for (
int i = 0; i < dlen && blen > 2; i++) {
180 *outbuff++ = hv[(inbuff[i] >> 4) & 0x0f];
181 *outbuff++ = hv[ inbuff[i] & 0x0f];
183 if (sep && blen > 1 && ((i & 0x03) == 0x03 || i+1 == dlen))
184 {*outbuff++ =
' '; blen--;}
196 int tlen = strlen(text);
198 return (tlen >= endlen && !strcmp(text+(tlen-endlen), ending));
243 const char *what,
const char *hname,
244 const char *nname,
const char *pname)
246 static const char *brk[] = {
"defined",
"exec",
"named", 0};
253 if (!(val =
Config.GetWord()))
254 {
if (
eDest)
eDest->
Emsg(
"Config",
"Host name missing after 'if' in", what);
260 if (!
is1of(val, brk))
263 }
while(!hostok && val && !
is1of(val, brk));
265 {
while(val && !
is1of(val, brk)) val =
Config.GetWord();
273 while(!strcmp(val,
"defined"))
274 {
if (!(val =
Config.GetWord()) || *val !=
'?')
276 {
eDest->
Emsg(
"Config",
"'?var' missing after 'defined' in",what);}
282 if (!
theEnv && *(val+1) !=
'~')
return 0;
287 while(val && *val ==
'?')
288 {
if (*(val+1) ==
'~' ? getenv(val+2) :
theEnv->
Get(val+1)) isDef=1;
291 if (!val || !isDef)
return isDef;
292 if (strcmp(val,
"&&"))
294 {
eDest->
Emsg(
"Config",val,
"is invalid for defined test in",what);}
297 if (!(val =
Config.GetWord()))
299 {
eDest->
Emsg(
"Config",
"missing keyword after '&&' in",what);}
303 if (!
is1of(val, brk))
305 {
eDest->
Emsg(
"Config",val,
"is invalid after '&&' in",what);}
313 if (!strcmp(val,
"exec"))
314 {
if (!(val =
Config.GetWord()) || !strcmp(val,
"&&"))
316 {
eDest->
Emsg(
"Config",
"Program name missing after 'if exec' in",what);}
322 if (!pname)
return 0;
323 while(val && strcmp(val, pname))
324 if (!strcmp(val,
"&&"))
return 0;
325 else val =
Config.GetWord();
327 while(val && strcmp(val,
"&&")) val =
Config.GetWord();
330 if (!(val =
Config.GetWord()))
332 {
eDest->
Emsg(
"Config",
"Keyword missing after '&&' in",what);}
335 if (strcmp(val,
"named"))
337 {
eDest->
Emsg(
"Config",val,
"is invalid after '&&' in",what);}
345 if (!(val =
Config.GetWord()))
347 {
eDest->
Emsg(
"Config",
"Instance name missing after 'if named' in", what);}
353 if (!nname)
return 0;
354 while(val && strcmp(val, nname)) val =
Config.GetWord();
372 {
if (
stat(pgm, &
Stat) || !(
Stat.st_mode & S_IXOTH))
return false;
379 const char *pEnv = getenv(
"PATH");
380 if (!pEnv)
return false;
386 prog +=
'/'; prog += pgm;
390 while((from = pList.
tokenize(path, from,
':')) != -1)
403 static const long long Kval = 1024LL;
404 static const long long Mval = 1024LL*1024LL;
405 static const long long Gval = 1024LL*1024LL*1024LL;
406 static const long long Tval = 1024LL*1024LL*1024LL*1024LL;
412 if (val < 1024)
return snprintf(buff, bsz,
"%lld", val);
413 if (val < Mval) {val = val*10/Kval; sName =
'K';}
414 else if (val < Gval) {val = val*10/Mval; sName =
'M';}
415 else if (val < Tval) {val = val*10/Gval; sName =
'G';}
416 else {val = val*10/Tval; sName =
'T';}
417 resid = val%10LL; val = val/10LL;
421 return snprintf(buff, bsz,
"%lld.%d%c", val, resid, sName);
432 int i =
strlcpy(buff, p_path,
sizeof(buff));
434 if (buff[i-1] !=
'/') {buff[i++] =
'/'; buff[i] =
'\0';}
435 if (inst) {strcpy(buff+i, inst); strcat(buff,
"/");}
436 if (s_path) strcat(buff, s_path);
439 if (buff[i-1] !=
'/') {buff[i++] =
'/'; buff[i] =
'\0';}
451 j = (psfx ? strlen(psfx) : 0);
452 if (i+j+3 > blen)
return -ENAMETOOLONG;
456 {
if (buff[i-1] !=
'/') buff[i++] =
'/';
457 strcpy(&buff[i], psfx);
458 if (psfx[j-1] !=
'/') strcat(buff,
"/");
473 ~fdHelper() {
if (fd >= 0)
close(fd);}
484 if ((file.fd =
open(path, O_RDONLY)) < 0) {rc = errno;
return 0;}
488 if (
fstat(file.fd, &
Stat)) {rc = errno;
return 0;}
492 if (
Stat.st_size > maxsz) {rc = EFBIG;
return 0;}
496 if (
Stat.st_size == 0 && notempty) {rc =
ENODATA;
return 0;}
500 if ((buff = (
char *)malloc(
Stat.st_size+1)) == 0)
501 {rc = errno;
return 0;}
506 {
if ((flen =
read(file.fd, buff,
Stat.st_size)) < 0)
507 {rc = errno; free(buff);
return 0;}
526 struct group Grp, *result;
529 getgrnam_r(gName, &Grp, buff,
sizeof(buff), &result);
530 if (!result)
return false;
542 struct passwd pwd, *result;
545 getpwnam_r(uName, &pwd, buff,
sizeof(buff), &result);
546 if (!result)
return false;
549 if (gID) *gID = pwd.pw_gid;
560 static const int maxgBsz = 256*1024;
561 static const int addGsz = 4096;
562 struct group *gEnt, gStruct;
563 char gBuff[1024], *gBp = gBuff;
564 int glen = 0, gBsz =
sizeof(gBuff), aOK = 1;
570 {
int n = LookUp(gidMap,
static_cast<unsigned int>(gID),gName,gNsz);
571 if (n > 0)
return (n < gNsz ? n : 0);
577 while(( retVal = getgrgid_r(gID, &gStruct, gBp, gBsz, &gEnt) ) == ERANGE)
578 {
if (gBsz >= maxgBsz) {aOK = 0;
break;}
579 if (gBsz > addGsz) free(gBp);
581 if (!(gBp = (
char *)malloc(gBsz))) {aOK = 0;
break;}
586 if (aOK && retVal == 0 && gEnt != NULL)
588 AddID(gidMap,
static_cast<unsigned int>(gID), gEnt->gr_name, keepT);
589 glen = strlen(gEnt->gr_name);
590 if (glen >= gNsz) glen = 0;
591 else strcpy(gName, gEnt->gr_name);
593 n = snprintf(gName, gNsz,
"%ud",
static_cast<unsigned int>(gID));
594 if (n >= gNsz) glen = 0;
599 if (gBsz > addGsz && gBp) free(gBp);
609 static const int maxgBsz = 256*1024;
610 static const int addGsz = 4096;
611 struct group *gEnt, gStruct;
612 char gBuff[1024], *gBp = gBuff;
613 int glen, gBsz =
sizeof(gBuff), aOK = 1;
619 while(( retVal = getgrgid_r(gID, &gStruct, gBp, gBsz, &gEnt) ) == ERANGE)
620 {
if (gBsz >= maxgBsz) {aOK = 0;
break;}
621 if (gBsz > addGsz) free(gBp);
623 if (!(gBp = (
char *)malloc(gBsz))) {aOK = 0;
break;}
628 if (aOK && retVal == 0 && gEnt != NULL)
629 {glen = strlen(gEnt->gr_name);
630 if (glen >= gNsz) glen = 0;
631 else strcpy(gName, gEnt->gr_name);
636 if (gBsz > addGsz && gBp) free(gBp);
646 char zo[2] = {
'0',
'1'};
648 if (blen < 2)
return "";
651 if (!val) buff[blen--] =
'0';
652 else while(val && blen >= 0)
653 {buff[blen--] = zo[val & 0x01];
657 if (blen >= 0 && pad)
while(blen >= 0) buff[blen--] =
'0';
659 return &buff[blen+1];
668 long long genSID(
char *&urSID,
const char *iHost,
int iPort,
669 const char *iName,
const char *iProg)
672 static const uint32_t fpOffs = 2, fpSize = 6;
674 const char *iSite = getenv(
"XRDSITE");
675 unsigned char mDigest[mdLen];
677 union {uint64_t mdLL;
unsigned char mdUC[8];};
681 if (iSite) myID = iSite;
684 if (iName) myID += iName;
689 memset(mDigest, 0,
sizeof(mDigest));
699 uint64_t fpPos =
crc32c % (((uint32_t)mdLen) - fpSize);
701 memcpy(mdUC+fpOffs, mDigest+fpPos, fpSize);
702 long long fpVal =
static_cast<long long>(ntohll(mdLL));
707 snprintf(fpBuff,
sizeof(fpBuff),
"%lld", fpVal);
708 urSID = strdup(fpBuff);
714 const char *iHost,
const char *iProg,
715 const char *iName,
int iPort)
718 static long long theSID = genSID(theSIN, iHost, iPort, iName, iProg);
719 const char *sP = getenv(
"XRDSITE");
721 int myPid =
static_cast<int>(getpid());
725 if (
UserName(getuid(), uName,
sizeof(uName)))
726 sprintf(uName,
"%d",
static_cast<int>(getuid()));
730 snprintf(iBuff,iBlen,
"%s.%d:%s@%s\n&site=%s&port=%d&inst=%s&pgm=%s",
731 uName, myPid, theSIN, iHost, (sP ? sP :
""), iPort, iName, iProg);
735 h2nll(theSID,
mySID);
736 return strdup(theSIN);
745 const char *iName = getenv(
"XRDNAME");
749 if (!TranOpt)
return iName;
754 if (TranOpt > 0) {
if (!iName || !*iName) iName =
"anon";}
755 else if (iName && !strcmp(iName,
"anon")) iName = 0;
761 {
return (Fillit ? name && *name ? name :
"anon"
762 : name && strcmp(name,
"anon") && *name ? name : 0);
772 while(clist[i])
if (!strcmp(val, clist[i]))
return 1;
784 const char *hName, *hNend, *hPort, *hPend, *hP = path;
788 if (*path ==
'/') hP++;
789 if (*hP ==
'x') hP++;
790 if (strncmp(
"root:/", hP, 6))
return 0;
791 if (hBuff == 0 || hBLen <= 0)
return (hP - path) + 6;
795 if (*hNend ==
']') hNend++;
796 else {
if (!(*hNend) && !(hNend = index(hName,
'/')))
return 0;
797 if (!(*hPend)) hPend = hNend;
800 if (pTrim || !(*hPort)) n = hNend - hP;
802 if (n >= hBLen)
return 0;
803 strncpy(hBuff, hP, n);
807 {
if (*hNend !=
':') *port = 0;
808 else {*port = strtol(hPort, &eP, 10);
809 if (*port < 0 || *port > 65535 || eP != hPend)
return 0;
833 #define SHFT(k) if (n >= (1ULL << k)) { i += k; n >>= k; }
848 #define SHFT(k, m) if (n >= m) { i += k; n /= m; }
850 SHFT(16,10000000000000000ULL);
SHFT(8,100000000ULL);
865 if (!inst || !getcwd(buff,
sizeof(buff)))
return;
867 strcat(buff,
"/"); strcat(buff, inst);
869 {
eDest.
Emsg(
"Config", errno,
"create home directory", buff);
874 eDest.
Emsg(
"Config", errno,
"chdir to home directory", buff);
880 const char *path, mode_t mode)
883 const char *slash =
"", *slash2 =
"";
889 if (!path || !(n = strlen(path)))
896 if (path[n-1] !=
'/') slash =
"/";
897 if (!inst || !(n = strlen(inst))) inst =
"";
899 n = snprintf(cwDir,
sizeof(cwDir),
"%s%s%s%s", path, slash, inst, slash2);
900 if (n >= (
int)
sizeof(cwDir))
901 {
eDest.
Emsg(
"Config", ENAMETOOLONG,
"create home directory", cwDir);
907 if ((rc =
makePath(cwDir, mode,
true)))
908 {
eDest.
Emsg(
"Config", rc,
"create home directory", cwDir);
914 if (
chdir(cwDir) < 0)
915 {
eDest.
Emsg(
"Config", errno,
"chdir to home directory", cwDir);
930 char *next_path = path+1;
932 bool dochmod =
false;
936 if (!reset && !
stat(path, &buf))
return 0;
940 while((next_path = index(next_path,
int(
'/'))))
943 if (errno != EEXIST)
return -errno;
944 if (dochmod)
CHMOD(path, mode);
947 next_path = next_path+1;
961 mode_t mval[3] = {0}, mbit[3] = {0x04, 0x02, 0x01};
962 const char *mok =
"rwx";
969 mask = strtol(mode, &eP, 8);
975 int n = strlen(mode);
976 if (!n || n > 9 || n/3*3 != n)
return false;
981 do {
for (
int i = 0; i < 3; i++)
984 {
if (mlet != mok[i])
return false;
988 }
while(++k < 3 && *mode);
992 mask = mval[0]<<6 | mval[1]<<3 | mval[2];
1001 const char *libName,
char *&libPath,
char **libParm)
1003 char *val, parms[2048];
1011 if (val && !strcmp(
"++", val))
1012 {
eDest.
Say(
"Config warning: stacked plugins are not supported in "
1013 "this context; directive ignored!");
1019 while(val && *val && *val ==
'+') val =
Config.GetWord();
1023 if (!val || !val[0])
1024 {
eDest.
Emsg(
"Config", libName,
"not specified");
return false;}
1028 if (libPath) free(libPath);
1029 libPath = strdup(val);
1033 if (!libParm)
return true;
1034 if (*libParm) free(*libParm);
1040 if (!
Config.GetRest(parms,
sizeof(parms)))
1041 {
eDest.
Emsg(
"Config", libName,
"parameters too long");
return false;}
1042 if (*parms) *libParm = strdup(parms);
1052 char *pval, *val, *HomePath = 0;
1057 if (!pval || !pval[0])
1058 {
eDest.
Emsg(
"Config",
"home path not specified");
return 0;}
1063 {
eDest.
Emsg(
"Config",
"home path not absolute");
return 0;}
1067 HomePath = strdup(pval);
1072 if ((val =
Config.GetWord()) && val[0])
1073 {
if (!strcmp(
"group", val)) mode |= (S_IRGRP | S_IXGRP);
1074 else {
eDest.
Emsg(
"Config",
"invalid home path modifier -", val);
1088 const mode_t AMode = S_IRWXU;
1089 char pbuff[MAXPATHLEN+64];
1095 if (n >= (
int)
sizeof(pbuff))
return ENAMETOOLONG;
1096 strcpy(pbuff, path);
1101 makePath(pbuff, (mode ? mode : AMode));
1102 if (symlink(target, path))
return errno;
1117 {
if (*str ==
'-') *str = subc;
1118 else if (*str ==
' ') *str = subc;
1119 char *blank = rindex(str,
' ');
1120 if (blank)
while(*blank ==
' ') *blank-- = 0;
1122 {
if (!isalnum(*str) && index(
"_-.", *str) == 0) *str = subc;
1134 const mode_t lfm = S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH;
1135 char buff[2048], *sp;
1138 if (!inst || !*inst)
return logfn;
1139 if (!(sp = rindex(logfn,
'/'))) strcpy(buff,
"./");
1140 else {*sp =
'\0'; strcpy(buff, logfn); strcat(buff,
"/");}
1142 strcat(buff, inst); strcat(buff,
"/");
1145 {
eDest.
Emsg(
"Config", rc,
"create log file path", buff);
1149 if (sp) {*sp =
'/'; strcat(buff, sp+1);}
1150 else strcat(buff, logfn);
1153 return strdup(buff);
1162 unsigned char* ustr = (
unsigned char*)str;
1166 while(*ustr) {*ustr = tolower(*ustr); ustr++;}
1175 const char *eP, *bP = *str;
1180 while(*bP && *bP == delim) bP++;
1181 if (*bP == 0) {*buff = 0;
return 0;}
1186 while(*eP && *eP != delim) eP++;
1190 if (*eP == 0) *str = eP;
1196 if (aLen >= bsz) mLen = bsz-1;
1201 strncpy(buff, bP, mLen);
1225 if (noLog)
eDest.
Emsg(
"Config",
"Warning! No log file specified; "
1226 "backgrounding disables all logging!");
1230 if ((mypid = fork()) < 0)
1231 {
eDest.
Emsg(
"Config", errno,
"fork process 1 for backgrounding");
1245 if(
read( pipeFD[0], &status,
sizeof(status) ) !=
sizeof(status) )
1259 {
eDest.
Emsg(
"Config", errno,
"doing setsid() for backgrounding");
1265 if ((mypid = fork()) < 0)
1266 {
eDest.
Emsg(
"Config", errno,
"fork process 2 for backgrounding");
1269 else if (mypid) _exit(0);
1274 if ((myfd =
open(
"/dev/null", O_RDWR)) < 0)
1275 {
eDest.
Emsg(
"Config", errno,
"open /dev/null for backgrounding");
1278 dup2(myfd, 0); dup2(myfd, 1); dup2(myfd, 2); dup2(myfd, logFD);
1283 for (myfd = 3; myfd <
maxFiles; myfd++)
1284 if( (!pipeFD || myfd != pipeFD[1]) && myfd != logFD )
close(myfd);
1293 struct passwd *pEnt, pStruct;
1300 {
int n = LookUp(uidMap,
static_cast<unsigned int>(uID),uName,uNsz);
1301 if (n > 0)
return (n < uNsz ? n : 0);
1307 rc = getpwuid_r(uID, &pStruct, pBuff,
sizeof(pBuff), &pEnt);
1309 {n = snprintf(uName, uNsz,
"%ud",
static_cast<unsigned int>(uID));
1310 return (n >= uNsz ? 0 : n);
1316 AddID(uidMap,
static_cast<unsigned int>(uID), pEnt->pw_name, keepT);
1320 n = strlen(pEnt->pw_name);
1321 if (uNsz <= (
int)strlen(pEnt->pw_name))
return 0;
1322 strcpy(uName, pEnt->pw_name);
1332 struct passwd *pEnt, pStruct;
1339 rc = getpwuid_r(uID, &pStruct, pBuff,
sizeof(pBuff), &pEnt);
1341 if (!pEnt)
return ESRCH;
1345 if (uNsz <= (
int)strlen(pEnt->pw_name))
return ENAMETOOLONG;
1346 strcpy(uName, pEnt->pw_name);
1356 static const mode_t mMask = S_IRWXU | S_IRWXG | S_IRWXO;
1361 if (
stat(path, &buf))
1362 {
if (errno == ENOENT)
return "does not exist.";
1369 {
if (!S_ISDIR(buf.st_mode))
return "is not a directory.";
1371 if (!S_ISREG(buf.st_mode))
return "is not a file.";
1376 if ((buf.st_mode & mMask) & ~allow)
return "has excessive access rights.";
1392 if( (fd =
open( path, O_WRONLY|O_CREAT|O_TRUNC, 0644 )) < 0 )
1394 eDest.
Emsg(
"Config", errno,
"create pidfile" );
1398 if(
write( fd, buff, snprintf( buff,
sizeof(buff),
"%d",
1399 static_cast<int>(getpid()) ) ) < 0 )
1401 eDest.
Emsg(
"Config", errno,
"write to pidfile" );
1414 int statRet =
::stat(path,&buf);
1416 modificationTime = buf.st_mtime;
1423 while( str.size() && !isgraph(str[0]) ) str.erase(str.begin());
1427 while( str.size() && !isgraph(str[str.size()-1]) )
1428 str.resize (str.size () - 1);
1439 std::string
obfuscate(
const std::string &input,
const std::vector<std::regex> ®exes) {
1440 std::string result = input;
1441 for(
const auto & regex: regexes) {
1444 result = std::regex_replace(result, regex, std::string(
"$1" +
OBFUSCATION_STR));
static XrdSysError eDest(0,"crypto_")
uint32_t crc32c(uint32_t crc, void const *buf, size_t len)
static const std::vector< std::regex > authObfuscationRegexes
static const std::string OBFUSCATION_STR
std::string obfuscate(const std::string &input, const std::vector< std::regex > ®exes)
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)