Example:
#include "XrdVersion.hh"
XrdVERSIONINFO(XrdSecGetProtocol,<name>);
extern "C" XrdSecProtocol *XrdSecGetProtocol
(const char *hostname,
XrdNetAddrInfo &endPoint,
XrdSecParameters §oken,
XrdOucErrInfo *einfo=0)
{....}
The XrdSecGetProtection function returns a protection object to secure an XRootD request stream from injection attacks. An object is returned when the response to kXR_protocol request indicates that the server requires that the client secure the connection. This protection is based on the authentication method used. Therefore, authentication must occur before a protection object can be obtained. Usually, a protection object is requested right after authentication. The function description is
- Parameters
-
rc | Where an error return code is to be placed. |
aprot | Uses the authentication protocol to protect requests. It must be supplied and must be he protocol the client used for authentication. Hence, authentication must occur first. |
presp | The protocol value returned in response to kXR_protocol. The value must be host byte order. |
- Returns
- >0 pointer to the protect object placed in protP.
-
=0 No protection is needed, protP set to zero.
-
<0 An error occured getting the protection object the return value is -errno and protP has been set to zero.
Simply declare the following in the place where this is called:
extern int XrdSecGetProtection(XrdSecProtect *&protP, XrdSecProtocol &aprot, kXR_int32 presp);
The XrdSecService object is the the object that the server uses to obtain parameters to be passed to the client on initial contact and to create the appropriate protocol on the initial receipt of the client's credentials. Server-side processing is a bit more complicated because the set of valid protocols needs to be configured and that configuration needs to be supplied to the client so that both can agree on a compatible protocol. This object is created via a call to XrdSecgetService, defined later on. You may replace the default implementation by defining a plugin via the seclib directive.
Warning: The XrdSecService object as well as any objects returned by it should be MT-safe.