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();
342 XPDLOC(ALL,
"Manager::LoadXrootd")
344 XrdProtocol *xrp = 0;
361 if (!(xrp = (*ep)(
"xrootd", parms, pi))) {
362 TRACE(XERR,
"Unable to create xrootd protocol service object via " <<
fXrootdLibPath.c_str());
366 TRACE(ALL,
"xrootd protocol service created");
377 XPDLOC(ALL,
"Manager::CheckLogFileOwnership")
380 if (getuid())
return;
383 if (fstat(STDERR_FILENO, &st) != 0) {
384 if (errno != ENOENT) {
385 TRACE(XERR,
"could not stat log file; errno: " << errno);
390 TRACE(HDBG,
"uid: " << st.st_uid <<
", gid: " << st.st_gid);
395 TRACE(XERR,
"could not get effective user identity; errno: " << errno);
400 if (st.st_uid != epwd->
pw_uid || st.st_gid != epwd->
pw_gid) {
401 if (fchown(STDERR_FILENO, epwd->
pw_uid, epwd->
pw_gid) != 0) {
402 TRACE(XERR,
"could not set stderr ownership; errno: " << errno);
418 std::list<XrdOucString *>::iterator i;
420 if (wm.matches((*i)->c_str())) {
440 if (!usr || strlen(usr) <= 0) {
441 e =
"CheckUser: 'usr' string is undefined ";
446 if (strlen(usr) == 4 && !strcmp(usr,
"root")) {
447 e =
"CheckUser: 'root' logins not accepted ";
452 if (!grp || strlen(grp) <= 0) {
453 e =
"CheckUser: 'grp' string is undefined ";
464 e =
"CheckUser: unknown ClientID: ";
471 e =
"CheckUser: problems getting user info for id: ";
481 while ((from =
fSuperUsers.tokenize(tkn, from,
',')) != -1) {
527 int ugrpok = 0, pgrpok = 0;
529 int ngrps = 10, neg, ig = 0;
530 #if defined(__APPLE__) 536 if ((neg = getgrouplist(usr, ui.
fGid, grps, &ngrps)) < 0) neg = 10;
538 for (ig = 0; ig < neg; ig++) {
539 g.form(
"%d", (
int) grps[ig]);
545 e =
"Controlled access (UNIX group): user '";
547 e =
"', UNIX group '";
549 e +=
"' denied to connect";
563 e =
"Controlled access";
564 e +=
" (PROOF group): user '";
566 e +=
"', PROOF group '";
568 e +=
"' denied to connect";
573 grpok = ((ugrpok == 1 && pgrpok >= 0) || (ugrpok >= 0 && pgrpok == 1)) ? 1 : 0;
586 e =
"Controlled access: user '";
588 e +=
"', PROOF group '";
590 e +=
"' not allowed to connect";
602 if (usrok == -1 || (!grpok && usrok != 1))
return -1;
614 XPDLOC(ALL,
"Manager::LoadScheduler")
617 XrdOucString
name, lib,
m;
622 if (cfn && strlen(cfn) > 0) {
624 XrdOucStream cfg(
fEDest, getenv(
"XRDINSTANCE"), &myEnv);
627 if ((cfgFD =
open(cfn, O_RDONLY, 0)) >= 0) {
630 char *val = 0, *var = 0;
631 while ((var = cfg.GetMyFirstWord())) {
632 if (!(strcmp(
"xpd.sched", var))) {
648 XPDFORM(m,
"failure opening config file; errno: %d", errno);
654 if (name ==
"default" || !(name.length() > 0 && lib.length() > 0)) {
655 if ((name.length() <= 0 && lib.length() > 0) ||
656 (name.length() > 0 && lib.length() <= 0)) {
657 XPDFORM(m,
"missing or incomplete info (name: %s, lib: %s)", name.c_str(), lib.c_str());
660 TRACE(DBG,
"instantiating default scheduler");
664 if (lib.beginswith(
"~") || lib.beginswith(
"$"))
677 TRACE(XERR,
"unable to create scheduler object from " << lib);
685 TRACE(XERR,
" unable to instantiate the " << sched->
Name() <<
" scheduler using " << (cfn ? cfn :
"<nul>"));
690 TRACE(ALL,
"scheduler loaded: type: " << sched->
Name());
702 XPDLOC(ALL,
"Manager::GetWorkers")
709 TRACE(XERR,
"scheduler undefined");
714 std::list<XrdProofWorker *> wrks, uwrks;
716 TRACE(XERR,
"error getting list of workers from the scheduler");
719 std::list<XrdProofWorker *>::iterator iw, iaw;
723 TRACE(DBG,
"list size: " << wrks.size());
730 for (iw = wrks.begin(); iw != wrks.end() ; iw++) {
734 for (iaw = uwrks.begin(); iaw != uwrks.end() ; iaw++) {
759 for (iw = uwrks.begin(); iw != uwrks.end() ; iw++) {
762 if (w->
fType ==
'M') {
763 if (lw.length() > 0) lw.insert(
'&',0);
764 lw.insert(w->
Export(), 0);
767 if (lw.length() > 0) lw +=
'&';
776 for (iw = wrks.begin(); iw != wrks.end() ; iw++) {
792 if (rc != 2 || (proto < 21 && rc == 0)) {
795 TRACE(DBG,
"from ExportWorkers: " << lw);
796 }
else if (proto >= 21) {
804 if (uwrks.size() > 0) {
806 while (iw != uwrks.end()) {
808 iw = uwrks.erase(iw);
821 xpd_acm_lists_t *ls = (xpd_acm_lists_t *)s;
824 XrdOucString &ss = (*d == 1) ? ls->allowed : ls->denied;
831 if (ss.length() > 0) ss +=
",";
849 XrdOucString *ls = (XrdOucString *)s;
856 if (ls->length() > 0) *ls +=
",";
874 XPDLOC(ALL,
"Manager::Config")
880 XPDERR(
"problems parsing file ");
885 msg = (rcf) ?
"re-configuring" :
"configuring";
902 XPDFORM(msg,
"could not resolve effective uid %d (errno: %d)", effuid, errno);
908 char *host = XrdSysDNS::getHostName();
909 fHost = host ? host :
"";
916 const char *roles[] = {
"any",
"worker",
"submaster",
"master" };
944 pidfile +=
"/xrootd.pid";
945 FILE *fpid = fopen(pidfile.c_str(),
"w");
947 XPDFORM(msg,
"unable to open pid file: %s; errno: %d", pidfile.c_str(), errno);
951 fprintf(fpid,
"%d", getpid());
955 XPDFORM(msg,
"could not resolve effective uid %d (errno: %d)", effuid, errno);
971 if (iph != STR_NPOS) {
974 XPDERR(
"unable to assert working dir: " << wdir);
982 if (wdir.length() > 0) {
983 TRACE(ALL,
"working directories under: " << wdir);
1000 TRACE(XERR,
"could not get privileges to set/change ownership of " <<
fDataDir);
1003 if (chmod(
fDataDir.c_str(), 0777) != 0) {
1004 XPDERR(
"problems setting permissions 0777 data dir: " <<
fDataDir);
1014 std::list<XrdOucString *>::iterator i;
1016 TRACE(ALL,
"masters allowed to connect: " << (*i)->c_str());
1018 TRACE(ALL,
"masters allowed to connect: any");
1036 XPDERR(
"scheduler initialization failed");
1039 const char *st[] = {
"disabled",
"enabled" };
1045 TRACE(ALL,
"multi-process on nodes handled with proof-lite");
1051 std::list<XrdProofdDSInfo *>::iterator ii =
fDataSetSrcs.begin();
1054 TRACE(ALL,
">> Defined dataset: " << (*ii)->ToString());
1055 if ((*ii)->fType ==
"file") {
1057 XPDERR(
"source " << (*ii)->fUrl <<
" could not be validated");
1065 TRACE(ALL,
"Skipping validation (no \"file\" type dataset source)");
1072 TRACE(ALL,
">> Valid dataset: " << (*ii)->ToString());
1073 if ((*ii)->fLocal && (*ii)->fRW) {
1079 TRACE(ALL,
"no dataset sources defined");
1082 TRACE(ALL,
"no dataset sources defined");
1093 XPDFORM(msg,
"could not resolve effective uid %d (errno: %d)",
1105 while ((from =
fSuperUsers.tokenize(usr, from,
',')) != STR_NPOS) {
1114 XPDFORM(msg,
"running in controlled access mode: users removed because" 1115 " unknown to the system: %s", ius.c_str());
1120 xpd_acm_lists_t uls;
1122 if (uls.allowed.length()) {
1123 XPDFORM(msg,
"running in controlled access mode: users allowed: %s", uls.allowed.c_str());
1126 if (uls.denied.length()) {
1127 XPDFORM(msg,
"running in controlled access mode: users denied: %s", uls.denied.c_str());
1131 xpd_acm_lists_t gls;
1133 if (gls.allowed.length()) {
1134 XPDFORM(msg,
"running in controlled access mode: UNIX groups allowed: %s", gls.allowed.c_str());
1137 if (gls.denied.length()) {
1138 XPDFORM(msg,
"running in controlled access mode: UNIX groups denied: %s", gls.denied.c_str());
1151 while ((from = paths.tokenize(ldir, from,
':')) != STR_NPOS) {
1153 if (ldir.length() > 0) {
1158 DIR *dir = opendir(ldir.c_str());
1161 struct dirent *ent = 0;
1162 while ((ent = (
struct dirent *)readdir(dir))) {
1163 if (!strncmp(ent->d_name,
"libCore", 7)) {
1179 ctrim =
" (lib paths filter applied)";
1200 XPDERR(
"problems configuring the admin handler");
1206 XPDERR(
"problems configuring the network manager");
1212 XPDERR(
"problems configuring the priority manager");
1220 XPDERR(
"problems configuring the ROOT versions manager");
1227 XPDERR(
"problems configuring the client manager");
1233 XPDERR(
"problems configuring the session manager");
1239 XPDERR(
"problems configuring the scheduler");
1263 if (roo && strlen(roo->
BinDir()) > 0) {
1264 XrdOucString bindir(roo->
BinDir());
1265 if (!bindir.endswith(
"/")) bindir +=
"/";
1272 XrdOucString sockpath;
1275 if (!fRootdUnixSrv || (fRootdUnixSrv && !fRootdUnixSrv->isvalid(0))) {
1276 XPDERR(
"could not start unix server connection on path "<<
1277 sockpath<<
" - errno: "<<(
int)errno);
1281 TRACE(ALL,
"unix socket path for rootd call backs: "<<sockpath);
1285 std::list<XrdOucString>::iterator ia =
fRootdAllow.begin();
1287 if (hhs.length() > 0) hhs +=
",";
1288 hhs += (*ia).c_str();
1291 TRACE(ALL,
"serving files with: '" <<
fRootdExe <<
"' (protocol: 'rootd://') to ALLOWED hosts");
1292 TRACE(ALL,
"rootd-allowed hosts: "<< hhs);
1294 TRACE(ALL,
"serving files with: '" <<
fRootdExe <<
"' (protocol: 'rootd://') to ALL hosts");
1298 TRACE(ALL,
"file serving (protocol: 'rootd://') explicitly disabled");
1305 (
void *)
this, 0,
"ProofdManager cron thread") != 0) {
1306 XPDERR(
"could not start cron thread");
1309 TRACE(ALL,
"manager cron thread started");
1323 XPDLOC(ALL,
"Manager::ValidateLocalDataSetSrc")
1325 TRACE(ALL,
"validating '" << url <<
"' ...");
1328 if (url.length() > 0) {
1330 if (url.beginswith(
"file:")) url.replace(
"file:",
"");
1331 if (url.beginswith(
"/")) {
1340 TRACE(XERR,
"Problems setting permissions 0777 on path '" << url <<
"'");
1343 TRACE(XERR,
"Cannot assert path '" << url <<
"' - ignoring");
1347 XrdOucString fnpath(url.c_str());
1348 fnpath +=
"/dataset.list";
1349 if (access(fnpath.c_str(), F_OK) != 0) {
1350 FILE *flst = fopen(fnpath.c_str(),
"w");
1352 TRACE(XERR,
"Cannot open file '" << fnpath <<
"' for the dataset list; errno: " << errno);
1355 if (fclose(flst) != 0)
1356 TRACE(XERR,
"Problems closing file '" << fnpath <<
"'; errno: " << errno);
1358 TRACE(XERR,
"Problems asserting ownership of " << fnpath);
1364 TRACE(XERR,
"Problems setting permissions to 0666 on file '" << fnpath <<
"'; errno: " << errno);
1369 fnpath.replace(
"/dataset.list",
"/lock.location");
1370 FILE *flck = fopen(fnpath.c_str(),
"a");
1372 TRACE(XERR,
"Cannot open file '" << fnpath <<
"' with the lock file path; errno: " << errno);
1375 off_t ofs = lseek(fileno(flck), 0, SEEK_CUR);
1378 XrdOucString fnlock(url);
1379 fnlock.replace(
"/",
"%");
1380 fnlock.replace(
":",
"%");
1381 fnlock.insert(
"/tmp/", 0);
1382 fprintf(flck,
"%s\n", fnlock.c_str());
1383 if (fclose(flck) != 0)
1384 TRACE(XERR,
"Problems closing file '" << fnpath <<
"'; errno: " << errno);
1387 TRACE(XERR,
"Problems asserting ownership of " << fnpath);
1389 }
else if (ofs == (off_t)(-1)) {
1390 TRACE(XERR,
"Problems getting current position on file '" << fnpath <<
"'; errno: " << errno);
1392 if (flck && fclose(flck) != 0)
1393 TRACE(XERR,
"Problems closing file '" << fnpath <<
"'; errno: " << errno);
1398 TRACE(XERR,
"Problems setting permissions to 0644 on file '" << fnpath <<
"'; errno: " << errno);
1404 TRACE(ALL,
"New dataset with no URL!");
1460 XPDLOC(ALL,
"Manager::ResolveKeywords")
1464 TRACE(HDBG,
"enter: " << s <<
" - WorkDir(): " <<
WorkDir());
1467 if (s.replace(
"<workdir>",
WorkDir()))
1470 TRACE(HDBG,
"after <workdir>: " << s);
1473 if (s.replace(
"<host>",
Host()))
1476 TRACE(HDBG,
"after <host>: " << s);
1479 if (s.find(
"<port>") != STR_NPOS) {
1482 if (s.replace(
"<port>", sport.c_str()))
1487 if (s.find(
"<effuser>") != STR_NPOS) {
1490 if (s.replace(
"<effuser>", eui.
fUser.c_str()))
1497 if (s.replace(
"<user>", pcl->
User()))
1502 if (s.replace(
"<group>", pcl->
Group()))
1507 if (s.replace(
"<homedir>", pcl->
UI().
fHomeDir.c_str()))
1511 if (pcl && (s.find(
"<uid>") != STR_NPOS)) {
1514 if (s.replace(
"<uid>", suid.c_str()))
1519 if (pcl && (s.find(
"<gid>") != STR_NPOS)) {
1522 if (s.replace(
"<gid>", sgid.c_str()))
1526 TRACE(HDBG,
"exit: " << s);
1539 char *val, XrdOucStream *cfg,
bool rcf)
1541 XPDLOC(ALL,
"Manager::DoDirective")
1547 if (d->
fName ==
"trace") {
1549 }
else if (d->
fName ==
"groupfile") {
1551 }
else if (d->
fName ==
"maxoldlogs") {
1553 }
else if (d->
fName ==
"allow") {
1555 }
else if (d->
fName ==
"allowedgroups") {
1557 }
else if (d->
fName ==
"allowedusers") {
1559 }
else if (d->
fName ==
"role") {
1561 }
else if (d->
fName ==
"multiuser") {
1563 }
else if (d->
fName ==
"port") {
1565 }
else if (d->
fName ==
"datadir") {
1567 }
else if (d->
fName ==
"datasetsrc") {
1569 }
else if (d->
fName ==
"rootd") {
1571 }
else if (d->
fName ==
"rootdallow") {
1573 }
else if (d->
fName ==
"xrd.protocol") {
1575 }
else if (d->
fName ==
"filterlibpaths") {
1577 }
else if (d->
fName ==
"xrootd") {
1580 TRACE(XERR,
"unknown directive: " << d->
fName);
1589 XPDLOC(ALL,
"Manager::DoDirectiveTrace")
1626 while (val && val[0]) {
1628 if (val[0] ==
'-') {
1632 if (!strcmp(val,
"err")) {
1634 }
else if (!strcmp(val,
"req")) {
1636 }
else if (!strcmp(val,
"dbg")) {
1641 }
else if (!strcmp(val,
"login")) {
1643 }
else if (!strcmp(val,
"fork")) {
1645 }
else if (!strcmp(val,
"mem")) {
1647 }
else if (!strcmp(val,
"hdbg")) {
1653 }
else if (!strcmp(val,
"rsp")) {
1655 }
else if (!strcmp(val,
"aux")) {
1657 }
else if (!strcmp(val,
"cmgr")) {
1659 }
else if (!strcmp(val,
"smgr")) {
1661 }
else if (!strcmp(val,
"nmgr")) {
1663 }
else if (!strcmp(val,
"pmgr")) {
1665 }
else if (!strcmp(val,
"gmgr")) {
1667 }
else if (!strcmp(val,
"sched")) {
1669 }
else if (!strcmp(val,
"all") || !strcmp(val,
"dump")) {
1671 TRACE(ALL,
"Setting trace: " << on);
1676 val = cfg->GetWord();
1687 XPDLOC(ALL,
"Manager::DoDirectiveGroupfile")
1702 TRACE(XERR,
"groups manager already initialized: ignoring ");
1725 int maxoldlogs = strtol(val, 0, 10);
1767 XrdOucString s = val;
1769 XrdOucString grp, gid;
1771 while ((from = s.tokenize(grp, from,
',')) != STR_NPOS) {
1773 if (grp.beginswith(
'-')) {
1775 grp.erasefromstart(1);
1780 gid.form(
"%d", (
int) gi.
fGid);
1809 XrdOucString s = val;
1813 while ((from = s.tokenize(usr, from,
',')) != STR_NPOS) {
1815 if (usr.beginswith(
'-')) {
1817 usr.erasefromstart(1);
1843 XrdOucString tval(val);
1844 if (tval ==
"supermaster") {
1847 }
else if (tval ==
"master") {
1849 }
else if (tval ==
"submaster") {
1851 }
else if (tval ==
"worker") {
1853 }
else if (tval ==
"any") {
1869 XrdOucString port(val);
1870 if (port.beginswith(
"xproofd:")) {
1871 port.replace(
"xproofd:",
"");
1873 if (port.length() > 0 && port.isdigit()) {
1874 fPort = strtol(port.c_str(), 0, 10);
1886 XPDLOC(ALL,
"Manager::DoDirectiveMultiUser")
1893 int mu = strtol(val, 0, 10);
1897 val = cfg->GetWord();
1915 XrdOucString
type(val), url, opts, obscure;
1916 bool rw = 0, local = 0, goodsrc = 1;
1918 while ((nxt = cfg->GetWord())) {
1919 if (!strcmp(nxt,
"rw=1") || !strcmp(nxt,
"rw:1")) {
1921 }
else if (!strncmp(nxt,
"url:", 4)) {
1925 }
else if (!strncmp(nxt,
"opt:", 4)) {
1936 std::list<XrdProofdDSInfo *>::iterator ii =
fDataSetSrcs.begin();
1939 if ((*ii)->fLocal) {
1945 if (opts.length() <= 0) {
1946 opts = rw ?
"Ar:Av:" :
"-Ar:-Av:";
1949 local, rw, opts.c_str(), obscure.c_str());
1950 if (haslocal || !local) {
1974 while ((nxt = cfg->GetWord()) && (opts.length() == 0)) {
1980 if ((iq =
fDataDir.rfind(
'?')) != STR_NPOS) {
1995 XPDLOC(ALL,
"Manager::DoDirectiveXrootd")
2000 TRACE(ALL,
"val: "<< val);
2002 if (XrdMajorVNUM(XrdVNUMBER) < 4) {
2003 TRACE(ALL,
"WARNING: built against an XRootD version without libXrdXrootd.so :");
2004 TRACE(ALL,
"WARNING: loading external " << val <<
" may lead to incompatibilities");
2020 XPDLOC(ALL,
"Manager::DoDirectiveRootd")
2030 TRACE(ALL,
"val: "<< val);
2033 XrdOucString mode(
"ro"), auth(
"none"), fork(
"0");
2037 if (!strcmp(nxt,
"deny") || !strcmp(nxt,
"disable") || !strcmp(nxt,
"off")) {
2040 }
else if (!strcmp(nxt,
"allow") || !strcmp(nxt,
"enable") || !strcmp(nxt,
"on")) {
2043 TRACE(ALL,
"Use of this directive is deprecated: use xpd.xrootd instead");
2044 }
else if (!strncmp(nxt,
"mode:", 5)) {
2046 }
else if (!strncmp(nxt,
"auth:", 5)) {
2048 }
else if (!strncmp(nxt,
"fork:", 5)) {
2054 }
while ((nxt = cfg->GetWord()));
2061 fRootdArgs.push_back(XrdOucString(
"-nologin"));
2062 if (mode ==
"ro")
fRootdArgs.push_back(XrdOucString(
"-r"));
2063 if (auth ==
"none")
fRootdArgs.push_back(XrdOucString(
"-noauth"));
2064 fRootdFork = (fork ==
"1" || fork ==
"yes") ? 1 : 0;
2074 std::list<XrdOucString>::iterator ia =
fRootdArgs.begin();
2092 XPDLOC(ALL,
"Manager::DoDirectiveRootdAllow")
2098 TRACE(ALL,
"Use of this and 'xpd.rootd' directives is deprecated: use xpd.xrootd instead");
2100 TRACE(ALL,
"val: "<< val);
2103 XrdOucString hosts,
h;
2108 while ((from = hosts.tokenize(h, from,
',')) != -1) {
2111 }
while ((nxt = cfg->GetWord()));
2123 XPDLOC(ALL,
"Manager::DoDirectiveRemoveLibPaths")
2132 TRACE(ALL,
"val: "<< val);
2141 while ((nxt = cfg->GetWord())) {
2142 XrdOucString pps(nxt), p;
2144 while ((from = pps.tokenize(p, from,
',')) != -1) {
2145 if (p.length() > 0) {
2161 XPDLOC(ALL,
"Manager::IsRootdAllowed")
2167 if (!host || strlen(host) <= 0)
return 0;
2169 TRACE(DBG,
"checking host: "<< host);
2171 XrdOucString
h(host);
2172 std::list<XrdOucString>::iterator ia =
fRootdAllow.begin();
2174 if (h.matches((*ia).c_str(),
'*') > 0)
return 1;
2187 XPDLOC(ALL,
"Manager::Process")
2204 response->Send(kXR_InvalidRequest,
"Invalid request; user not logged in");
2205 return p->
Link()->setEtext(
"protocol sequence error 1");
2224 emsg +=
"Invalid request: ";
2230 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.
XrdSysPlugin * fXrootdPlugin
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
int DoDirectiveAllowedUsers(char *, XrdOucStream *, bool)
Process 'allowedusers' directive.