#include <XrdSecTLayer.hh>
|
| XrdSecTLayer (const char *pName, Initiator who1st=isClient) |
|
virtual int | Authenticate (XrdSecCredentials *cred, XrdSecParameters **parms, XrdOucErrInfo *einfo=0) |
|
virtual void | Delete ()=0 |
| Delete the protocol object. DO NOT use C++ delete() on this object. More...
|
|
virtual XrdSecCredentials * | getCredentials (XrdSecParameters *parm=0, XrdOucErrInfo *einfo=0) |
|
virtual void | secClient (int theFD, XrdOucErrInfo *einfo)=0 |
|
virtual void | secServer (int theFD, XrdOucErrInfo *einfo)=0 |
|
void | secXeq () |
|
| XrdSecProtocol (const char *pName) |
| Constructor. More...
|
|
virtual int | Decrypt (const char *inbuff, int inlen, XrdSecBuffer **outbuff) |
|
virtual int | Encrypt (const char *inbuff, int inlen, XrdSecBuffer **outbuff) |
|
virtual int | getKey (char *buff=0, int size=0) |
|
virtual bool | needTLS () |
| Check if this protocol requires TLS to properly function. More...
|
|
virtual int | setKey (char *buff, int size) |
|
virtual int | Sign (const char *inbuff, int inlen, XrdSecBuffer **outbuff) |
|
virtual int | Verify (const char *inbuff, int inlen, const char *sigbuff, int siglen) |
|
Definition at line 64 of file XrdSecTLayer.hh.
◆ Initiator
◆ XrdSecTLayer()
Definition at line 58 of file XrdSecTLayer.cc.
60 secTid(0), mySem(0), Starter(who1st), myFD(-1), urFD(-1),
61 Tmax(275), Tcur(0), eCode(0), eText(0)
66 memset((
void *)&Hdr, 0,
sizeof(Hdr));
67 strncpy(Hdr.protName,pName,
sizeof(Hdr.protName)-1);
XrdSecProtocol(const char *pName)
Constructor.
◆ ~XrdSecTLayer()
virtual XrdSecTLayer::~XrdSecTLayer |
( |
| ) |
|
|
inlineprotectedvirtual |
Definition at line 122 of file XrdSecTLayer.hh.
122 {
if (eText) {free(eText);eText=0;}
123 if (myFD>0) {
close(myFD);myFD=-1;}
References close.
◆ Authenticate()
Authenticate a client.
- Parameters
-
cred | Credentials supplied by the client. |
parms | Place where the address of additional authentication data is to be placed for another autrhentication handshake. |
einfo | The error information object where error messages should be placed. The messages are returned to the client. Should einfo be null, messages should be written to stderr. |
- Returns
- > 0 -> parms present (more authentication needed) = 0 -> Entity present (authentication suceeded) < 0 -> einfo present (error has occurred)
Implements XrdSecProtocol.
Definition at line 145 of file XrdSecTLayer.cc.
156 if (myFD < 0 && !bootUp(
isServer))
return -1;
160 if (cred->
size < hdrSz) {secError(
"Invalid credentials",EBADMSG);
return -1;}
161 Req = ((TLayerRR *)cred->
buffer)->protCode;
162 wrLen= cred->
size - hdrSz;
169 {
case TLayerRR::xfrData:
170 if (wrLen > 0 &&
write(myFD, cred->
buffer+hdrSz, wrLen) < 0)
171 {secError(
"Socket write failed", errno);
return -1;}
172 Blen = Read(myFD, Buff, dataSz);
173 if (Blen < 0 && (Blen != -EPIPE) && (Blen != -ECONNRESET))
174 {secError(
"Socket read failed", -Blen);
return 0;}
176 case TLayerRR::endData:
return (secDone() ? 0 : -1);
177 default: secError(
"Unknown parms request", EINVAL);
return -1;
185 if (Blen < 0) {Blen = 0; Hdr.protCode = TLayerRR::endData;}
186 else if (Blen || wrLen) {Tcur = 0; Hdr.protCode = TLayerRR::xfrData;}
187 else if (++Tcur <= Tmax) Hdr.protCode = TLayerRR::xfrData;
188 else {Tcur = 0; Hdr.protCode = TLayerRR::endData;}
192 bP = (
char *)malloc(hdrSz+Blen);
193 memcpy(bP, (
char *)&Hdr, hdrSz);
194 if (Blen) memcpy(bP+hdrSz, Buff, Blen);
ssize_t write(int fildes, const void *buf, size_t nbyte)
XrdSecBuffer XrdSecParameters
char * buffer
Pointer to the buffer.
int size
Size of the buffer or length of data in the buffer.
References XrdSecBuffer::buffer, isServer, XrdSecBuffer::size, and write().
◆ Delete()
virtual void XrdSecTLayer::Delete |
( |
| ) |
|
|
pure virtual |
Delete the protocol object. DO NOT use C++ delete() on this object.
Implements XrdSecProtocol.
◆ getCredentials()
Generate client credentials to be used in the authentication process.
- Parameters
-
parm | Pointer to the information returned by the server either in the initial login response or the authmore response. |
einfo | The error information object where error messages should be placed. The messages are returned to the client. Should einfo be null, messages should be written to stderr. |
- Returns
- Success: Pointer to credentials to sent to the server. The caller is responsible for deleting the object. Failure: Null pointer with einfo, if supplied, containing the reason for the failure.
Implements XrdSecProtocol.
Definition at line 77 of file XrdSecTLayer.cc.
81 int Blen = 0, wrLen = 0;
82 char *bP, Req = TLayerRR::xfrData;
90 {Hdr.protCode = TLayerRR::xfrData;
91 bP = (
char *)malloc(hdrSz);
92 memcpy(bP, (
char *)&Hdr, hdrSz);
96 if (parm->
size < hdrSz)
97 {secError(
"Invalid parms length", EPROTO);
100 Req = ((TLayerRR *)parm->
buffer)->protCode;
101 wrLen= parm->
size - hdrSz;
109 {
case TLayerRR::xfrData:
110 if (wrLen > 0 &&
write(myFD, parm->
buffer+hdrSz, wrLen) < 0)
111 {secError(
"Socket write failed", errno);
return 0;}
112 Blen = Read(myFD, Buff, dataSz);
113 if (Blen < 0 && (Blen != -EPIPE) && (Blen != -ECONNRESET))
114 {secError(
"Socket read failed", -Blen);
return 0;}
116 case TLayerRR::endData:
117 if (myFD < 0) {secError(
"Protocol violation", EPROTO);
return 0;}
120 default: secError(
"Unknown parms request", EINVAL);
return 0;
127 if (Blen < 0) {
if (!secDone())
return 0;
128 Blen = 0; Hdr.protCode = TLayerRR::endData;}
129 else if (Blen || wrLen) {Tcur = 0; Hdr.protCode = TLayerRR::xfrData;}
130 else if (++Tcur <= Tmax) Hdr.protCode = TLayerRR::xfrData;
131 else {Tcur = 0; Hdr.protCode = TLayerRR::endData;}
135 bP = (
char *)malloc(hdrSz+Blen);
136 memcpy(bP, (
char *)&Hdr, hdrSz);
137 if (Blen) memcpy(bP+hdrSz, Buff, Blen);
XrdSecBuffer XrdSecCredentials
References XrdSecBuffer::buffer, isClient, isServer, XrdSecBuffer::size, and write().
◆ secClient()
virtual void XrdSecTLayer::secClient |
( |
int |
theFD, |
|
|
XrdOucErrInfo * |
einfo |
|
) |
| |
|
pure virtual |
◆ secServer()
virtual void XrdSecTLayer::secServer |
( |
int |
theFD, |
|
|
XrdOucErrInfo * |
einfo |
|
) |
| |
|
pure virtual |
◆ secXeq()
void XrdSecTLayer::secXeq |
( |
| ) |
|
◆ secTid
pthread_t XrdSecTLayer::secTid |
|
protected |
The documentation for this class was generated from the following files: