Skip to content

Commit 4ec63a2

Browse files
committed
[Server] Allow setting envars prefix with 'XRDCLS3_', partially addresses 2787
1 parent 489f0d4 commit 4ec63a2

1 file changed

Lines changed: 40 additions & 40 deletions

File tree

src/XrdOuc/XrdOucStream.cc

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
/******************************************************************************/
6868
/* l o c a l d e f i n e s */
6969
/******************************************************************************/
70-
70+
7171
#define MaxARGC 64
7272
#define XrdOucStream_EOM 0x01
7373
#define XrdOucStream_BUSY 0x02
@@ -88,7 +88,7 @@
8888
/******************************************************************************/
8989
/* S t a t i c M e m b e r s & O b j e c t s */
9090
/******************************************************************************/
91-
91+
9292
// The following mutex is used to allow only one fork at a time so that
9393
// we do not leak file descriptors. It is a short-lived lock.
9494
//
@@ -131,7 +131,7 @@ void Add(const char *sfx) {tlP = new XrdOucTList(sfx,(int)strlen(sfx),tlP);}
131131
}
132132
};
133133
}
134-
134+
135135
/******************************************************************************/
136136
/* L o c a l F u n c t i o n s */
137137
/******************************************************************************/
@@ -183,7 +183,7 @@ bool KeepFile(const char *fname, XrdOucTList *tlP)
183183
/******************************************************************************/
184184
/* o o u c _ S t r e a m C o n s t r u c t o r */
185185
/******************************************************************************/
186-
186+
187187
XrdOucStream::XrdOucStream(XrdSysError *erobj, const char *ifname,
188188
XrdOucEnv *anEnv, const char *Pfx)
189189
{
@@ -248,8 +248,8 @@ int XrdOucStream::AttachIO(int infd, int outfd, int bsz)
248248
FE = outfd;
249249
return 0;
250250
}
251-
252-
int XrdOucStream::Attach(int FileDescriptor, int bsz)
251+
252+
int XrdOucStream::Attach(int FileDescriptor, int bsz)
253253
{
254254

255255
// Close the current stream. Close will handle unopened streams.
@@ -278,11 +278,11 @@ int XrdOucStream::Attach(int FileDescriptor, int bsz)
278278
xline = 0;
279279
sawif = 0;
280280
skpel = 0;
281-
if (llBuff)
281+
if (llBuff)
282282
{llBcur = llBuff; *llBuff = '\0'; llBleft = llBsz; llBok = 0;}
283283
return 0;
284284
}
285-
285+
286286
/******************************************************************************/
287287
/* C a p t u r e */
288288
/******************************************************************************/
@@ -363,8 +363,8 @@ void XrdOucStream::Close(int hold)
363363
/******************************************************************************/
364364
/* D r a i n */
365365
/******************************************************************************/
366-
367-
int XrdOucStream::Drain()
366+
367+
int XrdOucStream::Drain()
368368
{
369369
int Status = 0;
370370

@@ -385,7 +385,7 @@ int XrdOucStream::Drain()
385385
#endif
386386
return Status;
387387
}
388-
388+
389389
/******************************************************************************/
390390
/* E c h o */
391391
/******************************************************************************/
@@ -411,11 +411,11 @@ void XrdOucStream::Echo(bool capture)
411411
}
412412
llBok = 0;
413413
}
414-
414+
415415
/******************************************************************************/
416416
/* E x e c */
417417
/******************************************************************************/
418-
418+
419419
int XrdOucStream::Exec(const char *theCmd, int inrd, int efd)
420420
{
421421
int j;
@@ -428,7 +428,7 @@ int XrdOucStream::Exec(const char *theCmd, int inrd, int efd)
428428
//
429429
origcmd = cmd = (char *)malloc(strlen(theCmd)+1);
430430
strcpy(cmd, theCmd);
431-
431+
432432
// Construct the argv array based on passed command line.
433433
//
434434
for (j = 0; j < MaxARGC-1 && *cmd; j++)
@@ -550,7 +550,7 @@ int XrdOucStream::Exec(char **parm, int inrd, int efd)
550550
/******************************************************************************/
551551
/* G e t L i n e */
552552
/******************************************************************************/
553-
553+
554554
char *XrdOucStream::GetLine()
555555
{
556556
int bcnt, retc;
@@ -574,7 +574,7 @@ char *XrdOucStream::GetLine()
574574
return recp;
575575
}
576576
else if (notabs && *bp == '\t') *bp = ' ';
577-
577+
578578
// There is no next record, so move up data in the buffer.
579579
//
580580
bnext = stpncpy(buff, bnext, bleft);
@@ -627,7 +627,7 @@ char *XrdOucStream::GetLine()
627627
/******************************************************************************/
628628
/* G e t T o k e n */
629629
/******************************************************************************/
630-
630+
631631
char *XrdOucStream::GetToken(int lowcase) {
632632
char *tpoint;
633633

@@ -692,7 +692,7 @@ char *XrdOucStream::GetFirstWord(int lowcase)
692692
/******************************************************************************/
693693
/* G e t M y F i r s t W o r d */
694694
/******************************************************************************/
695-
695+
696696
char *XrdOucStream::GetMyFirstWord(int lowcase)
697697
{
698698
char *var;
@@ -741,7 +741,7 @@ char *XrdOucStream::GetMyFirstWord(int lowcase)
741741
/******************************************************************************/
742742
/* G e t W o r d */
743743
/******************************************************************************/
744-
744+
745745
char *XrdOucStream::GetWord(int lowcase)
746746
{
747747
char *wp, *ep;
@@ -805,7 +805,7 @@ do {while(GetLine())
805805
/******************************************************************************/
806806
/* G e t R e s t */
807807
/******************************************************************************/
808-
808+
809809
int XrdOucStream::GetRest(char *theBuff, int Blen, int lowcase)
810810
{
811811
char *tp, *myBuff = theBuff;
@@ -831,7 +831,7 @@ int XrdOucStream::GetRest(char *theBuff, int Blen, int lowcase)
831831
/******************************************************************************/
832832
/* R e t T o k e n */
833833
/******************************************************************************/
834-
834+
835835
void XrdOucStream::RetToken()
836836
{
837837
// Check if we can back up
@@ -841,7 +841,7 @@ void XrdOucStream::RetToken()
841841
// Find the null byte for the token and remove it, if possible
842842
//
843843
while(*token && token != recp) token--;
844-
if (token != recp)
844+
if (token != recp)
845845
{if (token+1 != bnext) *token = ' ';
846846
token--;
847847
while(*token && *token != ' ' && token != recp) token--;
@@ -897,11 +897,11 @@ int XrdOucStream::Put(const char *datavec[], const int dlenvec[]) {
897897
}
898898
return 0;
899899
}
900-
900+
901901
/******************************************************************************/
902902
/* P u t L i n e */
903903
/******************************************************************************/
904-
904+
905905
int XrdOucStream::PutLine(const char *data, int dlen)
906906
{
907907
static const int plSize = 2048;
@@ -954,7 +954,7 @@ int XrdOucStream::Wait4Data(int msMax)
954954
//
955955
return (polltab.revents & (POLLIN|POLLRDNORM) ? 0 : EIO);
956956
}
957-
957+
958958
/******************************************************************************/
959959
/* P r i v a t e M e t h o d s */
960960
/******************************************************************************/
@@ -968,7 +968,7 @@ void XrdOucStream::add2CFG(const char *data, bool isCMT)
968968
theCFG->append(data);
969969
theCFG->append('\n');
970970
}
971-
971+
972972
/******************************************************************************/
973973
/* a d d 2 l l B */
974974
/******************************************************************************/
@@ -1003,11 +1003,11 @@ char *XrdOucStream::add2llB(char *tok, int reset)
10031003
}
10041004
return tok;
10051005
}
1006-
1006+
10071007
/******************************************************************************/
10081008
/* E c h o */
10091009
/******************************************************************************/
1010-
1010+
10111011
bool XrdOucStream::Echo(int ec, const char *t1, const char *t2, const char *t3)
10121012
{
10131013
if (Eroute)
@@ -1022,7 +1022,7 @@ bool XrdOucStream::Echo(int ec, const char *t1, const char *t2, const char *t3)
10221022
/******************************************************************************/
10231023
/* d o c o n t */
10241024
/******************************************************************************/
1025-
1025+
10261026
bool XrdOucStream::docont()
10271027
{
10281028
char *theWord;
@@ -1068,7 +1068,7 @@ bool XrdOucStream::docont()
10681068
// if (Eroute) Eroute->Say(llPrefix, "continue ", bnext);
10691069
return docont(cH.path, cH.tlP);
10701070
}
1071-
1071+
10721072
/******************************************************************************/
10731073

10741074
bool XrdOucStream::docont(const char *path, XrdOucTList *tlP)
@@ -1126,7 +1126,7 @@ bool XrdOucStream::docont(const char *path, XrdOucTList *tlP)
11261126
/******************************************************************************/
11271127
/* d o c o n t D */
11281128
/******************************************************************************/
1129-
1129+
11301130
bool XrdOucStream::docontD(const char *path, XrdOucTList *tlP)
11311131
{
11321132
static const mode_t isXeq = S_IXUSR | S_IXGRP | S_IXOTH;
@@ -1165,7 +1165,7 @@ bool XrdOucStream::docontD(const char *path, XrdOucTList *tlP)
11651165
myInfo->itFC = myInfo->fcList->begin();
11661166
return true;
11671167
}
1168-
1168+
11691169
/******************************************************************************/
11701170
/* c o n t F */
11711171
/******************************************************************************/
@@ -1203,7 +1203,7 @@ bool XrdOucStream::docontF(const char *path, bool noentok)
12031203
close(cFD);
12041204
return true;
12051205
}
1206-
1206+
12071207
/******************************************************************************/
12081208
/* d o e l s e */
12091209
/******************************************************************************/
@@ -1248,7 +1248,7 @@ char *XrdOucStream::doelse()
12481248
} while(var && !strcmp("else", var));
12491249
return var;
12501250
}
1251-
1251+
12521252
/******************************************************************************/
12531253
/* d o i f */
12541254
/******************************************************************************/
@@ -1313,7 +1313,7 @@ char *XrdOucStream::doif()
13131313

13141314
// Make sure we have a fi
13151315
//
1316-
if (!var)
1316+
if (!var)
13171317
{if (Eroute) Eroute->Emsg("Stream", "Missing 'fi' for last 'if'.");
13181318
ecode = EINVAL;
13191319
}
@@ -1323,7 +1323,7 @@ char *XrdOucStream::doif()
13231323
/******************************************************************************/
13241324
/* g e t V a l u e */
13251325
/******************************************************************************/
1326-
1326+
13271327
int XrdOucStream::getValue(const char *path, char *vbuff, int vbsz)
13281328
{
13291329
struct stat Stat;
@@ -1345,11 +1345,11 @@ int XrdOucStream::getValue(const char *path, char *vbuff, int vbsz)
13451345
close(vFD);
13461346
return rc;
13471347
}
1348-
1348+
13491349
/******************************************************************************/
13501350
/* i s S e t */
13511351
/******************************************************************************/
1352-
1352+
13531353
int XrdOucStream::isSet(char *var)
13541354
{
13551355
static const char *Mtxt1[2] = {"setenv", "set"};
@@ -1389,7 +1389,7 @@ int XrdOucStream::isSet(char *var)
13891389
{sawIT = *vp; *vp = '\0'; vp++;}
13901390
if (strlcpy(Vname, tp, sizeof(Vname)) >= sizeof(Vname))
13911391
return xMsg(Mtxt2[Set],tp,"is too long.");
1392-
if (!Set && !strncmp("XRD", Vname, 3))
1392+
if (!Set && !strncmp("XRD", Vname, 3) && strncmp("XRDCLS3_", Vname, 8))
13931393
return xMsg("Setenv variable",tp,"may not start with 'XRD'.");
13941394

13951395
// Verify that variable is only an alphanum
@@ -1466,7 +1466,7 @@ int XrdOucStream::isSet(char *var)
14661466
/******************************************************************************/
14671467
/* v S u b s */
14681468
/******************************************************************************/
1469-
1469+
14701470
char *XrdOucStream::vSubs(char *Var)
14711471
{
14721472
char *vp, *sp, *dp, *vnp, ec, bkp, valbuff[maxVLen], Nil = 0;

0 commit comments

Comments
 (0)