36 #include <sys/param.h>
38 #include <sys/types.h>
42 #include <sys/isa_defs.h>
45 #include "XrdVersion.hh"
129 const char *configFn,
150 char *FSLib[2] = {0,0};
151 std::vector<std::string> FSLPath;
158 static const int asDebug = 0x01;
159 static 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")))
418 eDest.
Say(
"Config warning: 'redirect client' ignored; "
419 "not a redirector nor a proxy server");
426 char buff[2048], puff[1024];
430 else sprintf(puff,
"%%%s:%d",
Route[k].Host[1],
Route[k].
Port[1]);
431 sprintf(buff,
" to %s:%d%s",
Route[k].Host[0],
Route[k].
Port[0],puff);
439 const char *cgi1, *cgi2;
440 char buff[2048], puff[1024], xCgi[RD_Num] = {0};
441 if (
isRedir) {cgi1 =
"+"; cgi2 = getenv(
"XRDCMSCLUSTERID");}
442 else {cgi1 =
""; cgi2 = pi->
myName;}
443 myCNlen = snprintf(buff,
sizeof(buff),
"%s%s", cgi1, cgi2);
448 else sprintf(puff,
"%%%s:%d",
Route[k].Host[1],
Route[k].
Port[1]);
449 sprintf(buff,
" to %s:%d%s",
Route[k].Host[0],
Route[k].
Port[0],puff);
451 if (!xCgi[k] && cgi2)
454 for (i = 0; i < 2; i++)
455 {n = snprintf(buff,
sizeof(buff),
"%s?tried=%s%s",
456 Route[k].Host[i], cgi1, cgi2);
505 {
const char *penv = getenv(
"XRDXROOTD_PROXY");
506 if (!penv || *penv !=
'=')
508 eDest.
Say(
"Config warning: 'fsoverload bypass' ignored; "
509 "not a forwarding proxy.");
535 #define TS_Xeq(x,m) (!strcmp(x,var)) GoNo = m(Config)
536 #define TS_Zeq(x,m) (!strcmp(x,var)) GoNo = m(&eDest, Config)
538 int XrdXrootdProtocol::Config(
const char *ConfigFN)
543 int cfgFD, GoNo, NoGo = 0, ismine;
547 if ((cfgFD =
open(ConfigFN, O_RDONLY, 0)) < 0)
548 return eDest.
Emsg(
"Config", errno,
"open config file", ConfigFN);
549 Config.Attach(cfgFD);
553 static const char *cvec[] = {
"*** xroot protocol config:", 0 };
554 Config.Capture(cvec);
558 while((var = Config.GetMyFirstWord()))
559 {
if ((ismine = !strncmp(
"xrootd.", var, 7)) && var[7]) var += 7;
560 else if ((ismine = !strcmp(
"all.export", var))) var += 4;
561 else if ((ismine = !strcmp(
"all.seclib", var))) var += 4;
564 {
if TS_Xeq(
"async", xasync);
565 else if TS_Xeq(
"bindif", xbif);
566 else if TS_Xeq(
"chksum", xcksum);
567 else if TS_Xeq(
"diglib", xdig);
568 else if TS_Xeq(
"export", xexp);
569 else if TS_Xeq(
"fslib", xfsl);
570 else if TS_Xeq(
"fsoverload", xfso);
571 else if TS_Xeq(
"gpflib", xgpf);
572 else if TS_Xeq(
"log", xlog);
573 else if TS_Xeq(
"mongstream", xmongs);
574 else if TS_Xeq(
"monitor", xmon);
576 else if TS_Xeq(
"prep", xprep);
577 else if TS_Xeq(
"redirect", xred);
578 else if TS_Xeq(
"seclib", xsecl);
579 else if TS_Xeq(
"tls", xtls);
580 else if TS_Xeq(
"tlsreuse", xtlsr);
581 else if TS_Xeq(
"trace", xtrace);
582 else if TS_Xeq(
"limit", xlimit);
583 else {
if (!strcmp(var,
"pidpath"))
584 {
eDest.
Say(
"Config warning: 'xrootd.pidpath' no longer "
585 "supported; use 'all.pidpath'.");
587 eDest.
Say(
"Config warning: ignoring unknown "
588 "directive '", var,
"'.");
593 if (GoNo) {Config.Echo(); NoGo = 1;}
603 {
eDest.
Say(
"Config failure: unable to setup TLS for protocol!");
606 static const char *sessID =
"xroots";
623 int XrdXrootdProtocol::CheckTLS(
const char *tlsProt)
643 {
eDest.
Say(
"Config Authentication protocol(s)", tlsProt,
644 " require TLS; login now requires TLS.");
652 {
eDest.
Say(
"Config failure: unable to honor TLS requirement; "
653 "TLS not configured!");
666 bool XrdXrootdProtocol::ConfigFS(
XrdOucEnv &xEnv,
const char *cfn)
674 {
TRACE(
DEBUG,
"Loading base filesystem library " <<FSLib[0]);
685 {
eDest.
Emsg(
"Config",
"Unable to load base file system using", fsLoc);
692 if (FSLib[1] && !ConfigFS(FSLib[1], xEnv, cfn))
return false;
696 if ((n = FSLPath.size()))
697 for (
int i = 0; i < n; i++)
698 {
if (!ConfigFS(FSLPath[i].c_str(), xEnv, cfn))
return false;}
711 bool XrdXrootdProtocol::ConfigFS(
const char *path,
XrdOucEnv &xEnv,
717 TRACE(
DEBUG,
"Loading wrapper filesystem library " <<path);
720 {
eDest.
Emsg(
"Config",
"Unable to load file system wrapper from", path);
731 int XrdXrootdProtocol::ConfigSecurity(
XrdOucEnv &xEnv,
const char *cfn)
760 {
eDest.
Say(
"Config warning: 'xrootd.seclib' not specified;"
761 " strong authentication disabled!");
762 xEnv.
PutPtr(
"XrdSecGetProtocol*", (
void *)0);
763 xEnv.
PutPtr(
"XrdSecProtector*" , (
void *)0);
769 TRACE(
DEBUG,
"Loading security library " <<SecLib);
774 (strcmp(SecLib,
"default") ? SecLib : 0),
776 {
eDest.
Emsg(
"Config",
"Unable to load security system.");
782 xEnv.
PutPtr(
"XrdSecGetProtocol*", (
void *)secGetProt);
783 xEnv.
PutPtr(
"XrdSecProtector*" , (
void *)
DHS);
788 if (tlsProt)
return CheckTLS(tlsProt);
834 int V_force=-1, V_syncw = -1, V_off = -1, V_mstall = -1, V_nosf = -1;
835 int V_limit=-1, V_msegs=-1, V_mtot=-1, V_minsz=-1, V_segsz=-1;
836 int V_minsf=-1, V_debug=-1, V_noca=-1, V_tmo=-1;
838 struct asyncopts {
const char *opname;
int minv;
int *oploc;
839 const char *opmsg;} asopts[] =
841 {
"Debug", -1, &V_debug,
""},
842 {
"force", -1, &V_force,
""},
843 {
"off", -1, &V_off,
""},
844 {
"nocache", -1, &V_noca,
""},
845 {
"nosf", -1, &V_nosf,
""},
846 {
"syncw", -1, &V_syncw,
""},
847 {
"limit", 0, &V_limit,
"async limit"},
848 {
"segsize", 4096, &V_segsz,
"async segsize"},
849 {
"timeout", 0, &V_tmo,
"async timeout"},
850 {
"maxsegs", 0, &V_msegs,
"async maxsegs"},
851 {
"maxstalls", 0, &V_mstall,
"async maxstalls"},
852 {
"maxtot", 0, &V_mtot,
"async maxtot"},
853 {
"minsfsz", 1, &V_minsf,
"async minsfsz"},
854 {
"minsize", 4096, &V_minsz,
"async minsize"}};
855 int numopts =
sizeof(asopts)/
sizeof(
struct asyncopts);
857 if (!(val =
Config.GetWord()))
858 {
eDest.
Emsg(
"Config",
"async option not specified");
return 1;}
861 {
for (i = 0; i < numopts; i++)
862 if (!strcmp(val, asopts[i].opname))
863 {
if (asopts[i].minv >= 0 && !(val =
Config.GetWord()))
864 {
eDest.
Emsg(
"Config",
"async",(
char *)asopts[i].opname,
865 "value not specified");
868 if (asopts[i].minv > 0)
870 (
long long)asopts[i].minv))
return 1;
871 else *asopts[i].oploc = (int)llp;
872 else if (asopts[i].minv == 0)
875 else *asopts[i].oploc = ppp;
876 else *asopts[i].oploc = 1;
880 eDest.
Emsg(
"Config",
"Warning, invalid async option", val);
886 if (V_limit > 0 && V_mtot > 0 && V_limit > V_mtot)
887 {
eDest.
Emsg(
"Config",
"async limit may not be greater than maxtot");
895 if (!i) {
eDest.
Emsg(
"Config",
"async segsize is too large");
return 1;}
898 sprintf(buff,
"%d readjusted to %d", V_segsz, i);
899 eDest.
Emsg(
"Config",
"async segsize", buff);
908 if (V_tmo < 1) i = 1;
909 else if (V_tmo > 360) i = 360;
912 sprintf(buff,
"%d readjusted to %d", V_tmo, i);
913 eDest.
Emsg(
"Config",
"async timeout", buff);
927 if (V_debug > 0) asyncFlags |= asDebug;
931 if (V_noca > 0) asyncFlags |= asNoCache;
932 if (V_nosf > 0)
as_nosf =
true;
962 char *bHost[2], *val, buff[512];
963 int bPort[2], thePort;
978 while((val =
Config.GetWord()) && *val)
979 {
if (!xred_php(val, bHost, bPort,
"bindif",
true))
return 1;
980 for (
int i = 0; i < 2 && bHost[i] != 0; i++)
982 snprintf(buff,
sizeof(buff),
"%s%s:%d",
983 (bSpec[i].length() ?
"," :
""), bHost[i], thePort);
990 for (
int i = 0; i < 2 && bSpec[i].
length(); i++)
991 {
int n = brSize + bSpec[i].
length() + 1;
994 memset(bifRec, 0, n);
997 strcpy(((
char *)bifRec)+brSize, bSpec[i].c_str());
1038 char *palg, prog[2048];
1039 int jmax = 4, anum[2] = {0,0};
1044 while ((palg =
Config.GetWord()) && *palg !=
'/')
1045 {
if (!strcmp(palg,
"chkcgi")) {
JobCKCGI = 1;
continue;}
1046 if (strcmp(palg,
"max"))
1049 if (algLast) algLast->next = xalg;
1050 else algFirst = xalg;
1054 if (!(palg =
Config.GetWord()))
1055 {
eDest.
Emsg(
"Config",
"chksum max not specified");
return 1;}
1062 {
eDest.
Emsg(
"Config",
"chksum algorithm not specified");
return 1;}
1075 {
int n = strlen(palg);
1076 if (n+2 >= (
int)
sizeof(prog))
1077 {
eDest.
Emsg(
"Config",
"cksum program too long");
return 1;}
1078 strcpy(prog, palg); palg = prog+n; *palg++ =
' '; n =
sizeof(prog)-n-1;
1079 if (!
Config.GetRest(palg, n))
1080 {
eDest.
Emsg(
"Config",
"cksum parameters too long");
return 1;}
1087 else {
JobLCL = 1; Proc = &CheckSum; strcpy(prog,
"chksum");}
1092 if (theProg->
Setup(prog, &
eDest, Proc))
return 1;
1115 char parms[4096], *val;
1119 if (!(val =
Config.GetWord()))
1120 {
eDest.
Emsg(
"Config",
"diglib not specified");
return 1;}
1124 if (strcmp(val,
"*"))
1125 {
eDest.
Emsg(
"Config",
"builtin diglib not specified");
return 1;}
1129 if (!
Config.GetRest(parms,
sizeof(parms)))
1130 {
eDest.
Emsg(
"Config",
"diglib parameters too long");
return 1;}
1131 if (digParm) free(digParm);
1132 digParm = strdup(parms);
1154 char *val, pbuff[1024];
1160 if (!val || !val[0])
1161 {
eDest.
Emsg(
"Config",
"export path not specified");
return 1;}
1162 strlcpy(pbuff, val,
sizeof(pbuff));
1166 while((val =
Config.GetWord()))
1170 else {
Config.RetToken();
break;}
1175 return xexpdo(pbuff, popt);
1180 int XrdXrootdProtocol::xexpdo(
char *path,
int popt)
1191 else {
eDest.
Emsg(
"Config",
"invalid export path -",path);
return 1;}
1199 if (rpCheck(path, &opaque))
1200 {
eDest.
Emsg(
"Config",
"non-absolute export path -", path);
return 1;}
1204 if (!(xopt = Squash(path)) || xopt != (popt|
XROOTDXP_OK))
1237 if (!(val =
Config.GetWord()))
1238 {
eDest.
Emsg(
"Config",
"fslib not specified");
return 1;}
1242 if (!strcmp(
"++", val))
1243 {
if (!(val =
Config.GetWord()))
1244 {
eDest.
Emsg(
"Config",
"fslib wrapper not specified");
return 1;}
1245 if (strcmp(
"throttle", val)) FSLPath.push_back((std::string)val);
1246 else FSLPath.push_back(
"libXrdThrottle.so");
1252 if (FSLib[0]) {free(FSLib[0]); FSLib[0] = 0;}
1253 if (FSLib[1]) {free(FSLib[1]); FSLib[1] = 0;}
1257 if (!strcmp(
"throttle", val))
1258 {FSLib[1] = strdup(
"libXrdThrottle.so");
1259 if (!(val =
Config.GetWord()))
1260 {
eDest.
Emsg(
"Config",
"fslib throttle target library not specified");
1263 return xfsL(Config, val, 0);
1268 if (xfsL(Config, val, 1))
return 1;
1269 if (!FSLib[1])
return 0;
1273 if (!(val =
Config.GetWord()))
1274 {FSLib[0] = FSLib[1]; FSLib[1] = 0;
1280 return xfsL(Config, val, 0);
1291 if (!strcmp(val,
"-2"))
1292 {
if (!(val =
Config.GetWord()))
1293 {
eDest.
Emsg(
"Config",
"fslib not specified");
return 1;}
1299 if (!strcmp(
"default", val))
return 0;
1304 if (!(Slash = rindex(val,
'/'))) Slash = val;
1306 if (!strcmp(Slash,
"libXrdOfs.so"))
1307 eDest.
Say(
"Config warning: 'fslib libXrdOfs.so' is actually built-in.");
1308 else FSLib[lix] = strdup(val);
1332 static const int rHLen = 264;
1333 char rHost[2][rHLen], *hP[2] = {0,0}, *val;
1334 int rPort[2], bypass = -1, stall = -1;
1338 while((val =
Config.GetWord()) && *val)
1339 {
if (!strcmp(val,
"bypass")) bypass = 1;
1340 else if (!strcmp(val,
"nobypass")) bypass = 0;
1341 else if (!strcmp(val,
"redirect"))
1343 if (!xred_php(val, hP, rPort,
"redirect"))
return 1;
1344 for (
int i = 0; i < 2; i++)
1345 {
if (!hP[i]) rHost[i][0] = 0;
1346 else {
strlcpy(rHost[i], hP[i], rHLen);
1351 else if (!strcmp(val,
"stall"))
1352 {
if (!(val =
Config.GetWord()) || !(*val))
1353 {
eDest.
Emsg(
"Config",
"stall value not specified");
1359 else {
eDest.
Emsg(
"config",
"invalid fsoverload option",val);
return 1;}
1364 if (bypass >= 0)
OD_Bypass = (bypass ? true :
false);
1367 {
if (
Route[RD_ovld].Host[0]) free(
Route[RD_ovld].Host[0]);
1368 if (
Route[RD_ovld].Host[1]) free(
Route[RD_ovld].Host[1]);
1373 {
Route[RD_ovld].
Host[1] = strdup(hP[1]);
1403 char parms[4096], *val;
1407 if (gpfLib) {free(gpfLib); gpfLib = 0;}
1408 if (gpfParm) {free(gpfParm); gpfParm = 0;}
1412 if (!(val =
Config.GetWord()))
1413 {
eDest.
Emsg(
"Config",
"gpflib not specified");
return 1;}
1417 if (strcmp(val,
"default")) gpfLib = strdup(val);
1421 if (!
Config.GetRest(parms,
sizeof(parms)))
1422 {
eDest.
Emsg(
"Config",
"gpflib parameters too long");
return 1;}
1423 gpfParm = strdup(parms);
1446 static struct logopts {
const char *opname;
int opval;} lgopts[] =
1452 int i, neg, lgval = -1, numopts =
sizeof(lgopts)/
sizeof(
struct logopts);
1454 if (!(val =
Config.GetWord()))
1455 {
eDest.
Emsg(
"config",
"log option not specified");
return 1;}
1457 {
if ((neg = (val[0] ==
'-' && val[1]))) val++;
1458 for (i = 0; i < numopts; i++)
1459 {
if (!strcmp(val, lgopts[i].opname))
1460 {
if (neg) lgval &= ~lgopts[i].opval;
1461 else lgval |= lgopts[i].opval;
1465 if (i >= numopts)
eDest.
Emsg(
"config",
"invalid log option",val);
1487 {
int rc, keep = 0, scrub=0;
1488 char *ldir=0,*val,buff[1024];
1490 if (!(val =
Config.GetWord()))
1491 {
eDest.
Emsg(
"Config",
"prep options not specified");
return 1;}
1493 do {
if (!strcmp(
"keep", val))
1494 {
if (!(val =
Config.GetWord()))
1495 {
eDest.
Emsg(
"Config",
"prep keep value not specified");
1500 else if (!strcmp(
"scrub", val))
1501 {
if (!(val =
Config.GetWord()))
1502 {
eDest.
Emsg(
"Config",
"prep scrub value not specified");
1507 else if (!strcmp(
"logdir", val))
1508 {
if (!(ldir =
Config.GetWord()))
1509 {
eDest.
Emsg(
"Config",
"prep logdir value not specified");
1513 else eDest.
Emsg(
"Config",
"Warning, invalid prep option", val);
1514 }
while((val =
Config.GetWord()));
1523 {
eDest.
Emsg(
"Config", rc,
"process logdir", ldir);
1558 static struct rediropts {
const char *opname; RD_func opval;} rdopts[] =
1560 {
"chmod", RD_chmod},
1561 {
"chksum", RD_chksum},
1562 {
"dirlist", RD_dirlist},
1563 {
"locate", RD_locate},
1564 {
"mkdir", RD_mkdir},
1566 {
"prepare", RD_prepare},
1567 {
"prepstage",RD_prepstg},
1569 {
"rmdir", RD_rmdir},
1573 static const int rHLen = 264;
1574 char rHost[2][rHLen], *hP[2], *val;
1575 int i, k, neg, numopts =
sizeof(rdopts)/
sizeof(
struct rediropts);
1576 int rPort[2], isQ = 0;
1581 if (!xred_php(val, hP, rPort,
"redirect"))
return 1;
1585 for (i = 0; i < 2; i++)
1586 {
if (!hP[i]) rHost[i][0] = 0;
1587 else {
strlcpy(rHost[i], hP[i], rHLen);
1594 if (!(val =
Config.GetWord()))
1595 {
eDest.
Emsg(
"config",
"redirect option not specified");
return 1;}
1599 if (!strcmp(
"client", val))
return xred_clnt(Config, hP, rPort);
1601 if (*val ==
'/' || (isQ = ((*val ==
'?') || !strcmp(val,
"enoent"))))
1604 if (!(val =
Config.GetWord()))
1605 {
eDest.
Emsg(
"Config",
"redirect path not specified.");
1609 {
eDest.
Emsg(
"Config",
"non-absolute redirect path -", val);
1613 for (k =
static_cast<int>(RD_open1); k < RD_Num; k++)
1614 if (xred_xok(k, hP, rPort))
break;
1616 {
eDest.
Emsg(
"Config",
"too many different path redirects");
return 1;}
1617 xred_set(RD_func(k), hP, rPort);
1620 if ((val =
Config.GetWord()) && *val !=
'/')
1621 {
eDest.
Emsg(
"Config",
"non-absolute redirect path -", val);
1629 {
if (!strcmp(val,
"all"))
1630 {
for (i = 0; i < numopts; i++)
1631 xred_set(rdopts[i].opval, hP, rPort);
1633 else {
if ((neg = (val[0] ==
'-' && val[1]))) val++;
1634 for (i = 0; i < numopts; i++)
1635 {
if (!strcmp(val, rdopts[i].opname))
1636 {
if (neg) xred_set(rdopts[i].opval, 0, 0);
1637 else xred_set(rdopts[i].opval, hP, rPort);
1642 eDest.
Emsg(
"config",
"invalid redirect option", val);
1671 {
eDest.
Emsg(
"Config",
"redirect client argument not specified.");
1678 else if (*val ==
'.')
1681 "Too many redirect client domains specified.");
1686 else {
eDest.
Emsg(
"Config",
"Invalid redirect client domain -", val);
1694 xred_set(RD_client, hP, rPort);
1700 bool XrdXrootdProtocol::xred_php(
char *val,
char *hP[2],
int rPort[2],
1701 const char *what,
bool optport)
1708 if (!val || !(*val))
1709 {
eDest.
Emsg(
"config", what,
"argument not specified");
return false;}
1714 if (!(pp = index(val,
'%'))) hP[1] = 0;
1715 else {hP[1] = pp+1; *pp = 0;}
1719 if (!(*val) || (hP[1] && !*hP[1]))
1720 {
eDest.
Emsg(
"Config",
"malformed", what,
"host specification");
1726 for (
int i = 0; i < 2; i++)
1727 {
if (!(val = hP[i]))
break;
1728 if (!val || !val[0] || val[0] ==
':')
1729 {
eDest.
Emsg(
"Config", what,
"host not specified");
return false;}
1730 if ((pp = rindex(val,
':')))
1735 if (optport) rPort[i] = 0;
1736 else {
eDest.
Emsg(
"Config", what,
"port not specified");
1740 const char *eText = testAddr.
Set(val, 0);
1743 eDest.
Say(
"Config warning: ", eText,
" as ", val);
1744 else {
eDest.
Say(
"Config failure: ", what,
" target ", val,
1745 " is invalid; ", eText);
1756 void XrdXrootdProtocol::xred_set(RD_func func,
char *rHost[2],
int rPort[2])
1761 if (
Route[func].Host[0]) free(
Route[func].Host[0]);
1762 if (
Route[func].Host[0] !=
Route[func].Host[1]) free(
Route[func].Host[1]);
1765 {
Route[func].
Host[0] = strdup(rHost[0]);
1782 bool XrdXrootdProtocol::xred_xok(
int func,
char *rHost[2],
int rPort[2])
1784 if (!
Route[func].Host[0])
return true;
1786 if (strcmp(
Route[func].Host[0], rHost[0])
1787 ||
Route[func].
Port[0] != rPort[0])
return false;
1791 if (strcmp(
Route[func].Host[1], rHost[1])
1792 ||
Route[func].
Port[1] != rPort[1])
return false;
1818 if (!val || !val[0])
1819 {
eDest.
Emsg(
"Config",
"seclib argument not specified");
return 1;}
1823 if (SecLib) free(SecLib);
1824 SecLib = strdup(val);
1858 static struct enforceopts {
const char *opname;
int opval;
int enval;}
1869 int i, numopts =
sizeof(enfopts)/
sizeof(
struct enforceopts);
1870 bool neg, forall =
true;
1872 if (!(val =
Config.GetWord()))
1873 {
eDest.
Emsg(
"config",
"tls parameter not specified");
return 1;}
1875 if (!strcmp(
"capable", val))
1877 if (!(val =
Config.GetWord()))
1878 {
eDest.
Emsg(
"config",
"tls requirement not specified");
return 1;}
1882 {
if (!strcmp(val,
"off") || !strcmp(val,
"none"))
1887 if ((neg = (val[0] ==
'-' && val[1]))) val++;
1888 for (i = 0; i < numopts; i++)
1889 {
if (!strcmp(val, enfopts[i].opname))
1890 {
if (neg)
myRole &= ~enfopts[i].opval;
1891 else myRole |= enfopts[i].opval;
1892 if (neg)
tlsCap &= ~enfopts[i].enval;
1893 else tlsCap |= enfopts[i].enval;
1895 {
if (neg)
tlsNot &= ~enfopts[i].enval;
1896 else tlsNot |= enfopts[i].enval;
1902 {
eDest.
Emsg(
"config",
"Invalid tls requirement -", val);
1920 return (CheckTLS(0) ? 0 : 1);
1947 if (!val || !val[0])
1948 {
eDest.
Emsg(
"Config",
"tlsreuse argument not specified");
return 1;}
1952 if (!strcmp(val,
"off"))
1959 if (!strcmp(val,
"on"))
1961 "'tlsreuse on'; TLS not configured!");
1965 if (!(val =
Config.GetWord()))
return 0;
1966 if (!strcmp(val,
"flush" ))
1967 {
if (!(val =
Config.GetWord()))
1968 {
eDest.
Emsg(
"Config",
"tlsreuse flush value not specified");
1972 if (num < 60) num = 60;
1981 eDest.
Emsg(
"config",
"Invalid tlsreuse option -", val);
2002 static struct traceopts {
const char *opname;
int opval;} tropts[] =
2019 int i, neg, trval = 0, numopts =
sizeof(tropts)/
sizeof(
struct traceopts);
2021 if (!(val =
Config.GetWord()))
2022 {
eDest.
Emsg(
"config",
"trace option not specified");
return 1;}
2024 {
if (!strcmp(val,
"off")) trval = 0;
2025 else {
if ((neg = (val[0] ==
'-' && val[1]))) val++;
2026 for (i = 0; i < numopts; i++)
2027 {
if (!strcmp(val, tropts[i].opname))
2028 {
if (neg) trval &= ~tropts[i].opval;
2029 else trval |= tropts[i].opval;
2034 eDest.
Emsg(
"config",
"invalid trace option", val);
2065 while ( (word =
Config.GetWord()) ) {
2066 if (!strcmp(word,
"prepare")) {
2067 if (!(word =
Config.GetWord()))
2069 eDest.
Emsg(
"Config",
"'limit prepare' value not specified");
2073 }
else if (!strcmp(word,
"noerror")) {
XrdSfsFileSystem * XrdDigGetFS(XrdSfsFileSystem *native_fs, XrdSysLogger *lp, const char *cFN, const char *parms)
int open(const char *path, int oflag,...)
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
XrdSfsFileSystem * XrdSfsGetDefaultFileSystem(XrdSfsFileSystem *nativeFS, XrdSysLogger *Logger, const char *configFn, XrdOucEnv *EnvInfo)
XrdXrootdPrepare * XrdXrootdPrepQ
XrdOucString * XrdXrootdCF
XrdSfsFileSystem * XrdXrootdloadFileSystem(XrdSysError *, XrdSfsFileSystem *, const char *, const char *, XrdOucEnv *)
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)
static int Export(const char *Var, const char *Val)
char * Get(const char *varname)
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)
void SetLogger(XrdSysLogger *logp)
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 XrdSecProtector * DHS
static XrdBuffManager * BPool
static XrdSecService * CIA
static const char * myGName
static uint64_t fsFeatures
static XrdOucReqID * PrepID
static struct XrdXrootdProtocol::RD_Table Route[RD_Num]
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.