28 #include "XrdVersion.hh" 29 #include "Xrd/XrdProtocol.hh" 30 #include "XrdOuc/XrdOucEnv.hh" 31 #include "XrdOuc/XrdOucStream.hh" 67 typedef XrdProtocol *(*XrdProtocolLoader_t)(
const char *,
char *, XrdProtocol_Config *);
104 #if defined(LIBC_SCCS) && !defined(lint) 105 static char sccsid[] =
"@(#)getgrouplist.c 8.2 (Berkeley) 12/8/94";
107 #include <sys/cdefs.h> 108 __FBSDID(
"$FreeBSD: src/lib/libc/gen/getgrouplist.c,v 1.14 2005/05/03 16:20:03 delphij Exp $");
114 #include <sys/types.h> 119 getgrouplist(
const char *uname, gid_t agroup, gid_t *groups,
int *grpcnt)
121 const struct group *grp;
122 int i, maxgroups, ngroups, ret;
132 groups ? groups[ngroups++] = agroup : ngroups++;
134 groups ? groups[ngroups++] = agroup : ngroups++;
139 while ((grp = getgrent()) !=
NULL) {
141 for (i = 0; i < ngroups; i++) {
142 if (grp->
gr_gid == groups[i])
146 for (i = 0; grp->
gr_mem[i]; i++) {
147 if (!strcmp(grp->
gr_mem[i], uname)) {
148 if (ngroups >= maxgroups) {
152 groups ? groups[ngroups++] = grp->
gr_gid : ngroups++;
176 XPDLOC(PMGR,
"ManagerCron")
180 TRACE(REQ,
"undefined manager: cannot start");
188 int mid = XrdSysTimer::Midnight(now);
192 TRACE(REQ,
"midnight in " << (mid - now) <<
" secs");
196 TRACE(REQ,
"running periodical checks");
202 if ((mid - now) <= tw) {
212 XrdSysTimer::Wait(tw * 1000);
258 fRootdArgs.push_back(XrdOucString(
"-nologin"));
260 fRootdArgs.push_back(XrdOucString(
"-noauth"));
265 std::list<XrdOucString>::iterator ia =
fRootdArgs.begin();
340 XPDLOC(ALL,
"Manager::LoadXrootd")
342 XrdProtocol *xrp = 0;
359 if (!(xrp = (*ep)(
"xrootd", parms, pi))) {
360 TRACE(XERR,
"Unable to create xrootd protocol service object via " <<
fXrootdLibPath.c_str());
364 TRACE(ALL,
"xrootd protocol service created");
375 XPDLOC(ALL,
"Manager::CheckLogFileOwnership")
378 if (getuid())
return;
381 if (fstat(STDERR_FILENO, &st) != 0) {
382 if (errno != ENOENT) {
383 TRACE(XERR,
"could not stat log file; errno: " << errno);
388 TRACE(HDBG,
"uid: " << st.st_uid <<
", gid: " << st.st_gid);
393 TRACE(XERR,
"could not get effective user identity; errno: " << errno);
398 if (st.st_uid != epwd->
pw_uid || st.st_gid != epwd->
pw_gid) {
399 if (fchown(STDERR_FILENO, epwd->
pw_uid, epwd->
pw_gid) != 0) {
400 TRACE(XERR,
"could not set stderr ownership; errno: " << errno);
416 std::list<XrdOucString *>::iterator i;
418 if (wm.matches((*i)->c_str())) {
438 if (!usr || strlen(usr) <= 0) {
439 e =
"CheckUser: 'usr' string is undefined ";
444 if (strlen(usr) == 4 && !strcmp(usr,
"root")) {
445 e =
"CheckUser: 'root' logins not accepted ";
450 if (!grp || strlen(grp) <= 0) {
451 e =
"CheckUser: 'grp' string is undefined ";
462 e =
"CheckUser: unknown ClientID: ";
469 e =
"CheckUser: problems getting user info for id: ";
479 while ((from =
fSuperUsers.tokenize(tkn, from,
',')) != -1) {
525 int ugrpok = 0, pgrpok = 0;
527 int ngrps = 10, neg, ig = 0;
528 #if defined(__APPLE__) 534 if ((neg = getgrouplist(usr, ui.
fGid, grps, &ngrps)) < 0) neg = 10;
536 for (ig = 0; ig < neg; ig++) {
537 g.form(
"%d", (
int) grps[ig]);
543 e =
"Controlled access (UNIX group): user '";
545 e =
"', UNIX group '";
547 e +=
"' denied to connect";
561 e =
"Controlled access";
562 e +=
" (PROOF group): user '";
564 e +=
"', PROOF group '";
566 e +=
"' denied to connect";
571 grpok = ((ugrpok == 1 && pgrpok >= 0) || (ugrpok >= 0 && pgrpok == 1)) ? 1 : 0;
584 e =
"Controlled access: user '";
586 e +=
"', PROOF group '";
588 e +=
"' not allowed to connect";
600 if (usrok == -1 || (!grpok && usrok != 1))
return -1;
612 XPDLOC(ALL,
"Manager::LoadScheduler")
615 XrdOucString
name, lib,
m;
620 if (cfn && strlen(cfn) > 0) {
622 XrdOucStream cfg(
fEDest, getenv(
"XRDINSTANCE"), &myEnv);
625 if ((cfgFD =
open(cfn, O_RDONLY, 0)) >= 0) {
628 char *val = 0, *var = 0;
629 while ((var = cfg.GetMyFirstWord())) {
630 if (!(strcmp(
"xpd.sched", var))) {
646 XPDFORM(m,
"failure opening config file; errno: %d", errno);
652 if (name ==
"default" || !(name.length() > 0 && lib.length() > 0)) {
653 if ((name.length() <= 0 && lib.length() > 0) ||
654 (name.length() > 0 && lib.length() <= 0)) {
655 XPDFORM(m,
"missing or incomplete info (name: %s, lib: %s)", name.c_str(), lib.c_str());
658 TRACE(DBG,
"instantiating default scheduler");
662 if (lib.beginswith(
"~") || lib.beginswith(
"$"))
675 TRACE(XERR,
"unable to create scheduler object from " << lib);
683 TRACE(XERR,
" unable to instantiate the " << sched->
Name() <<
" scheduler using " << (cfn ? cfn :
"<nul>"));
688 TRACE(ALL,
"scheduler loaded: type: " << sched->
Name());
700 XPDLOC(ALL,
"Manager::GetWorkers")
707 TRACE(XERR,
"scheduler undefined");
712 std::list<XrdProofWorker *> wrks, uwrks;
714 TRACE(XERR,
"error getting list of workers from the scheduler");
717 std::list<XrdProofWorker *>::iterator iw, iaw;
721 TRACE(DBG,
"list size: " << wrks.size());
728 for (iw = wrks.begin(); iw != wrks.end() ; iw++) {
732 for (iaw = uwrks.begin(); iaw != uwrks.end() ; iaw++) {
757 for (iw = uwrks.begin(); iw != uwrks.end() ; iw++) {
760 if (w->
fType ==
'M') {
761 if (lw.length() > 0) lw.insert(
'&',0);
762 lw.insert(w->
Export(), 0);
765 if (lw.length() > 0) lw +=
'&';
774 for (iw = wrks.begin(); iw != wrks.end() ; iw++) {
790 if (rc != 2 || (proto < 21 && rc == 0)) {
793 TRACE(DBG,
"from ExportWorkers: " << lw);
794 }
else if (proto >= 21) {
802 if (uwrks.size() > 0) {
804 while (iw != uwrks.end()) {
806 iw = uwrks.erase(iw);
819 xpd_acm_lists_t *ls = (xpd_acm_lists_t *)s;
822 XrdOucString &ss = (*d == 1) ? ls->allowed : ls->denied;
829 if (ss.length() > 0) ss +=
",";
847 XrdOucString *ls = (XrdOucString *)s;
854 if (ls->length() > 0) *ls +=
",";
872 XPDLOC(ALL,
"Manager::Config")
878 XPDERR(
"problems parsing file ");
883 msg = (rcf) ?
"re-configuring" :
"configuring";
900 XPDFORM(msg,
"could not resolve effective uid %d (errno: %d)", effuid, errno);
906 char *host = XrdSysDNS::getHostName();
907 fHost = host ? host :
"";
914 const char *roles[] = {
"any",
"worker",
"submaster",
"master" };
942 pidfile +=
"/xrootd.pid";
943 FILE *fpid = fopen(pidfile.c_str(),
"w");
945 XPDFORM(msg,
"unable to open pid file: %s; errno: %d", pidfile.c_str(), errno);
949 fprintf(fpid,
"%d", getpid());
953 XPDFORM(msg,
"could not resolve effective uid %d (errno: %d)", effuid, errno);
969 if (iph != STR_NPOS) {
972 XPDERR(
"unable to assert working dir: " << wdir);
980 if (wdir.length() > 0) {
981 TRACE(ALL,
"working directories under: " << wdir);
998 TRACE(XERR,
"could not get privileges to set/change ownership of " <<
fDataDir);
1001 if (chmod(
fDataDir.c_str(), 0777) != 0) {
1002 XPDERR(
"problems setting permissions 0777 data dir: " <<
fDataDir);
1012 std::list<XrdOucString *>::iterator i;
1014 TRACE(ALL,
"masters allowed to connect: " << (*i)->c_str());
1016 TRACE(ALL,
"masters allowed to connect: any");
1034 XPDERR(
"scheduler initialization failed");
1037 const char *st[] = {
"disabled",
"enabled" };
1043 TRACE(ALL,
"multi-process on nodes handled with proof-lite");
1049 std::list<XrdProofdDSInfo *>::iterator ii =
fDataSetSrcs.begin();
1052 TRACE(ALL,
">> Defined dataset: " << (*ii)->ToString());
1053 if ((*ii)->fType ==
"file") {
1055 XPDERR(
"source " << (*ii)->fUrl <<
" could not be validated");
1063 TRACE(ALL,
"Skipping validation (no \"file\" type dataset source)");
1070 TRACE(ALL,
">> Valid dataset: " << (*ii)->ToString());
1071 if ((*ii)->fLocal && (*ii)->fRW) {
1077 TRACE(ALL,
"no dataset sources defined");
1080 TRACE(ALL,
"no dataset sources defined");
1091 XPDFORM(msg,
"could not resolve effective uid %d (errno: %d)",
1103 while ((from =
fSuperUsers.tokenize(usr, from,
',')) != STR_NPOS) {
1112 XPDFORM(msg,
"running in controlled access mode: users removed because" 1113 " unknown to the system: %s", ius.c_str());
1118 xpd_acm_lists_t uls;
1120 if (uls.allowed.length()) {
1121 XPDFORM(msg,
"running in controlled access mode: users allowed: %s", uls.allowed.c_str());
1124 if (uls.denied.length()) {
1125 XPDFORM(msg,
"running in controlled access mode: users denied: %s", uls.denied.c_str());
1129 xpd_acm_lists_t gls;
1131 if (gls.allowed.length()) {
1132 XPDFORM(msg,
"running in controlled access mode: UNIX groups allowed: %s", gls.allowed.c_str());
1135 if (gls.denied.length()) {
1136 XPDFORM(msg,
"running in controlled access mode: UNIX groups denied: %s", gls.denied.c_str());
1149 while ((from = paths.tokenize(ldir, from,
':')) != STR_NPOS) {
1151 if (ldir.length() > 0) {
1156 DIR *dir = opendir(ldir.c_str());
1159 struct dirent *ent = 0;
1160 while ((ent = (
struct dirent *)readdir(dir))) {
1161 if (!strncmp(ent->d_name,
"libCore", 7)) {
1177 ctrim =
" (lib paths filter applied)";
1198 XPDERR(
"problems configuring the admin handler");
1204 XPDERR(
"problems configuring the network manager");
1210 XPDERR(
"problems configuring the priority manager");
1218 XPDERR(
"problems configuring the ROOT versions manager");
1225 XPDERR(
"problems configuring the client manager");
1231 XPDERR(
"problems configuring the session manager");
1237 XPDERR(
"problems configuring the scheduler");
1261 if (roo && strlen(roo->
BinDir()) > 0) {
1262 XrdOucString bindir(roo->
BinDir());
1263 if (!bindir.endswith(
"/")) bindir +=
"/";
1270 XrdOucString sockpath;
1273 if (!fRootdUnixSrv || (fRootdUnixSrv && !fRootdUnixSrv->isvalid(0))) {
1274 XPDERR(
"could not start unix server connection on path "<<
1275 sockpath<<
" - errno: "<<(
int)errno);
1279 TRACE(ALL,
"unix socket path for rootd call backs: "<<sockpath);
1283 std::list<XrdOucString>::iterator ia =
fRootdAllow.begin();
1285 if (hhs.length() > 0) hhs +=
",";
1286 hhs += (*ia).c_str();
1289 TRACE(ALL,
"serving files with: '" <<
fRootdExe <<
"' (protocol: 'rootd://') to ALLOWED hosts");
1290 TRACE(ALL,
"rootd-allowed hosts: "<< hhs);
1292 TRACE(ALL,
"serving files with: '" <<
fRootdExe <<
"' (protocol: 'rootd://') to ALL hosts");
1296 TRACE(ALL,
"file serving (protocol: 'rootd://') explicitly disabled");
1303 (
void *)
this, 0,
"ProofdManager cron thread") != 0) {
1304 XPDERR(
"could not start cron thread");
1307 TRACE(ALL,
"manager cron thread started");
1321 XPDLOC(ALL,
"Manager::ValidateLocalDataSetSrc")
1323 TRACE(ALL,
"validating '" << url <<
"' ...");
1326 if (url.length() > 0) {
1328 if (url.beginswith(
"file:")) url.replace(
"file:",
"");
1329 if (url.beginswith(
"/")) {
1338 TRACE(XERR,
"Problems setting permissions 0777 on path '" << url <<
"'");
1341 TRACE(XERR,
"Cannot assert path '" << url <<
"' - ignoring");
1345 XrdOucString fnpath(url.c_str());
1346 fnpath +=
"/dataset.list";
1347 if (access(fnpath.c_str(), F_OK) != 0) {
1348 FILE *flst = fopen(fnpath.c_str(),
"w");
1350 TRACE(XERR,
"Cannot open file '" << fnpath <<
"' for the dataset list; errno: " << errno);
1353 if (fclose(flst) != 0)
1354 TRACE(XERR,
"Problems closing file '" << fnpath <<
"'; errno: " << errno);
1356 TRACE(XERR,
"Problems asserting ownership of " << fnpath);
1362 TRACE(XERR,
"Problems setting permissions to 0666 on file '" << fnpath <<
"'; errno: " << errno);
1367 fnpath.replace(
"/dataset.list",
"/lock.location");
1368 FILE *flck = fopen(fnpath.c_str(),
"a");
1370 TRACE(XERR,
"Cannot open file '" << fnpath <<
"' with the lock file path; errno: " << errno);
1373 off_t ofs = lseek(fileno(flck), 0, SEEK_CUR);
1376 XrdOucString fnlock(url);
1377 fnlock.replace(
"/",
"%");
1378 fnlock.replace(
":",
"%");
1379 fnlock.insert(
"/tmp/", 0);
1380 fprintf(flck,
"%s\n", fnlock.c_str());
1381 if (fclose(flck) != 0)
1382 TRACE(XERR,
"Problems closing file '" << fnpath <<
"'; errno: " << errno);
1385 TRACE(XERR,
"Problems asserting ownership of " << fnpath);
1387 }
else if (ofs == (off_t)(-1)) {
1388 TRACE(XERR,
"Problems getting current position on file '" << fnpath <<
"'; errno: " << errno);
1390 if (flck && fclose(flck) != 0)
1391 TRACE(XERR,
"Problems closing file '" << fnpath <<
"'; errno: " << errno);
1396 TRACE(XERR,
"Problems setting permissions to 0644 on file '" << fnpath <<
"'; errno: " << errno);
1402 TRACE(ALL,
"New dataset with no URL!");
1458 XPDLOC(ALL,
"Manager::ResolveKeywords")
1462 TRACE(HDBG,
"enter: " << s <<
" - WorkDir(): " <<
WorkDir());
1465 if (s.replace(
"<workdir>",
WorkDir()))
1468 TRACE(HDBG,
"after <workdir>: " << s);
1471 if (s.replace(
"<host>",
Host()))
1474 TRACE(HDBG,
"after <host>: " << s);
1477 if (s.find(
"<port>") != STR_NPOS) {
1480 if (s.replace(
"<port>", sport.c_str()))
1485 if (s.find(
"<effuser>") != STR_NPOS) {
1488 if (s.replace(
"<effuser>", eui.
fUser.c_str()))
1495 if (s.replace(
"<user>", pcl->
User()))
1500 if (s.replace(
"<group>", pcl->
Group()))
1505 if (s.replace(
"<homedir>", pcl->
UI().
fHomeDir.c_str()))
1509 if (pcl && (s.find(
"<uid>") != STR_NPOS)) {
1512 if (s.replace(
"<uid>", suid.c_str()))
1517 if (pcl && (s.find(
"<gid>") != STR_NPOS)) {
1520 if (s.replace(
"<gid>", sgid.c_str()))
1524 TRACE(HDBG,
"exit: " << s);
1537 char *val, XrdOucStream *cfg,
bool rcf)
1539 XPDLOC(ALL,
"Manager::DoDirective")
1545 if (d->
fName ==
"trace") {
1547 }
else if (d->
fName ==
"groupfile") {
1549 }
else if (d->
fName ==
"maxoldlogs") {
1551 }
else if (d->
fName ==
"allow") {
1553 }
else if (d->
fName ==
"allowedgroups") {
1555 }
else if (d->
fName ==
"allowedusers") {
1557 }
else if (d->
fName ==
"role") {
1559 }
else if (d->
fName ==
"multiuser") {
1561 }
else if (d->
fName ==
"port") {
1563 }
else if (d->
fName ==
"datadir") {
1565 }
else if (d->
fName ==
"datasetsrc") {
1567 }
else if (d->
fName ==
"rootd") {
1569 }
else if (d->
fName ==
"rootdallow") {
1571 }
else if (d->
fName ==
"xrd.protocol") {
1573 }
else if (d->
fName ==
"filterlibpaths") {
1575 }
else if (d->
fName ==
"xrootd") {
1578 TRACE(XERR,
"unknown directive: " << d->
fName);
1587 XPDLOC(ALL,
"Manager::DoDirectiveTrace")
1624 while (val && val[0]) {
1626 if (val[0] ==
'-') {
1630 if (!strcmp(val,
"err")) {
1632 }
else if (!strcmp(val,
"req")) {
1634 }
else if (!strcmp(val,
"dbg")) {
1639 }
else if (!strcmp(val,
"login")) {
1641 }
else if (!strcmp(val,
"fork")) {
1643 }
else if (!strcmp(val,
"mem")) {
1645 }
else if (!strcmp(val,
"hdbg")) {
1651 }
else if (!strcmp(val,
"rsp")) {
1653 }
else if (!strcmp(val,
"aux")) {
1655 }
else if (!strcmp(val,
"cmgr")) {
1657 }
else if (!strcmp(val,
"smgr")) {
1659 }
else if (!strcmp(val,
"nmgr")) {
1661 }
else if (!strcmp(val,
"pmgr")) {
1663 }
else if (!strcmp(val,
"gmgr")) {
1665 }
else if (!strcmp(val,
"sched")) {
1667 }
else if (!strcmp(val,
"all") || !strcmp(val,
"dump")) {
1669 TRACE(ALL,
"Setting trace: " << on);
1674 val = cfg->GetWord();
1685 XPDLOC(ALL,
"Manager::DoDirectiveGroupfile")
1700 TRACE(XERR,
"groups manager already initialized: ignoring ");
1723 int maxoldlogs = strtol(val, 0, 10);
1765 XrdOucString s = val;
1767 XrdOucString grp, gid;
1769 while ((from = s.tokenize(grp, from,
',')) != STR_NPOS) {
1771 if (grp.beginswith(
'-')) {
1773 grp.erasefromstart(1);
1778 gid.form(
"%d", (
int) gi.
fGid);
1807 XrdOucString s = val;
1811 while ((from = s.tokenize(usr, from,
',')) != STR_NPOS) {
1813 if (usr.beginswith(
'-')) {
1815 usr.erasefromstart(1);
1841 XrdOucString tval(val);
1842 if (tval ==
"supermaster") {
1845 }
else if (tval ==
"master") {
1847 }
else if (tval ==
"submaster") {
1849 }
else if (tval ==
"worker") {
1851 }
else if (tval ==
"any") {
1867 XrdOucString port(val);
1868 if (port.beginswith(
"xproofd:")) {
1869 port.replace(
"xproofd:",
"");
1871 if (port.length() > 0 && port.isdigit()) {
1872 fPort = strtol(port.c_str(), 0, 10);
1884 XPDLOC(ALL,
"Manager::DoDirectiveMultiUser")
1891 int mu = strtol(val, 0, 10);
1895 val = cfg->GetWord();
1913 XrdOucString
type(val), url, opts, obscure;
1914 bool rw = 0, local = 0, goodsrc = 1;
1916 while ((nxt = cfg->GetWord())) {
1917 if (!strcmp(nxt,
"rw=1") || !strcmp(nxt,
"rw:1")) {
1919 }
else if (!strncmp(nxt,
"url:", 4)) {
1923 }
else if (!strncmp(nxt,
"opt:", 4)) {
1934 std::list<XrdProofdDSInfo *>::iterator ii =
fDataSetSrcs.begin();
1937 if ((*ii)->fLocal) {
1943 if (opts.length() <= 0) {
1944 opts = rw ?
"Ar:Av:" :
"-Ar:-Av:";
1947 local, rw, opts.c_str(), obscure.c_str());
1948 if (haslocal || !local) {
1972 while ((nxt = cfg->GetWord()) && (opts.length() == 0)) {
1978 if ((iq =
fDataDir.rfind(
'?')) != STR_NPOS) {
1993 XPDLOC(ALL,
"Manager::DoDirectiveXrootd")
1998 TRACE(ALL,
"val: "<< val);
2000 if (XrdMajorVNUM(XrdVNUMBER) < 4) {
2001 TRACE(ALL,
"WARNING: built against an XRootD version without libXrdXrootd.so :");
2002 TRACE(ALL,
"WARNING: loading external " << val <<
" may lead to incompatibilities");
2018 XPDLOC(ALL,
"Manager::DoDirectiveRootd")
2028 TRACE(ALL,
"val: "<< val);
2031 XrdOucString mode(
"ro"), auth(
"none"), fork(
"0");
2035 if (!strcmp(nxt,
"deny") || !strcmp(nxt,
"disable") || !strcmp(nxt,
"off")) {
2038 }
else if (!strcmp(nxt,
"allow") || !strcmp(nxt,
"enable") || !strcmp(nxt,
"on")) {
2041 TRACE(ALL,
"Use of this directive is deprecated: use xpd.xrootd instead");
2042 }
else if (!strncmp(nxt,
"mode:", 5)) {
2044 }
else if (!strncmp(nxt,
"auth:", 5)) {
2046 }
else if (!strncmp(nxt,
"fork:", 5)) {
2052 }
while ((nxt = cfg->GetWord()));
2059 fRootdArgs.push_back(XrdOucString(
"-nologin"));
2060 if (mode ==
"ro")
fRootdArgs.push_back(XrdOucString(
"-r"));
2061 if (auth ==
"none")
fRootdArgs.push_back(XrdOucString(
"-noauth"));
2062 fRootdFork = (fork ==
"1" || fork ==
"yes") ? 1 : 0;
2072 std::list<XrdOucString>::iterator ia =
fRootdArgs.begin();
2090 XPDLOC(ALL,
"Manager::DoDirectiveRootdAllow")
2096 TRACE(ALL,
"Use of this and 'xpd.rootd' directives is deprecated: use xpd.xrootd instead");
2098 TRACE(ALL,
"val: "<< val);
2101 XrdOucString hosts,
h;
2106 while ((from = hosts.tokenize(h, from,
',')) != -1) {
2109 }
while ((nxt = cfg->GetWord()));
2121 XPDLOC(ALL,
"Manager::DoDirectiveRemoveLibPaths")
2130 TRACE(ALL,
"val: "<< val);
2139 while ((nxt = cfg->GetWord())) {
2140 XrdOucString pps(nxt), p;
2142 while ((from = pps.tokenize(p, from,
',')) != -1) {
2143 if (p.length() > 0) {
2159 XPDLOC(ALL,
"Manager::IsRootdAllowed")
2165 if (!host || strlen(host) <= 0)
return 0;
2167 TRACE(DBG,
"checking host: "<< host);
2169 XrdOucString
h(host);
2170 std::list<XrdOucString>::iterator ia =
fRootdAllow.begin();
2172 if (h.matches((*ia).c_str(),
'*') > 0)
return 1;
2185 XPDLOC(ALL,
"Manager::Process")
2202 response->Send(kXR_InvalidRequest,
"Invalid request; user not logged in");
2203 return p->
Link()->setEtext(
"protocol sequence error 1");
2222 emsg +=
"Invalid request: ";
2228 response->Send(kXR_InvalidRequest, emsg.c_str());
int Auth(XrdProofdProtocol *xp)
Analyse client authentication info.
XrdProofdProofServMgr * fSessionMgr
const char * WorkDir() const
static int FillKeyValues(const char *k, int *d, void *s)
Add the key value in the string passed via the void argument.
const char * Export(const char *ord=0)
Export current content in a form understood by parsing algorithms inside the PROOF session...
int DoDirectiveXrootd(char *, XrdOucStream *, bool)
Process 'xrootd' directive xpd.xrootd [path/]libXrdXrootd.so.
int DoDirectiveRootdAllow(char *, XrdOucStream *, bool)
Process 'rootdallow' directive xpd.rootdallow host1,host2 host3 Host names may contain the wild card ...
void SetLogDir(const char *d)
Set the log dir.
int DoDirectiveFilterLibPaths(char *, XrdOucStream *, bool)
Process 'filterlibpaths' directive xpd.filterlibpaths 1|0 [path1,path2 path3 path4 ...
XrdProofdClientMgr * fClientMgr
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t mid
int GetWorkers(XrdOucString &workers, XrdProofdProofServ *, const char *)
Get a list of workers from the available resource broker.
XrdProofdProofServMgr * SessionMgr() const
int DoDirectiveRole(char *, XrdOucStream *, bool)
Process 'role' directive.
int Process(XrdProofdProtocol *p)
Process manager request.
std::list< XrdOucString * > fMastersAllowed
static int GetUserInfo(const char *usr, XrdProofUI &ui)
Get information about user 'usr' in a thread safe way.
const char * Group() const
XrdROOT * DefaultVersion() const
#define kXPD_OpModeControlled
void AddWorker(const char *o, XrdProofWorker *w)
Add a worker assigned to this session with label 'o'.
int Process(XrdProofdProtocol *p, int type)
Process admin request.
int DoDirectiveClass(XrdProofdDirective *, char *val, XrdOucStream *cfg, bool rcf)
Generic class directive processor.
static void SetWorkdir(const char *wdir)
int Config(bool rcf=0)
Run configuration and parse the entered config directives.
#define TRACE(Flag, Args)
const char *const XPD_GW_QueryEnqueued
virtual ~XrdProofdManager()
Destructor.
int Process(XrdProofdProtocol *p)
Process manager request.
R__EXTERN XrdOucTrace * XrdProofdTrace
int DoDirectiveInt(XrdProofdDirective *, char *val, XrdOucStream *cfg, bool rcf)
Process directive for an integer.
XrdOucHash< int > fAllowedUsers
XrdProofdManager(char *parms, XrdProtocol_Config *pi, XrdSysError *edest)
Constructor.
const char * GetCfgFile() const
kXR_int16 SrvProtVers() const
virtual int GetWorkers(XrdProofdProofServ *xps, std::list< XrdProofWorker *> *, const char *)
Get a list of workers that can be used by session 'xps'.
XrdProofdPriorityMgr * fPriorityMgr
struct ClientRequestHdr header
int DoDirectiveRootd(char *, XrdOucStream *, bool)
Process 'rootd' directive xpd.rootd deny|allow [rootsys:<tag>] [path:abs-path/] [mode:ro|rw] [auth:no...
XrdProofSched * LoadScheduler()
Load PROOF scheduler.
XrdProofGroupMgr * fGroupsMgr
int DoDirective(XrdProofdDirective *d, char *val, XrdOucStream *cfg, bool rcf)
Update the priorities of the active sessions.
void AddProofServ(XrdProofdProofServ *xps)
XrdProofGroupMgr * GroupsMgr() const
const char * User() const
XrdOucString fEffectiveUser
const char * Name() const
XrdOucString fStageReqRepo
bool WorkerUsrCfg() const
int DoDirectiveAllowedGroups(char *, XrdOucStream *, bool)
Process 'allowedgroups' directive.
void ExportWorkers(XrdOucString &wrks)
Export the assigned workers in the format understood by proofserv.
static int EUidAtStartup()
int Login(XrdProofdProtocol *xp)
Process a login request.
virtual int Config(bool rcf=0)
Configure this instance using the content of file 'cfn'.
int DoDirectiveTrace(char *, XrdOucStream *, bool)
Scan the config file for tracing settings.
int DoDirectiveDataDir(char *, XrdOucStream *, bool)
Process 'datadir' directive.
int Config(bool rcf=0)
Run configuration and parse the entered config directives.
bool CheckMaster(const char *m)
Check if master 'm' is allowed to connect to this host.
XrdProofSched * fProofSched
XrdOucString fBareLibPath
#define TRACESET(act, on)
static int RemoveInvalidUsers(const char *k, int *, void *s)
Add the key value in the string passed via the void argument.
int DoDirectiveAllow(char *, XrdOucStream *, bool)
Process 'allow' directive.
static const char * ProofRequestTypes(int type)
Translates the proof request type in a human readable string.
std::list< XrdProofdDSInfo * > fDataSetSrcs
XrdROOT * GetVersion(const char *tag)
Return pointer to the ROOT version corresponding to 'tag' or 0 if not found.
#define XrdSysMutexHelper
std::list< XrdOucString > fRootdArgs
struct XPClientProofRequest proof
bool IsRootdAllowed(const char *host)
Check if 'host' is allowed to access files via rootd.
const char * Host() const
int CheckUser(const char *usr, const char *grp, XrdProofUI &ui, XrdOucString &e, bool &su)
Check if the user is allowed to use the system Return 0 if OK, -1 if not.
XrdOucString fDataDirUrlOpts
#define TRACEP(p, act, x)
int Config(bool rcf=0)
Run configuration and parse the entered config directives.
#define XpdBadPGuard(g, u)
rpdunixsrv * fRootdUnixSrv
int ReadBuffer(XrdProofdProtocol *p)
Process a readbuf request.
static int GetGroupInfo(const char *grp, XrdProofGI &gi)
Get information about group with 'gid' in a thread safe way.
void RegisterDirectives()
Register directives for configuration.
static int AssertDir(const char *path, XrdProofUI ui, bool changeown)
Make sure that 'path' exists and is owned by the entity described by 'ui'.
int Config(bool rcf=0)
Run configuration and parse the entered config directives.
XrdOucHash< int > fAllowedGroups
const char ** fRootdArgsPtrs
static int CheckIf(XrdOucStream *s, const char *h)
Check existence and match condition of an 'if' directive If none (valid) is found, return -1.
int ResolveKeywords(XrdOucString &s, XrdProofdClient *pcl)
Resolve special keywords in 's' for client 'pcl'.
static char * Expand(char *p)
Expand path 'p' relative to: $HOME if begins with ~/ <user>'s $HOME if begins with ~<user>/ $PWD if d...
int DoDirectiveString(XrdProofdDirective *, char *val, XrdOucStream *cfg, bool rcf)
Process directive for a string.
std::list< XrdOucString > fRootdAllow
int Config(bool rcf=0)
Run configuration and parse the entered config directives.
XrdOucHash< XrdOucString > fLibPathsToRemove
int Config(bool rcf=0)
Run configuration and parse the entered config directives.
int Config(bool rcf=0)
Run configuration and parse the entered config directives.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
XrdProtocol * LoadXrootd(char *parms, XrdProtocol_Config *pi, XrdSysError *edest)
Load the Xrootd protocol, if required.
static int ChangeMod(const char *path, unsigned int mode)
Change the permission mode of 'path' to 'mode'.
XrdOucString fDataDirOpts
XrdProofdNetMgr * fNetMgr
int DoDirectiveGroupfile(char *, XrdOucStream *, bool)
Process 'groupfile' directive.
#define XPD_SETRESP(p, x)
int DoDirectivePort(char *, XrdOucStream *, bool)
Process 'xrd.protocol' directive to find the port.
int DoDirectiveMultiUser(char *, XrdOucStream *, bool)
Process 'multiuser' directive.
XrdProtocol *(* XrdProtocolLoader_t)(const char *, char *, XrdProtocol_Config *)
XrdProofSched *(* XrdProofSchedLoader_t)(const char *, XrdProofdManager *, XrdProofGroupMgr *, const char *, XrdSysError *)
void CheckLogFileOwnership()
Make sure that the log file belongs to the original effective user.
const char * CfgFile() const
int DoDirectiveDataSetSrc(char *, XrdOucStream *, bool)
Process 'datasetsrc' directive.
XrdOucString fXrootdLibPath
static int ChangeOwn(const char *path, XrdProofUI ui)
Change the ownership of 'path' to the entity described by 'ui'.
int Config(const char *fn)
(Re-)configure the group info using the file 'fn'.
static void SetMaxOldSessions(int mxses)
int DoDirectiveMaxOldLogs(char *, XrdOucStream *, bool)
Process 'maxoldlogs' directive.
XrdOucString fSockPathDir
bool ValidateLocalDataSetSrc(XrdOucString &url, bool &local)
Validate local dataset src at URL (check the URL and make the relevant directories).
const char * BinDir() const
void * XrdProofdManagerCron(void *p)
This is an endless loop to periodically check the system.
virtual int Config(bool rcf=0)
static char * skip(char **buf, const char *delimiters)
void Print(const char *grp)
Return a string describing the group.
void Register(const char *dname, XrdProofdDirective *d)
XPClientRequest * Request() const
if(line.BeginsWith("/*"))
int DoDirectiveAllowedUsers(char *, XrdOucStream *, bool)
Process 'allowedusers' directive.