Skip to content

Commit

Permalink
[Server] Add appname to SecEntity attribute set.
Browse files Browse the repository at this point in the history
[Server] Assign a unique ID to each SecEntity instance.
  • Loading branch information
abh3 committed Oct 8, 2019
1 parent 2c35c3b commit da8df1d
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/XProtocol/XProtocol.hh
Expand Up @@ -92,6 +92,8 @@
#define kXR_anongpf 0x00800000
#define kXR_supgetf 0x00400000
#define kXR_supputf 0x00200000
#define kXR_suppgwr 0x00100000
#define kXR_supcsoc 0x00080000

#define kXR_haveTLS 0x80000000
#define kXR_gotoTLS 0x40000000
Expand Down
2 changes: 1 addition & 1 deletion src/XrdSec/XrdSecEntity.cc
Expand Up @@ -198,7 +198,7 @@ void XrdSecEntity::Reset(bool isnew, const char *spV, const char *dpV)
moninfo = 0;
creds = 0;
credslen = 0;
rsvd = 0;
entityID = 0;
addrInfo = 0;
tident = 0;
sessvar = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/XrdSec/XrdSecEntity.hh
Expand Up @@ -76,7 +76,7 @@ public:
char *moninfo; //!< Information for monitoring
char *creds; //!< Raw entity credentials or cert
int credslen; //!< Length of the 'creds' data
int rsvd; //!< Reserved field
unsigned int entityID; //!< Unique ID of entity instance
XrdNetAddrInfo *addrInfo; //!< Entity's connection details
const char *tident; //!< Trace identifier always preset
void *sessvar; //!< Plugin settable storage pointer,
Expand Down
6 changes: 6 additions & 0 deletions src/XrdXrootd/XrdXrootdProtocol.cc
Expand Up @@ -226,6 +226,7 @@ XrdXrootdProtocol::XrdXrootdProtocol()
: XrdProtocol("xrootd protocol handler"), ProtLink(this),
Entity(0,"xroot")
{
AppName = 0;
Reset();
}

Expand Down Expand Up @@ -873,6 +874,10 @@ void XrdXrootdProtocol::Cleanup()
// Handle writev appendage
//
if (wvInfo) {free(wvInfo); wvInfo = 0;}

// Release aplication name
//
if (AppName) {free(AppName); AppName = 0;}
}

/******************************************************************************/
Expand Down Expand Up @@ -956,4 +961,5 @@ void XrdXrootdProtocol::Reset()
Entity.Reset(0, "xroot");
memset(Stream, 0, sizeof(Stream));
PrepareCount = 0;
if (AppName) {free(AppName); AppName = 0;}
}
1 change: 1 addition & 0 deletions src/XrdXrootd/XrdXrootdProtocol.hh
Expand Up @@ -386,6 +386,7 @@ XrdSecEntity *Client;
XrdSecProtocol *AuthProt;
XrdSecEntity Entity;
XrdSecProtect *Protect;
char *AppName;

ClientRequest sigReq2Ver; // Request to verify
SecurityRequest sigReq; // Signature request
Expand Down
9 changes: 9 additions & 0 deletions src/XrdXrootd/XrdXrootdXeq.cc
Expand Up @@ -1000,6 +1000,7 @@ int XrdXrootdProtocol::do_Login()
(clientPV & XrdOucEI::uIPv4 ? '4' : '6'));
Entity.moninfo = strdup(apBuff);
}
if (appXQ) AppName = strdup(appXQ);
}

// Allocate a monitoring object, if needed for this connection
Expand Down Expand Up @@ -3664,6 +3665,14 @@ bool XrdXrootdProtocol::logLogin(bool xauth)
{eDest.Emsg("Xeq", "Unable to require TLS for", Link->ID);
return false;
}

// Record the appname in the final SecEntity object
//
if (AppName) Client->Add("xrd.appname", (std::string)AppName, true);

// Assign unique identifier to the final SecEntity object
//
Client->entityID = mySID;
return true;
}

Expand Down

0 comments on commit da8df1d

Please sign in to comment.