Skip to content

Commit

Permalink
[Proxy] Avoid SEGV when doing passthrogh TPC.
Browse files Browse the repository at this point in the history
  • Loading branch information
abh3 committed Jun 15, 2020
1 parent 249b1b5 commit a591cb4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/XrdPss/XrdPss.cc
Expand Up @@ -736,6 +736,10 @@ int XrdPssFile::Open(const char *path, int Oflag, mode_t Mode, XrdOucEnv &Env)
bool ucgiOK = true;
bool ioCache = (Oflag & O_DIRECT);

// Record the security environment
//
entity = Env.secEnv();

// Turn off direct flag if set (we record it separately
//
if (ioCache) Oflag &= ~O_DIRECT;
Expand Down Expand Up @@ -976,7 +980,8 @@ int XrdPssFile::Fstat(struct stat *buff)
{
if (fd < 0)
{if (!tpcPath) return -XRDOSS_E8004;
if (XrdProxySS.Stat(tpcPath, buff))
XrdOucEnv fstatEnv(0, 0, entity);
if (XrdProxySS.Stat(tpcPath, buff, 0, &fstatEnv))
memset(buff, 0, sizeof(struct stat));
return XrdOssOK;
}
Expand Down
5 changes: 4 additions & 1 deletion src/XrdPss/XrdPss.hh
Expand Up @@ -65,6 +65,7 @@ const char *tident;
/******************************************************************************/

struct XrdOucIOVec;
class XrdSecEntity;
class XrdSfsAio;

class XrdPssFile : public XrdOssDF
Expand Down Expand Up @@ -93,7 +94,7 @@ ssize_t Write(const void *, off_t, size_t);
int Write(XrdSfsAio *aiop);

// Constructor and destructor
XrdPssFile(const char *tid) : tident(tid), tpcPath(0)
XrdPssFile(const char *tid) : tident(tid), tpcPath(0), entity(0)
{fd = -1;}

virtual ~XrdPssFile() {if (fd >= 0) Close();
Expand All @@ -104,6 +105,8 @@ private:

const char *tident;
char *tpcPath;

const XrdSecEntity *entity;
};

/******************************************************************************/
Expand Down
1 change: 1 addition & 0 deletions src/XrdPss/XrdPssUrlInfo.cc
Expand Up @@ -116,6 +116,7 @@ XrdPssUrlInfo::XrdPssUrlInfo(XrdOucEnv *envP, const char *path,
// Preset for no id in the url
//
*theID = 0;
tident = 0;

// If there is an environment point, get user's cgi and set the tident from it
//
Expand Down

0 comments on commit a591cb4

Please sign in to comment.