28 #include "XrdOuc/XrdOucEnv.hh"
29 #include "XrdOuc/XrdOucStream.hh"
96 #if defined(LIBC_SCCS) && !defined(lint)
97 static char sccsid[] =
"@(#)getgrouplist.c 8.2 (Berkeley) 12/8/94";
99 #include <sys/cdefs.h>
100 __FBSDID(
"$FreeBSD: src/lib/libc/gen/getgrouplist.c,v 1.14 2005/05/03 16:20:03 delphij Exp $");
106 #include <sys/types.h>
113 getgrouplist(
const char *uname, gid_t agroup, gid_t *groups,
int *grpcnt)
115 const struct group *grp;
116 int i, maxgroups, ngroups, ret;
126 groups ? groups[ngroups++] = agroup : ngroups++;
128 groups ? groups[ngroups++] = agroup : ngroups++;
133 while ((grp = getgrent()) !=
NULL) {
135 for (i = 0; i < ngroups; i++) {
136 if (grp->
gr_gid == groups[i])
140 for (i = 0; grp->
gr_mem[i]; i++) {
141 if (!strcmp(grp->
gr_mem[i], uname)) {
142 if (ngroups >= maxgroups) {
146 groups ? groups[ngroups++] = grp->
gr_gid : ngroups++;
170 XPDLOC(PMGR,
"ManagerCron")
174 TRACE(REQ,
"undefined manager: cannot start");
182 int mid = XrdSysTimer::Midnight(now);
186 TRACE(REQ,
"midnight in " << (mid - now) <<
" secs");
190 TRACE(REQ,
"running periodical checks");
196 if ((mid - now) <= tw) {
206 XrdSysTimer::Wait(tw * 1000);
247 fRootdArgs.push_back(XrdOucString(
"-nologin"));
249 fRootdArgs.push_back(XrdOucString(
"-noauth"));
254 std::list<XrdOucString>::iterator ia =
fRootdArgs.begin();
325 XPDLOC(ALL,
"Manager::CheckLogFileOwnership")
328 if (getuid())
return;
331 if (fstat(STDERR_FILENO, &st) != 0) {
332 if (errno != ENOENT) {
333 TRACE(XERR,
"could not stat log file; errno: " << errno);
338 TRACE(HDBG,
"uid: " << st.st_uid <<
", gid: " << st.st_gid);
343 TRACE(XERR,
"could not get effective user identity; errno: " << errno);
348 if (st.st_uid != epwd->
pw_uid || st.st_gid != epwd->
pw_gid) {
349 if (fchown(STDERR_FILENO, epwd->
pw_uid, epwd->
pw_gid) != 0) {
350 TRACE(XERR,
"could not set stderr ownership; errno: " << errno);
366 std::list<XrdOucString *>::iterator i;
368 if (wm.matches((*i)->c_str())) {
388 if (!usr || strlen(usr) <= 0) {
389 e =
"CheckUser: 'usr' string is undefined ";
394 if (strlen(usr) == 4 && !strcmp(usr,
"root")) {
395 e =
"CheckUser: 'root' logins not accepted ";
400 if (!grp || strlen(grp) <= 0) {
401 e =
"CheckUser: 'grp' string is undefined ";
412 e =
"CheckUser: unknown ClientID: ";
419 e =
"CheckUser: problems getting user info for id: ";
429 while ((from =
fSuperUsers.tokenize(tkn, from,
',')) != -1) {
475 int ugrpok = 0, pgrpok = 0;
477 int ngrps = 10, neg, ig = 0;
478 #if defined(__APPLE__)
484 if ((neg = getgrouplist(usr, ui.
fGid, grps, &ngrps)) < 0) neg = 10;
486 for (ig = 0; ig < neg; ig++) {
487 g.form(
"%d", (
int) grps[ig]);
493 e =
"Controlled access (UNIX group): user '";
495 e =
"', UNIX group '";
497 e +=
"' denied to connect";
511 e =
"Controlled access";
512 e +=
" (PROOF group): user '";
514 e +=
"', PROOF group '";
516 e +=
"' denied to connect";
521 grpok = ((ugrpok == 1 && pgrpok >= 0) || (ugrpok >= 0 && pgrpok == 1)) ? 1 : 0;
534 e =
"Controlled access: user '";
536 e +=
"', PROOF group '";
538 e +=
"' not allowed to connect";
550 if (usrok == -1 || (!grpok && usrok != 1))
return -1;
562 XPDLOC(ALL,
"Manager::LoadScheduler")
565 XrdOucString
name, lib,
m;
570 if (cfn && strlen(cfn) > 0) {
572 XrdOucStream cfg(
fEDest, getenv(
"XRDINSTANCE"), &myEnv);
575 if ((cfgFD =
open(cfn, O_RDONLY, 0)) >= 0) {
578 char *val = 0, *var = 0;
579 while ((var = cfg.GetMyFirstWord())) {
580 if (!(strcmp(
"xpd.sched", var))) {
596 XPDFORM(m,
"failure opening config file; errno: %d", errno);
602 if (name ==
"default" || !(name.length() > 0 && lib.length() > 0)) {
603 if ((name.length() <= 0 && lib.length() > 0) ||
604 (name.length() > 0 && lib.length() <= 0)) {
605 XPDFORM(m,
"missing or incomplete info (name: %s, lib: %s)", name.c_str(), lib.c_str());
608 TRACE(DBG,
"instantiating default scheduler");
612 if (lib.beginswith(
"~") || lib.beginswith(
"$"))
625 TRACE(XERR,
"unable to create scheduler object from " << lib);
633 TRACE(XERR,
" unable to instantiate the " << sched->
Name() <<
" scheduler using " << (cfn ? cfn :
"<nul>"));
638 TRACE(ALL,
"scheduler loaded: type: " << sched->
Name());
650 XPDLOC(ALL,
"Manager::GetWorkers")
657 TRACE(XERR,
"scheduler undefined");
662 std::list<XrdProofWorker *> wrks, uwrks;
664 TRACE(XERR,
"error getting list of workers from the scheduler");
667 std::list<XrdProofWorker *>::iterator iw, iaw;
671 TRACE(DBG,
"list size: " << wrks.size());
678 for (iw = wrks.begin(); iw != wrks.end() ; iw++) {
682 for (iaw = uwrks.begin(); iaw != uwrks.end() ; iaw++) {
707 for (iw = uwrks.begin(); iw != uwrks.end() ; iw++) {
710 if (w->
fType ==
'M') {
711 if (lw.length() > 0) lw.insert(
'&',0);
712 lw.insert(w->
Export(), 0);
715 if (lw.length() > 0) lw +=
'&';
724 for (iw = wrks.begin(); iw != wrks.end() ; iw++) {
740 if (rc != 2 || (proto < 21 && rc == 0)) {
743 TRACE(DBG,
"from ExportWorkers: " << lw);
744 }
else if (proto >= 21) {
752 if (uwrks.size() > 0) {
754 while (iw != uwrks.end()) {
756 iw = uwrks.erase(iw);
769 xpd_acm_lists_t *
ls = (xpd_acm_lists_t *)s;
772 XrdOucString &
ss = (*d == 1) ? ls->allowed : ls->denied;
779 if (ss.length() > 0) ss +=
",";
797 XrdOucString *
ls = (XrdOucString *)s;
804 if (ls->length() > 0) *ls +=
",";
822 XPDLOC(ALL,
"Manager::Config")
828 XPDERR(
"problems parsing file ");
833 msg = (rcf) ?
"re-configuring" :
"configuring";
850 XPDFORM(msg,
"could not resolve effective uid %d (errno: %d)", effuid, errno);
856 char *host = XrdSysDNS::getHostName();
857 fHost = host ? host :
"";
864 const char *roles[] = {
"any",
"worker",
"submaster",
"master" };
892 pidfile +=
"/xrootd.pid";
893 FILE *fpid = fopen(pidfile.c_str(),
"w");
895 XPDFORM(msg,
"unable to open pid file: %s; errno: %d", pidfile.c_str(), errno);
899 fprintf(fpid,
"%d", getpid());
903 XPDFORM(msg,
"could not resolve effective uid %d (errno: %d)", effuid, errno);
919 if (iph != STR_NPOS) {
922 XPDERR(
"unable to assert working dir: " << wdir);
930 if (wdir.length() > 0) {
931 TRACE(ALL,
"working directories under: " << wdir);
948 TRACE(XERR,
"could not get privileges to set/change ownership of " <<
fDataDir);
951 if (chmod(
fDataDir.c_str(), 0777) != 0) {
952 XPDERR(
"problems setting permissions 0777 data dir: " <<
fDataDir);
962 std::list<XrdOucString *>::iterator i;
964 TRACE(ALL,
"masters allowed to connect: " << (*i)->c_str());
966 TRACE(ALL,
"masters allowed to connect: any");
984 XPDERR(
"scheduler initialization failed");
987 const char *st[] = {
"disabled",
"enabled" };
993 TRACE(ALL,
"multi-process on nodes handled with proof-lite");
1002 TRACE(ALL,
">> Defined dataset: " << (*ii)->ToString());
1003 if ((*ii)->fType ==
"file") {
1005 XPDERR(
"source " << (*ii)->fUrl <<
" could not be validated");
1013 TRACE(ALL,
"Skipping validation (no \"file\" type dataset source)");
1020 TRACE(ALL,
">> Valid dataset: " << (*ii)->ToString());
1021 if ((*ii)->fLocal && (*ii)->fRW) {
1027 TRACE(ALL,
"no dataset sources defined");
1030 TRACE(ALL,
"no dataset sources defined");
1041 XPDFORM(msg,
"could not resolve effective uid %d (errno: %d)",
1053 while ((from =
fSuperUsers.tokenize(usr, from,
',')) != STR_NPOS) {
1062 XPDFORM(msg,
"running in controlled access mode: users removed because"
1063 " unknown to the system: %s", ius.c_str());
1068 xpd_acm_lists_t uls;
1070 if (uls.allowed.length()) {
1071 XPDFORM(msg,
"running in controlled access mode: users allowed: %s", uls.allowed.c_str());
1074 if (uls.denied.length()) {
1075 XPDFORM(msg,
"running in controlled access mode: users denied: %s", uls.denied.c_str());
1079 xpd_acm_lists_t gls;
1081 if (gls.allowed.length()) {
1082 XPDFORM(msg,
"running in controlled access mode: UNIX groups allowed: %s", gls.allowed.c_str());
1085 if (gls.denied.length()) {
1086 XPDFORM(msg,
"running in controlled access mode: UNIX groups denied: %s", gls.denied.c_str());
1099 while ((from = paths.tokenize(ldir, from,
':')) != STR_NPOS) {
1101 if (ldir.length() > 0) {
1106 DIR *
dir = opendir(ldir.c_str());
1109 struct dirent *ent = 0;
1110 while ((ent = (
struct dirent *)readdir(dir))) {
1111 if (!strncmp(ent->d_name,
"libCore", 7)) {
1127 ctrim =
" (lib paths filter applied)";
1148 XPDERR(
"problems configuring the admin handler");
1154 XPDERR(
"problems configuring the network manager");
1160 XPDERR(
"problems configuring the priority manager");
1168 XPDERR(
"problems configuring the ROOT versions manager");
1175 XPDERR(
"problems configuring the client manager");
1181 XPDERR(
"problems configuring the session manager");
1187 XPDERR(
"problems configuring the scheduler");
1205 if (roo && strlen(roo->
BinDir()) > 0) {
1206 XrdOucString bindir(roo->
BinDir());
1207 if (!bindir.endswith(
"/")) bindir +=
"/";
1214 XrdOucString sockpath;
1217 if (!fRootdUnixSrv || (fRootdUnixSrv && !fRootdUnixSrv->isvalid(0))) {
1218 XPDERR(
"could not start unix server connection on path "<<
1219 sockpath<<
" - errno: "<<(
int)errno);
1223 TRACE(ALL,
"unix socket path for rootd call backs: "<<sockpath);
1227 std::list<XrdOucString>::iterator ia =
fRootdAllow.begin();
1229 if (hhs.length() > 0) hhs +=
",";
1230 hhs += (*ia).c_str();
1233 TRACE(ALL,
"serving files with: '" <<
fRootdExe <<
"' (protocol: 'rootd://') to ALLOWED hosts");
1234 TRACE(ALL,
"rootd-allowed hosts: "<< hhs);
1236 TRACE(ALL,
"serving files with: '" <<
fRootdExe <<
"' (protocol: 'rootd://') to ALL hosts");
1240 TRACE(ALL,
"file serving (protocol: 'rootd://') explicitly disabled");
1247 (
void *)
this, 0,
"ProofdManager cron thread") != 0) {
1248 XPDERR(
"could not start cron thread");
1251 TRACE(ALL,
"manager cron thread started");
1265 XPDLOC(ALL,
"Manager::ValidateLocalDataSetSrc")
1267 TRACE(ALL,
"validating '" << url <<
"' ...");
1270 if (url.length() > 0) {
1272 if (url.beginswith(
"file:")) url.replace(
"file:",
"");
1273 if (url.beginswith(
"/")) {
1282 TRACE(XERR,
"Problems setting permissions 0777 on path '" << url <<
"'");
1285 TRACE(XERR,
"Cannot assert path '" << url <<
"' - ignoring");
1289 XrdOucString fnpath(url.c_str());
1290 fnpath +=
"/dataset.list";
1291 if (access(fnpath.c_str(), F_OK) != 0) {
1292 FILE *flst = fopen(fnpath.c_str(),
"w");
1294 TRACE(XERR,
"Cannot open file '" << fnpath <<
"' for the dataset list; errno: " << errno);
1297 if (fclose(flst) != 0)
1298 TRACE(XERR,
"Problems closing file '" << fnpath <<
"'; errno: " << errno);
1300 TRACE(XERR,
"Problems asserting ownership of " << fnpath);
1306 TRACE(XERR,
"Problems setting permissions to 0666 on file '" << fnpath <<
"'; errno: " << errno);
1311 fnpath.replace(
"/dataset.list",
"/lock.location");
1312 FILE *flck = fopen(fnpath.c_str(),
"a");
1314 TRACE(XERR,
"Cannot open file '" << fnpath <<
"' with the lock file path; errno: " << errno);
1317 off_t ofs = lseek(fileno(flck), 0, SEEK_CUR);
1320 XrdOucString fnlock(url);
1321 fnlock.replace(
"/",
"%");
1322 fnlock.replace(
":",
"%");
1323 fnlock.insert(
"/tmp/", 0);
1324 fprintf(flck,
"%s\n", fnlock.c_str());
1325 if (fclose(flck) != 0)
1326 TRACE(XERR,
"Problems closing file '" << fnpath <<
"'; errno: " << errno);
1329 TRACE(XERR,
"Problems asserting ownership of " << fnpath);
1331 }
else if (ofs == (off_t)(-1)) {
1332 TRACE(XERR,
"Problems getting current position on file '" << fnpath <<
"'; errno: " << errno);
1334 if (flck && fclose(flck) != 0)
1335 TRACE(XERR,
"Problems closing file '" << fnpath <<
"'; errno: " << errno);
1340 TRACE(XERR,
"Problems setting permissions to 0644 on file '" << fnpath <<
"'; errno: " << errno);
1346 TRACE(ALL,
"New dataset with no URL!");
1401 XPDLOC(ALL,
"Manager::ResolveKeywords")
1405 TRACE(HDBG,
"enter: " << s <<
" - WorkDir(): " <<
WorkDir());
1408 if (s.replace(
"<workdir>",
WorkDir()))
1411 TRACE(HDBG,
"after <workdir>: " << s);
1414 if (s.replace(
"<host>",
Host()))
1417 TRACE(HDBG,
"after <host>: " << s);
1420 if (s.find(
"<port>") != STR_NPOS) {
1423 if (s.replace(
"<port>", sport.c_str()))
1428 if (s.find(
"<effuser>") != STR_NPOS) {
1431 if (s.replace(
"<effuser>", eui.
fUser.c_str()))
1438 if (s.replace(
"<user>", pcl->
User()))
1443 if (s.replace(
"<group>", pcl->
Group()))
1448 if (s.replace(
"<homedir>", pcl->
UI().
fHomeDir.c_str()))
1452 if (pcl && (s.find(
"<uid>") != STR_NPOS)) {
1455 if (s.replace(
"<uid>", suid.c_str()))
1460 if (pcl && (s.find(
"<gid>") != STR_NPOS)) {
1463 if (s.replace(
"<gid>", sgid.c_str()))
1467 TRACE(HDBG,
"exit: " << s);
1480 char *val, XrdOucStream *cfg,
bool rcf)
1482 XPDLOC(ALL,
"Manager::DoDirective")
1488 if (d->
fName ==
"trace") {
1490 }
else if (d->
fName ==
"groupfile") {
1492 }
else if (d->
fName ==
"maxoldlogs") {
1494 }
else if (d->
fName ==
"allow") {
1496 }
else if (d->
fName ==
"allowedgroups") {
1498 }
else if (d->
fName ==
"allowedusers") {
1500 }
else if (d->
fName ==
"role") {
1502 }
else if (d->
fName ==
"multiuser") {
1504 }
else if (d->
fName ==
"port") {
1506 }
else if (d->
fName ==
"datadir") {
1508 }
else if (d->
fName ==
"datasetsrc") {
1510 }
else if (d->
fName ==
"rootd") {
1512 }
else if (d->
fName ==
"rootdallow") {
1514 }
else if (d->
fName ==
"xrd.protocol") {
1516 }
else if (d->
fName ==
"filterlibpaths") {
1519 TRACE(XERR,
"unknown directive: " << d->
fName);
1528 XPDLOC(ALL,
"Manager::DoDirectiveTrace")
1565 while (val && val[0]) {
1567 if (val[0] ==
'-') {
1571 if (!strcmp(val,
"err")) {
1573 }
else if (!strcmp(val,
"req")) {
1575 }
else if (!strcmp(val,
"dbg")) {
1580 }
else if (!strcmp(val,
"login")) {
1582 }
else if (!strcmp(val,
"fork")) {
1584 }
else if (!strcmp(val,
"mem")) {
1586 }
else if (!strcmp(val,
"hdbg")) {
1592 }
else if (!strcmp(val,
"rsp")) {
1594 }
else if (!strcmp(val,
"aux")) {
1596 }
else if (!strcmp(val,
"cmgr")) {
1598 }
else if (!strcmp(val,
"smgr")) {
1600 }
else if (!strcmp(val,
"nmgr")) {
1602 }
else if (!strcmp(val,
"pmgr")) {
1604 }
else if (!strcmp(val,
"gmgr")) {
1606 }
else if (!strcmp(val,
"sched")) {
1608 }
else if (!strcmp(val,
"all") || !strcmp(val,
"dump")) {
1610 TRACE(ALL,
"Setting trace: " << on);
1615 val = cfg->GetWord();
1626 XPDLOC(ALL,
"Manager::DoDirectiveGroupfile")
1641 TRACE(XERR,
"groups manager already initialized: ignoring ");
1664 int maxoldlogs = strtol(val, 0, 10);
1706 XrdOucString s = val;
1708 XrdOucString grp, gid;
1710 while ((from = s.tokenize(grp, from,
',')) != STR_NPOS) {
1712 if (grp.beginswith(
'-')) {
1714 grp.erasefromstart(1);
1719 gid.form(
"%d", (
int) gi.
fGid);
1748 XrdOucString s = val;
1752 while ((from = s.tokenize(usr, from,
',')) != STR_NPOS) {
1754 if (usr.beginswith(
'-')) {
1756 usr.erasefromstart(1);
1782 XrdOucString tval(val);
1783 if (tval ==
"supermaster") {
1786 }
else if (tval ==
"master") {
1788 }
else if (tval ==
"submaster") {
1790 }
else if (tval ==
"worker") {
1792 }
else if (tval ==
"any") {
1808 XrdOucString port(val);
1809 if (port.beginswith(
"xproofd:")) {
1810 port.replace(
"xproofd:",
"");
1812 if (port.length() > 0 && port.isdigit()) {
1813 fPort = strtol(port.c_str(), 0, 10);
1825 XPDLOC(ALL,
"Manager::DoDirectiveMultiUser")
1832 int mu = strtol(val, 0, 10);
1836 val = cfg->GetWord();
1854 XrdOucString
type(val), url, opts, obscure;
1855 bool rw = 0, local = 0, goodsrc = 1;
1857 while ((nxt = cfg->GetWord())) {
1858 if (!strcmp(nxt,
"rw=1") || !strcmp(nxt,
"rw:1")) {
1860 }
else if (!strncmp(nxt,
"url:", 4)) {
1862 XrdClientUrlInfo u(url);
1863 if (u.Proto ==
"" && u.HostWPort ==
"") local = 1;
1864 }
else if (!strncmp(nxt,
"opt:", 4)) {
1875 std::list<XrdProofdDSInfo *>::iterator
ii =
fDataSetSrcs.begin();
1878 if ((*ii)->fLocal) {
1884 if (opts.length() <= 0) {
1885 opts = rw ?
"Ar:Av:" :
"-Ar:-Av:";
1888 local, rw, opts.c_str(), obscure.c_str());
1889 if (haslocal || !local) {
1913 while ((nxt = cfg->GetWord()) && (opts.length() == 0)) {
1919 if ((iq =
fDataDir.rfind(
'?')) != STR_NPOS) {
1935 XPDLOC(ALL,
"Manager::DoDirectiveRootd")
1945 TRACE(ALL,
"val: "<< val);
1948 XrdOucString mode(
"ro"), auth(
"none"), fork(
"0");
1952 if (!strcmp(nxt,
"deny") || !strcmp(nxt,
"disable") || !strcmp(nxt,
"off")) {
1955 }
else if (!strcmp(nxt,
"allow") || !strcmp(nxt,
"enable") || !strcmp(nxt,
"on")) {
1958 }
else if (!strncmp(nxt,
"mode:", 5)) {
1960 }
else if (!strncmp(nxt,
"auth:", 5)) {
1962 }
else if (!strncmp(nxt,
"fork:", 5)) {
1968 }
while ((nxt = cfg->GetWord()));
1975 fRootdArgs.push_back(XrdOucString(
"-nologin"));
1976 if (mode ==
"ro")
fRootdArgs.push_back(XrdOucString(
"-r"));
1977 if (auth ==
"none")
fRootdArgs.push_back(XrdOucString(
"-noauth"));
1978 fRootdFork = (fork ==
"1" || fork ==
"yes") ? 1 : 0;
1988 std::list<XrdOucString>::iterator ia =
fRootdArgs.begin();
2006 XPDLOC(ALL,
"Manager::DoDirectiveRootdAllow")
2012 TRACE(ALL,
"val: "<< val);
2015 XrdOucString hosts,
h;
2020 while ((from = hosts.tokenize(h, from,
',')) != -1) {
2023 }
while ((nxt = cfg->GetWord()));
2035 XPDLOC(ALL,
"Manager::DoDirectiveRemoveLibPaths")
2044 TRACE(ALL,
"val: "<< val);
2053 while ((nxt = cfg->GetWord())) {
2054 XrdOucString pps(nxt), p;
2056 while ((from = pps.tokenize(p, from,
',')) != -1) {
2057 if (p.length() > 0) {
2073 XPDLOC(ALL,
"Manager::IsRootdAllowed")
2079 if (!host || strlen(host) <= 0)
return 0;
2081 TRACE(DBG,
"checking host: "<< host);
2083 XrdOucString
h(host);
2084 std::list<XrdOucString>::iterator ia =
fRootdAllow.begin();
2086 if (h.matches((*ia).c_str(),
'*') > 0)
return 1;
2099 XPDLOC(ALL,
"Manager::Process")
2116 response->Send(kXR_InvalidRequest,
"Invalid request; user not logged in");
2117 return p->
Link()->setEtext(
"protocol sequence error 1");
2136 emsg +=
"Invalid request: ";
2142 response->Send(kXR_InvalidRequest, emsg.c_str());
int Auth(XrdProofdProtocol *xp)
Analyse client authentication info.
XrdProofdProofServMgr * fSessionMgr
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 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.
const char * Name() const
int DoDirectiveFilterLibPaths(char *, XrdOucStream *, bool)
Process 'filterlibpaths' directive xpd.filterlibpaths 1|0 [path1,path2 path3 path4 ...
XrdProofdClientMgr * fClientMgr
int GetWorkers(XrdOucString &workers, XrdProofdProofServ *, const char *)
Get a list of workers from the available resource broker.
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.
#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.
kXR_int16 SrvProtVers() const
#define TRACE(Flag, Args)
XrdProofGroupMgr * GroupsMgr() const
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.
XrdProofdProofServMgr * SessionMgr() const
XrdOucHash< int > fAllowedUsers
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...
XrdROOT * DefaultVersion() const
XrdProofSched * LoadScheduler()
Load PROOF scheduler.
const char * BinDir() const
XrdProofGroupMgr * fGroupsMgr
int DoDirective(XrdProofdDirective *d, char *val, XrdOucStream *cfg, bool rcf)
Update the priorities of the active sessions.
void AddProofServ(XrdProofdProofServ *xps)
XrdOucString fEffectiveUser
if(pyself &&pyself!=Py_None)
XrdOucString fStageReqRepo
XrdProofdManager(XrdProtocol_Config *pi, XrdSysError *edest)
Constructor.
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)
XPClientRequest * Request() const
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.
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.
const char * GetCfgFile() const
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.
const char * Host() const
static int ChangeMod(const char *path, unsigned int mode)
Change the permission mode of 'path' to 'mode'.
const char * Group() const
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.
bool WorkerUsrCfg() const
virtual int GetWorkers(XrdProofdProofServ *xps, std::list< XrdProofWorker * > *, const char *)
Get a list of workers that can be used by session 'xps'.
int DoDirectiveMultiUser(char *, XrdOucStream *, bool)
Process 'multiuser' directive.
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 * User() const
int DoDirectiveDataSetSrc(char *, XrdOucStream *, bool)
Process 'datasetsrc' directive.
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)
const char * CfgFile() const
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).
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)
int DoDirectiveAllowedUsers(char *, XrdOucStream *, bool)
Process 'allowedusers' directive.
const char * WorkDir() const