42#include <sys/isa_defs.h>
45#include "XrdVersion.hh"
129 const char *configFn,
150char *FSLib[2] = {0,0};
151std::vector<std::string> FSLPath;
158static const int asDebug = 0x01;
159static const int asNoCache = 0x02;
179 const char *configFn,
180 const char *theParms);
184 char *adminp, *rdf, *bP, *tmp, buff[1024];
215 for (i = 1; i < pi->
argc; i++) xexpdo(pi->
argv[i]);
235 rdf = (parms && *parms ? parms : pi->
ConfigFN);
236 if (rdf && Config(rdf))
return 0;
248 else if (bad)
return 0;
260 eDest.
Say(
"Config warning: only '/tmp' will be exported.");
263 n += i+2; xp = xp->
Next();
269 bP = tmp = (
char *)malloc(n);
271 {strcpy(bP,
XPList.
Path(i)); bP += i, *bP++ =
' ';}
273 while(xp) {strcpy(bP, xp->
Path(i)); bP += i; *bP++ =
' '; xp = xp->
Next();}
279 if (!ConfigSecurity(xrootdEnv, pi->
ConfigFN))
return 0;
299 if (!ConfigMon(pi, xrootdEnv))
return 0;
303 if (!ConfigFS(xrootdEnv, pi->
ConfigFN))
return 0;
318 {
TRACE(
DEBUG,
"Loading dig filesystem builtin");
321 "remote debugging disabled!");
335 eDest.
Emsg(
"Config", tP->
text,
"checksum is not natively supported.");
340 if (csNum) csList +=
',';
354 if (!(asyncFlags & asDebug) &&
as_aioOK)
374 eDest.
Say(
"Config sendfile has been disabled by ", why);
387 ProtStack.
Set(n, 60*60);
397 sprintf(buff,
"%%s://%s:%d/&L=%%d&U=%%s", pi->
myName, pi->
Port);
404 if ((rdf = getenv(
"XRDREDIRECT"))
405 && (!strcmp(rdf,
"R") || !strcmp(rdf,
"M")))
417 eDest.
Say(
"Config warning: 'redirect client' ignored; "
418 "not a redirector nor a proxy server");
425 char buff[2048], puff[1024];
429 else sprintf(puff,
"%%%s:%d",
Route[k].Host[1],
Route[k].
Port[1]);
430 sprintf(buff,
" to %s:%d%s",
Route[k].Host[0],
Route[k].
Port[0],puff);
438 const char *cgi1, *cgi2;
439 char buff[2048], puff[1024], xCgi[RD_Num] = {0};
440 if (
isRedir) {cgi1 =
"+"; cgi2 = getenv(
"XRDCMSCLUSTERID");}
441 else {cgi1 =
""; cgi2 = pi->
myName;}
442 myCNlen = snprintf(buff,
sizeof(buff),
"%s%s", cgi1, cgi2);
447 else sprintf(puff,
"%%%s:%d",
Route[k].Host[1],
Route[k].
Port[1]);
448 sprintf(buff,
" to %s:%d%s",
Route[k].Host[0],
Route[k].
Port[0],puff);
450 if (!xCgi[k] && cgi2)
453 for (i = 0; i < 2; i++)
454 {n = snprintf(buff,
sizeof(buff),
"%s?tried=%s%s",
455 Route[k].Host[i], cgi1, cgi2);
504 {
const char *penv = getenv(
"XRDXROOTD_PROXY");
505 if (!penv || *penv !=
'=')
507 eDest.
Say(
"Config warning: 'fsoverload bypass' ignored; "
508 "not a forwarding proxy.");
534#define TS_Xeq(x,m) (!strcmp(x,var)) GoNo = m(Config)
535#define TS_Zeq(x,m) (!strcmp(x,var)) GoNo = m(&eDest, Config)
537int XrdXrootdProtocol::Config(
const char *ConfigFN)
542 int cfgFD, GoNo, NoGo = 0, ismine;
546 if ((cfgFD =
open(ConfigFN, O_RDONLY, 0)) < 0)
547 return eDest.
Emsg(
"Config", errno,
"open config file", ConfigFN);
548 Config.Attach(cfgFD);
552 static const char *cvec[] = {
"*** xroot protocol config:", 0 };
553 Config.Capture(cvec);
557 while((var = Config.GetMyFirstWord()))
558 {
if ((ismine = !strncmp(
"xrootd.", var, 7)) && var[7]) var += 7;
559 else if ((ismine = !strcmp(
"all.export", var))) var += 4;
560 else if ((ismine = !strcmp(
"all.seclib", var))) var += 4;
563 {
if TS_Xeq(
"async", xasync);
564 else if TS_Xeq(
"bindif", xbif);
565 else if TS_Xeq(
"chksum", xcksum);
566 else if TS_Xeq(
"diglib", xdig);
567 else if TS_Xeq(
"export", xexp);
568 else if TS_Xeq(
"fslib", xfsl);
569 else if TS_Xeq(
"fsoverload", xfso);
570 else if TS_Xeq(
"gpflib", xgpf);
571 else if TS_Xeq(
"log", xlog);
572 else if TS_Xeq(
"mongstream", xmongs);
573 else if TS_Xeq(
"monitor", xmon);
575 else if TS_Xeq(
"prep", xprep);
576 else if TS_Xeq(
"redirect", xred);
577 else if TS_Xeq(
"seclib", xsecl);
578 else if TS_Xeq(
"tls", xtls);
579 else if TS_Xeq(
"tlsreuse", xtlsr);
580 else if TS_Xeq(
"trace", xtrace);
581 else if TS_Xeq(
"limit", xlimit);
582 else {
if (!strcmp(var,
"pidpath"))
583 {
eDest.
Say(
"Config warning: 'xrootd.pidpath' no longer "
584 "supported; use 'all.pidpath'.");
586 eDest.
Say(
"Config warning: ignoring unknown "
587 "directive '", var,
"'.");
592 if (GoNo) {Config.Echo(); NoGo = 1;}
602 {
eDest.
Say(
"Config failure: unable to setup TLS for protocol!");
605 static const char *sessID =
"xroots";
622int XrdXrootdProtocol::CheckTLS(
const char *tlsProt)
642 {
eDest.
Say(
"Config Authentication protocol(s)", tlsProt,
643 " require TLS; login now requires TLS.");
651 {
eDest.
Say(
"Config failure: unable to honor TLS requirement; "
652 "TLS not configured!");
665bool XrdXrootdProtocol::ConfigFS(
XrdOucEnv &xEnv,
const char *cfn)
673 {
TRACE(
DEBUG,
"Loading base filesystem library " <<FSLib[0]);
684 {
eDest.
Emsg(
"Config",
"Unable to load base file system using", fsLoc);
691 if (FSLib[1] && !ConfigFS(FSLib[1], xEnv, cfn))
return false;
695 if ((n = FSLPath.size()))
696 for (
int i = 0; i < n; i++)
697 {
if (!ConfigFS(FSLPath[i].c_str(), xEnv, cfn))
return false;}
710bool XrdXrootdProtocol::ConfigFS(
const char *path,
XrdOucEnv &xEnv,
716 TRACE(
DEBUG,
"Loading wrapper filesystem library " <<path);
719 {
eDest.
Emsg(
"Config",
"Unable to load file system wrapper from", path);
730int XrdXrootdProtocol::ConfigSecurity(
XrdOucEnv &xEnv,
const char *cfn)
759 {
eDest.
Say(
"Config warning: 'xrootd.seclib' not specified;"
760 " strong authentication disabled!");
761 xEnv.
PutPtr(
"XrdSecGetProtocol*", (
void *)0);
762 xEnv.
PutPtr(
"XrdSecProtector*" , (
void *)0);
768 TRACE(
DEBUG,
"Loading security library " <<SecLib);
773 (strcmp(SecLib,
"default") ? SecLib : 0),
775 {
eDest.
Emsg(
"Config",
"Unable to load security system.");
781 xEnv.
PutPtr(
"XrdSecGetProtocol*", (
void *)secGetProt);
782 xEnv.
PutPtr(
"XrdSecProtector*" , (
void *)
DHS);
787 if (tlsProt)
return CheckTLS(tlsProt);
833 int V_force=-1, V_syncw = -1, V_off = -1, V_mstall = -1, V_nosf = -1;
834 int V_limit=-1, V_msegs=-1, V_mtot=-1, V_minsz=-1, V_segsz=-1;
835 int V_minsf=-1, V_debug=-1, V_noca=-1, V_tmo=-1;
837 struct asyncopts {
const char *opname;
int minv;
int *oploc;
838 const char *opmsg;} asopts[] =
840 {
"Debug", -1, &V_debug,
""},
841 {
"force", -1, &V_force,
""},
842 {
"off", -1, &V_off,
""},
843 {
"nocache", -1, &V_noca,
""},
844 {
"nosf", -1, &V_nosf,
""},
845 {
"syncw", -1, &V_syncw,
""},
846 {
"limit", 0, &V_limit,
"async limit"},
847 {
"segsize", 4096, &V_segsz,
"async segsize"},
848 {
"timeout", 0, &V_tmo,
"async timeout"},
849 {
"maxsegs", 0, &V_msegs,
"async maxsegs"},
850 {
"maxstalls", 0, &V_mstall,
"async maxstalls"},
851 {
"maxtot", 0, &V_mtot,
"async maxtot"},
852 {
"minsfsz", 1, &V_minsf,
"async minsfsz"},
853 {
"minsize", 4096, &V_minsz,
"async minsize"}};
854 int numopts =
sizeof(asopts)/
sizeof(
struct asyncopts);
856 if (!(val =
Config.GetWord()))
857 {
eDest.
Emsg(
"Config",
"async option not specified");
return 1;}
860 {
for (i = 0; i < numopts; i++)
861 if (!strcmp(val, asopts[i].opname))
862 {
if (asopts[i].minv >= 0 && !(val =
Config.GetWord()))
863 {
eDest.
Emsg(
"Config",
"async",(
char *)asopts[i].opname,
864 "value not specified");
867 if (asopts[i].minv > 0)
869 (
long long)asopts[i].minv))
return 1;
870 else *asopts[i].oploc = (int)llp;
871 else if (asopts[i].minv == 0)
874 else *asopts[i].oploc = ppp;
875 else *asopts[i].oploc = 1;
879 eDest.
Emsg(
"Config",
"Warning, invalid async option", val);
885 if (V_limit > 0 && V_mtot > 0 && V_limit > V_mtot)
886 {
eDest.
Emsg(
"Config",
"async limit may not be greater than maxtot");
894 if (!i) {
eDest.
Emsg(
"Config",
"async segsize is too large");
return 1;}
897 sprintf(buff,
"%d readjusted to %d", V_segsz, i);
898 eDest.
Emsg(
"Config",
"async segsize", buff);
907 if (V_tmo < 1) i = 1;
908 else if (V_tmo > 360) i = 360;
911 sprintf(buff,
"%d readjusted to %d", V_tmo, i);
912 eDest.
Emsg(
"Config",
"async timeout", buff);
926 if (V_debug > 0) asyncFlags |= asDebug;
930 if (V_noca > 0) asyncFlags |= asNoCache;
931 if (V_nosf > 0)
as_nosf =
true;
961 char *bHost[2], *val, buff[512];
962 int bPort[2], thePort;
967 {
if (bifResp[1] != bifResp[0]) free(bifResp[1]);
977 while((val =
Config.GetWord()) && *val)
978 {
if (!xred_php(val, bHost, bPort,
"bindif",
true))
return 1;
979 for (
int i = 0; i < 2 && bHost[i] != 0; i++)
981 snprintf(buff,
sizeof(buff),
"%s%s:%d",
982 (bSpec[i].length() ?
"," :
""), bHost[i], thePort);
989 for (
int i = 0; i < 2 && bSpec[i].
length(); i++)
990 {
int n = brSize + bSpec[i].
length() + 1;
993 memset(bifRec, 0, n);
996 strcpy(((
char *)bifRec)+brSize, bSpec[i].c_str());
1003 if (bifResp[0] && bifResp[1] == 0)
1037 char *palg, prog[2048];
1038 int jmax = 4, anum[2] = {0,0};
1043 while ((palg =
Config.GetWord()) && *palg !=
'/')
1044 {
if (!strcmp(palg,
"chkcgi")) {
JobCKCGI = 1;
continue;}
1045 if (strcmp(palg,
"max"))
1048 if (algLast) algLast->next = xalg;
1049 else algFirst = xalg;
1053 if (!(palg =
Config.GetWord()))
1054 {
eDest.
Emsg(
"Config",
"chksum max not specified");
return 1;}
1061 {
eDest.
Emsg(
"Config",
"chksum algorithm not specified");
return 1;}
1074 {
int n = strlen(palg);
1075 if (n+2 >= (
int)
sizeof(prog))
1076 {
eDest.
Emsg(
"Config",
"cksum program too long");
return 1;}
1077 strcpy(prog, palg); palg = prog+n; *palg++ =
' '; n =
sizeof(prog)-n-1;
1078 if (!
Config.GetRest(palg, n))
1079 {
eDest.
Emsg(
"Config",
"cksum parameters too long");
return 1;}
1086 else {
JobLCL = 1; Proc = &CheckSum; strcpy(prog,
"chksum");}
1091 if (theProg->
Setup(prog, &
eDest, Proc))
return 1;
1114 char parms[4096], *val;
1118 if (!(val =
Config.GetWord()))
1119 {
eDest.
Emsg(
"Config",
"diglib not specified");
return 1;}
1123 if (strcmp(val,
"*"))
1124 {
eDest.
Emsg(
"Config",
"builtin diglib not specified");
return 1;}
1128 if (!
Config.GetRest(parms,
sizeof(parms)))
1129 {
eDest.
Emsg(
"Config",
"diglib parameters too long");
return 1;}
1130 if (digParm) free(digParm);
1131 digParm = strdup(parms);
1153 char *val, pbuff[1024];
1159 if (!val || !val[0])
1160 {
eDest.
Emsg(
"Config",
"export path not specified");
return 1;}
1161 strlcpy(pbuff, val,
sizeof(pbuff));
1165 while((val =
Config.GetWord()))
1167 else if (!strcmp(
"lock", val)) popt &= ~XROOTDXP_NOLK;
1169 else {
Config.RetToken();
break;}
1174 return xexpdo(pbuff, popt);
1179int XrdXrootdProtocol::xexpdo(
char *path,
int popt)
1189 {
if (*(path+1) ==
'?') popt &= ~XROOTDXP_NOCGI;
1190 else {
eDest.
Emsg(
"Config",
"invalid export path -",path);
return 1;}
1198 if (rpCheck(path, &opaque))
1199 {
eDest.
Emsg(
"Config",
"non-absolute export path -", path);
return 1;}
1203 if (!(xopt = Squash(path)) || xopt != (popt|
XROOTDXP_OK))
1236 if (!(val =
Config.GetWord()))
1237 {
eDest.
Emsg(
"Config",
"fslib not specified");
return 1;}
1241 if (!strcmp(
"++", val))
1242 {
if (!(val =
Config.GetWord()))
1243 {
eDest.
Emsg(
"Config",
"fslib wrapper not specified");
return 1;}
1244 if (strcmp(
"throttle", val)) FSLPath.push_back((std::string)val);
1245 else FSLPath.push_back(
"libXrdThrottle.so");
1251 if (FSLib[0]) {free(FSLib[0]); FSLib[0] = 0;}
1252 if (FSLib[1]) {free(FSLib[1]); FSLib[1] = 0;}
1256 if (!strcmp(
"throttle", val))
1257 {FSLib[1] = strdup(
"libXrdThrottle.so");
1258 if (!(val =
Config.GetWord()))
1259 {
eDest.
Emsg(
"Config",
"fslib throttle target library not specified");
1262 return xfsL(Config, val, 0);
1267 if (xfsL(Config, val, 1))
return 1;
1268 if (!FSLib[1])
return 0;
1272 if (!(val =
Config.GetWord()))
1273 {FSLib[0] = FSLib[1]; FSLib[1] = 0;
1279 return xfsL(Config, val, 0);
1284int XrdXrootdProtocol::xfsL(
XrdOucStream &Config,
char *val,
int lix)
1290 if (!strcmp(val,
"-2"))
1291 {
if (!(val =
Config.GetWord()))
1292 {
eDest.
Emsg(
"Config",
"fslib not specified");
return 1;}
1298 if (!strcmp(
"default", val))
return 0;
1303 if (!(Slash = rindex(val,
'/'))) Slash = val;
1305 if (!strcmp(Slash,
"libXrdOfs.so"))
1306 eDest.
Say(
"Config warning: 'fslib libXrdOfs.so' is actually built-in.");
1307 else FSLib[lix] = strdup(val);
1331 static const int rHLen = 264;
1332 char rHost[2][rHLen], *hP[2] = {0,0}, *val;
1333 int rPort[2], bypass = -1, stall = -1;
1337 while((val =
Config.GetWord()) && *val)
1338 {
if (!strcmp(val,
"bypass")) bypass = 1;
1339 else if (!strcmp(val,
"nobypass")) bypass = 0;
1340 else if (!strcmp(val,
"redirect"))
1342 if (!xred_php(val, hP, rPort,
"redirect"))
return 1;
1343 for (
int i = 0; i < 2; i++)
1344 {
if (!hP[i]) rHost[i][0] = 0;
1345 else {
strlcpy(rHost[i], hP[i], rHLen);
1350 else if (!strcmp(val,
"stall"))
1351 {
if (!(val =
Config.GetWord()) || !(*val))
1352 {
eDest.
Emsg(
"Config",
"stall value not specified");
1358 else {
eDest.
Emsg(
"config",
"invalid fsoverload option",val);
return 1;}
1363 if (bypass >= 0)
OD_Bypass = (bypass ? true :
false);
1366 {
if (
Route[RD_ovld].Host[0]) free(
Route[RD_ovld].Host[0]);
1367 if (
Route[RD_ovld].Host[1]) free(
Route[RD_ovld].Host[1]);
1372 {
Route[RD_ovld].
Host[1] = strdup(hP[1]);
1402 char parms[4096], *val;
1406 if (gpfLib) {free(gpfLib); gpfLib = 0;}
1407 if (gpfParm) {free(gpfParm); gpfParm = 0;}
1411 if (!(val =
Config.GetWord()))
1412 {
eDest.
Emsg(
"Config",
"gpflib not specified");
return 1;}
1416 if (strcmp(val,
"default")) gpfLib = strdup(val);
1420 if (!
Config.GetRest(parms,
sizeof(parms)))
1421 {
eDest.
Emsg(
"Config",
"gpflib parameters too long");
return 1;}
1422 gpfParm = strdup(parms);
1445 static struct logopts {
const char *opname;
int opval;} lgopts[] =
1451 int i, neg, lgval = -1, numopts =
sizeof(lgopts)/
sizeof(
struct logopts);
1453 if (!(val =
Config.GetWord()))
1454 {
eDest.
Emsg(
"config",
"log option not specified");
return 1;}
1456 {
if ((neg = (val[0] ==
'-' && val[1]))) val++;
1457 for (i = 0; i < numopts; i++)
1458 {
if (!strcmp(val, lgopts[i].opname))
1459 {
if (neg) lgval &= ~lgopts[i].opval;
1460 else lgval |= lgopts[i].opval;
1464 if (i >= numopts)
eDest.
Emsg(
"config",
"invalid log option",val);
1486{
int rc, keep = 0, scrub=0;
1487 char *ldir=0,*val,buff[1024];
1489 if (!(val =
Config.GetWord()))
1490 {
eDest.
Emsg(
"Config",
"prep options not specified");
return 1;}
1492 do {
if (!strcmp(
"keep", val))
1493 {
if (!(val =
Config.GetWord()))
1494 {
eDest.
Emsg(
"Config",
"prep keep value not specified");
1499 else if (!strcmp(
"scrub", val))
1500 {
if (!(val =
Config.GetWord()))
1501 {
eDest.
Emsg(
"Config",
"prep scrub value not specified");
1506 else if (!strcmp(
"logdir", val))
1507 {
if (!(ldir =
Config.GetWord()))
1508 {
eDest.
Emsg(
"Config",
"prep logdir value not specified");
1512 else eDest.
Emsg(
"Config",
"Warning, invalid prep option", val);
1513 }
while((val =
Config.GetWord()));
1522 {
eDest.
Emsg(
"Config", rc,
"process logdir", ldir);
1557 static struct rediropts {
const char *opname; RD_func opval;} rdopts[] =
1559 {
"chmod", RD_chmod},
1560 {
"chksum", RD_chksum},
1561 {
"dirlist", RD_dirlist},
1562 {
"locate", RD_locate},
1563 {
"mkdir", RD_mkdir},
1565 {
"prepare", RD_prepare},
1566 {
"prepstage",RD_prepstg},
1568 {
"rmdir", RD_rmdir},
1572 static const int rHLen = 264;
1573 char rHost[2][rHLen], *hP[2], *val;
1574 int i, k, neg, numopts =
sizeof(rdopts)/
sizeof(
struct rediropts);
1575 int rPort[2], isQ = 0;
1580 if (!xred_php(val, hP, rPort,
"redirect"))
return 1;
1584 for (i = 0; i < 2; i++)
1585 {
if (!hP[i]) rHost[i][0] = 0;
1586 else {
strlcpy(rHost[i], hP[i], rHLen);
1593 if (!(val =
Config.GetWord()))
1594 {
eDest.
Emsg(
"config",
"redirect option not specified");
return 1;}
1598 if (!strcmp(
"client", val))
return xred_clnt(Config, hP, rPort);
1600 if (*val ==
'/' || (isQ = ((*val ==
'?') || !strcmp(val,
"enoent"))))
1603 if (!(val =
Config.GetWord()))
1604 {
eDest.
Emsg(
"Config",
"redirect path not specified.");
1608 {
eDest.
Emsg(
"Config",
"non-absolute redirect path -", val);
1612 for (k =
static_cast<int>(RD_open1); k < RD_Num; k++)
1613 if (xred_xok(k, hP, rPort))
break;
1615 {
eDest.
Emsg(
"Config",
"too many different path redirects");
return 1;}
1616 xred_set(RD_func(k), hP, rPort);
1619 if ((val =
Config.GetWord()) && *val !=
'/')
1620 {
eDest.
Emsg(
"Config",
"non-absolute redirect path -", val);
1628 {
if (!strcmp(val,
"all"))
1629 {
for (i = 0; i < numopts; i++)
1630 xred_set(rdopts[i].opval, hP, rPort);
1632 else {
if ((neg = (val[0] ==
'-' && val[1]))) val++;
1633 for (i = 0; i < numopts; i++)
1634 {
if (!strcmp(val, rdopts[i].opname))
1635 {
if (neg) xred_set(rdopts[i].opval, 0, 0);
1636 else xred_set(rdopts[i].opval, hP, rPort);
1641 eDest.
Emsg(
"config",
"invalid redirect option", val);
1650int XrdXrootdProtocol::xred_clnt(
XrdOucStream &Config,
char *hP[2],
int rPort[2])
1669 if (!(val =
Config.GetWord()))
1670 {
eDest.
Emsg(
"Config",
"redirect client argument not specified.");
1677 else if (*val ==
'.')
1680 "Too many redirect client domains specified.");
1685 else {
eDest.
Emsg(
"Config",
"Invalid redirect client domain -", val);
1693 xred_set(RD_client, hP, rPort);
1699bool XrdXrootdProtocol::xred_php(
char *val,
char *hP[2],
int rPort[2],
1700 const char *what,
bool optport)
1707 if (!val || !(*val))
1708 {
eDest.
Emsg(
"config", what,
"argument not specified");
return false;}
1713 if (!(pp = index(val,
'%'))) hP[1] = 0;
1714 else {hP[1] = pp+1; *pp = 0;}
1718 if (!(*val) || (hP[1] && !*hP[1]))
1719 {
eDest.
Emsg(
"Config",
"malformed", what,
"host specification");
1725 for (
int i = 0; i < 2; i++)
1726 {
if (!(val = hP[i]))
break;
1727 if (!val || !val[0] || val[0] ==
':')
1728 {
eDest.
Emsg(
"Config", what,
"host not specified");
return false;}
1729 if ((pp = rindex(val,
':')))
1734 if (optport) rPort[i] = 0;
1735 else {
eDest.
Emsg(
"Config", what,
"port not specified");
1739 const char *eText = testAddr.
Set(val, 0);
1742 eDest.
Say(
"Config warning: ", eText,
" as ", val);
1743 else {
eDest.
Say(
"Config failure: ", what,
" target ", val,
1744 " is invalid; ", eText);
1755void XrdXrootdProtocol::xred_set(RD_func func,
char *rHost[2],
int rPort[2])
1760 if (
Route[func].Host[0]) free(
Route[func].Host[0]);
1761 if (
Route[func].Host[0] !=
Route[func].Host[1]) free(
Route[func].Host[1]);
1764 {
Route[func].
Host[0] = strdup(rHost[0]);
1781bool XrdXrootdProtocol::xred_xok(
int func,
char *rHost[2],
int rPort[2])
1783 if (!
Route[func].Host[0])
return true;
1785 if (strcmp(
Route[func].Host[0], rHost[0])
1786 ||
Route[func].
Port[0] != rPort[0])
return false;
1790 if (strcmp(
Route[func].Host[1], rHost[1])
1791 ||
Route[func].
Port[1] != rPort[1])
return false;
1817 if (!val || !val[0])
1818 {
eDest.
Emsg(
"Config",
"seclib argument not specified");
return 1;}
1822 if (SecLib) free(SecLib);
1823 SecLib = strdup(val);
1857 static struct enforceopts {
const char *opname;
int opval;
int enval;}
1868 int i, numopts =
sizeof(enfopts)/
sizeof(
struct enforceopts);
1869 bool neg, forall =
true;
1871 if (!(val =
Config.GetWord()))
1872 {
eDest.
Emsg(
"config",
"tls parameter not specified");
return 1;}
1874 if (!strcmp(
"capable", val))
1876 if (!(val =
Config.GetWord()))
1877 {
eDest.
Emsg(
"config",
"tls requirement not specified");
return 1;}
1881 {
if (!strcmp(val,
"off") || !strcmp(val,
"none"))
1886 if ((neg = (val[0] ==
'-' && val[1]))) val++;
1887 for (i = 0; i < numopts; i++)
1888 {
if (!strcmp(val, enfopts[i].opname))
1889 {
if (neg)
myRole &= ~enfopts[i].opval;
1890 else myRole |= enfopts[i].opval;
1891 if (neg)
tlsCap &= ~enfopts[i].enval;
1892 else tlsCap |= enfopts[i].enval;
1894 {
if (neg)
tlsNot &= ~enfopts[i].enval;
1895 else tlsNot |= enfopts[i].enval;
1901 {
eDest.
Emsg(
"config",
"Invalid tls requirement -", val);
1919 return (CheckTLS(0) ? 0 : 1);
1946 if (!val || !val[0])
1947 {
eDest.
Emsg(
"Config",
"tlsreuse argument not specified");
return 1;}
1951 if (!strcmp(val,
"off"))
1958 if (!strcmp(val,
"on"))
1960 "'tlsreuse on'; TLS not configured!");
1964 if (!(val =
Config.GetWord()))
return 0;
1965 if (!strcmp(val,
"flush" ))
1966 {
if (!(val =
Config.GetWord()))
1967 {
eDest.
Emsg(
"Config",
"tlsreuse flush value not specified");
1971 if (num < 60) num = 60;
1980 eDest.
Emsg(
"config",
"Invalid tlsreuse option -", val);
2001 static struct traceopts {
const char *opname;
int opval;} tropts[] =
2018 int i, neg, trval = 0, numopts =
sizeof(tropts)/
sizeof(
struct traceopts);
2020 if (!(val =
Config.GetWord()))
2021 {
eDest.
Emsg(
"config",
"trace option not specified");
return 1;}
2023 {
if (!strcmp(val,
"off")) trval = 0;
2024 else {
if ((neg = (val[0] ==
'-' && val[1]))) val++;
2025 for (i = 0; i < numopts; i++)
2026 {
if (!strcmp(val, tropts[i].opname))
2027 {
if (neg) trval &= ~tropts[i].opval;
2028 else trval |= tropts[i].opval;
2033 eDest.
Emsg(
"config",
"invalid trace option", val);
2064 while ( (word =
Config.GetWord()) ) {
2065 if (!strcmp(word,
"prepare")) {
2066 if (!(word =
Config.GetWord()))
2068 eDest.
Emsg(
"Config",
"'limit prepare' value not specified");
2072 }
else if (!strcmp(word,
"noerror")) {
static XrdSysLogger Logger
XrdSfsFileSystem * XrdDigGetFS(XrdSfsFileSystem *native_fs, XrdSysLogger *lp, const char *cFN, const char *parms)
XrdOucTrace * XrdXrootdTrace
XrdSfsFileSystem * XrdSfsGetDefaultFileSystem(XrdSfsFileSystem *native_fs, XrdSysLogger *lp, const char *configfn, XrdOucEnv *EnvInfo)
XrdSecProtocol *(* XrdSecGetProt_t)(const char *hostname, XrdNetAddrInfo &endPoint, XrdSecParameters §oken, XrdOucErrInfo *einfo)
Typedef to simplify the encoding of methods returning XrdSecProtocol.
XrdSecService * XrdSecLoadSecService(XrdSysError *eDest, const char *cfn, const char *seclib, XrdSecGetProt_t *getP, XrdSecProtector **proP)
const char * XrdXrootdInstance
XrdSysTrace XrdXrootdTrace
XrdXrootdPrepare * XrdXrootdPrepQ
XrdSfsFileSystem * XrdXrootdloadFileSystem(XrdSysError *, XrdSfsFileSystem *, const char *, const char *, XrdOucEnv *)
XrdSfsFileSystem * XrdSfsGetDefaultFileSystem(XrdSfsFileSystem *nativeFS, XrdSysLogger *Logger, const char *configFn, XrdOucEnv *EnvInfo)
XrdOucString * XrdXrootdCF
static bool isHostName(const char *name)
const char * Set(const char *hSpec, int pNum=PortInSpec)
void Display(const char *pfx="=====> ")
static int Parse(XrdSysError *eLog, XrdOucStream &Config)
static XrdNetPMark * Config(XrdSysError *eLog, XrdScheduler *sched, XrdSysTrace *trc, bool &fatal)
static XrdNetSocket * Create(XrdSysError *Say, const char *path, const char *fn, mode_t mode, int isudp=0)
void Set(int inQMax, time_t agemax=1800)
long GetInt(const char *varname)
char * Get(const char *varname)
static int Export(const char *Var, const char *Val)
void PutPtr(const char *varname, void *value)
int Setup(const char *prog, XrdSysError *errP=0, int(*Proc)(XrdOucStream *, char **, int)=0)
const char * c_str() const
static const mode_t pathMode
static char * genPath(const char *path, const char *inst, const char *psfx=0)
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 int makePath(char *path, mode_t mode, bool reset=false)
static void toLower(char *str)
static int a2i(XrdSysError &, const char *emsg, const char *item, int *val, int minv=-1, int maxv=-1)
static int a2sz(XrdSysError &, const char *emsg, const char *item, long long *val, long long minv=-1, long long maxv=-1)
static int a2tm(XrdSysError &, const char *emsg, const char *item, int *val, int minv=-1, int maxv=-1)
static int a2p(XrdSysError &, const char *ptype, const char *val, bool anyOK=true)
virtual const char * protTLS()=0
virtual void EnvInfo(XrdOucEnv *envP)
virtual int chksum(csFunc Func, const char *csName, const char *path, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0, const char *opaque=0)
virtual int FAttr(XrdSfsFACtl *faReq, XrdOucErrInfo &eInfo, const XrdSecEntity *client=0)
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)
void setMsgMask(int mask)
XrdSysLogger * logger(XrdSysLogger *lp=0)
XrdTlsContext * Clone(bool full=true, bool startCRLRefresh=false)
int SessionCache(int opts=scNone, const char *id=0, int idlen=0)
static const int scNone
Do not change any option settings.
static const int scOff
Turn off cache.
static const int scSrvr
Turn on cache server mode (default)
static int Init(XrdSysError *erp, XrdNetSocket *asock)
static void addJob(const char *jname, XrdXrootdJob *jp)
static void setVals(XrdSysError *erp, XrdXrootdStats *SIp, XrdScheduler *schp, int port)
static void Init(XrdXrootdFileLock *lp, XrdSysError *erP, bool sfok)
static int setParms(int stime, int skeep)
static XrdXrootdStats * SI
static const char * myInst
static XrdSfsFileSystem * digFS
static XrdNetPMark * PMark
static short as_okstutter
static XrdXrootdXPath RPList
static XrdNetSocket * AdminSock
static const char Req_TLSGPFile
static const char Req_TLSSess
static XrdXrootdJob * JobCKS
static XrdSysError & eDest
static const char * myCName
static const char Req_TLSData
static XrdXrootdFileLock * Locker
static const char Req_TLSTPC
static XrdTlsContext * tlsCtx
static XrdXrootdXPath XPList
static XrdScheduler * Sched
static struct XrdXrootdProtocol::RC_Table RouteClient
static const char * myUName
static const char Req_TLSLogin
static int Configure(char *parms, XrdProtocol_Config *pi)
static XrdOucTList * JobCKTLST
static XrdXrootdXPath RQList
static struct XrdXrootdProtocol::RD_Table Route[RD_Num]
static XrdSecProtector * DHS
static XrdBuffManager * BPool
static XrdSecService * CIA
static const char * myGName
static uint64_t fsFeatures
static XrdOucReqID * PrepID
static XrdSfsFileSystem * osFS
void setFS(XrdSfsFileSystem *fsp)
static void Init(XrdScheduler *schedP, int qMax, int qTTL)
Perform one-time initialization.
void Insert(const char *pd, int popt=0, int flags=XROOTDXP_OK)
void Set(int opts, const char *pathdata=0)
struct ServerResponseBifs_Protocol bifReqs
static const int maxRvecsz
static const uint64_t hasPGRW
Feature: pgRead and pgWrite.
static const uint64_t hasPRP2
Feature: Prepare Handler Version 2 (different calling conventions)
static const uint64_t hasGPFA
Feature: gpFile anonymous.
static const uint64_t hasCACH
Feature: Implements a data cache.
static const uint64_t hasNOSF
Feature: Supports no sendfile.
static const uint64_t hasPOSC
Feature: Persist On Successful Close.
static const uint64_t hasGPF
Feature: gpFile.
static const uint64_t hasNAIO
Feature: Supports no async I/O.
static const uint64_t hasPRXY
Feature: Proxy Server.