xrootd
Public Member Functions | List of all members
XrdSecService Class Referenceabstract

#include <XrdSecInterface.hh>

Public Member Functions

virtual const char * getParms (int &size, const char *hname=0)=0
 
virtual XrdSecProtocolgetProtocol (const char *host, const struct sockaddr &hadr, const XrdSecCredentials *cred, XrdOucErrInfo *einfo)=0
 
 XrdSecService ()
 Constructor. More...
 
virtual ~XrdSecService ()
 Destructor. More...
 

Detailed Description

Each specific protocol resides in a shared library named "libXrdSec<p>.so" where

is the protocol identifier (e.g., krb5, gsi, etc). The library contains a class derived from the XrdSecProtocol object. The library must also contain a three extern "C" functions: 1) XrdSecProtocol

Init() Called for one-time protocol ininitialization. 2) XrdSecProtocol

Object() Called for protocol object instantiation. 3) XrdSecProtocol

ObjectVersion Inspected for the protocol object xrootd version number used in compilation. This optional but highly recommended (see later comments).Perform one-time initialization when the shared library containing the the protocol is loaded.

Parameters
whocontains 'c' when called on the client side and 's' when called on the server side.
parmswhen who == 'c' (client) the pointer is null. when who == 's' (server) argument points to any parameters specified in the config file with the seclib directive. If no parameters were specified, the pointer may be null.
einfoThe error information object where error messages should be placed. Should einfo be null, messages should be written to stderr.
Returns
Success: The initial security token to be sent to the client during the login phase (i.e. authentication handshake). If no token need to be sent, a pointer to null string should be returned. Failure: A null pointer with einfo, if supplied, holding the reason for the failure.

Notes: 1) Function is called ince in single-thread mode and need not be thread-safe.

extern "C" char *XrdSecProtocol

Init (const char who, const char *parms, XrdOucErrInfo *einfo) {. . . .}Obtain an instance of a protocol object.

Parameters
whocontains 'c' when called on the client side and 's' when called on the server side.
hostnameclient's hostname which may be an ip address.
netaddrclient's host address.
parmswhen who == 'c' (client) points to the parms sent by the server upon the initial handshake (see Init() above). when who == 's' (server) is null.
einfoThe error information object where error messages should be placed. Should einfo be null, messages should be written to stderr.
Returns
Success: A pointer to the protocol object. Failure: A null pointer with einfo, if supplied, holding the reason for the failure.

Notes 1) Warning! The protocol must allow both 'c' and 's' calls within the same execution context. This occurs when a server acts like a client. 2) This function must be thread-safe. 3) Additionally, you should declare the xrootd version you used to compile your plug-in. While not currently required, it is highly recommended to avoid execution issues should the class definition change. Declare it using XrdVERSIONINFO where <name> is the 1- to 15-character unquoted name of your plugin.

#include "XrdVersion.hh" XrdVERSIONINFO(XrdSecProtocol<p>Object,<name>);

extern "C" XrdSecProtocol *XrdSecProtocol

Object (const char who, const char *hostname, const struct sockaddr &netaddr, const char *parms, XrdOucErrInfo *einfo ) {. . .}The following extern "C" functions provide protocol object management. That is, coordinating the use of the right authentication protocol between the client and server. The default implementation may be replaced via a plugin. Create a client security context and get a supported XrdSecProtocol object for one of the protocols suggested by the server and possibly based on the server's hostname or host address, as needed.

Parameters
hostThe server's host name which may be an IP address.
hadrThe server host address encoded in sockaddr.
credThe security token supplied by the server. The pointer may be null if the server did not supply a security token.
einfoThe structure to record any error messages. These are normally sent to the client. If einfo is a null pointer, the messages should be sent to standard error.
Returns
Success: Address of protocol object to be used for authentication. If cred was null, a host protocol object should be returned if so allowed. The object's delete method should be called to release the storage. Failure: Null, no protocol can be returned. The einfo parameter, if supplied, has the reason.

Notes: 1) There should be one protocol object per physical TCP/IP connections. 2) When the connection is closed, the protocol's Delete() method should be called to properly delete the object. 3) The method and the returned object should be MT-safe. 4) When replacing the default implementation with a plug-in the extern "C" function below must exist in your shared library. 5) Additionally, you should declare the xrootd version you used to compile your plug-in. While not currently required, it is highly recommended to avoid execution issues should the class definition change. Declare it using XrdVERSIONINFO where <name> is the 1- to 15-character unquoted name of your plugin.

#include "XrdVersion.hh" XrdVERSIONINFO(XrdSecGetProtocol,<name>);

extern "C" XrdSecProtocol *XrdSecGetProtocol(const char *hostname, const struct sockaddr &netaddr, XrdSecParameters &parms, XrdOucErrInfo *einfo=0) {....}

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.

Constructor & Destructor Documentation

XrdSecService::XrdSecService ( )
inline

Constructor.

virtual XrdSecService::~XrdSecService ( )
inlinevirtual

Destructor.

Member Function Documentation

virtual const char* XrdSecService::getParms ( int &  size,
const char *  hname = 0 
)
pure virtual

Obtain security parameters to be sent to the client upon initial contact.

Parameters
sizeWhere the length of the return parameters are to be placed.
hnameThe client's host name which may be an IP address. It may also be a null pointer if the client's host is immaterial.
Returns
EITHER The address of the parameter string (which may be host-specific if hname was supplied). The length of the string must be returned in size parameter. OR A null pointer if authentication need not occur for the client. The size parameter should be set to zero as well.
virtual XrdSecProtocol* XrdSecService::getProtocol ( const char *  host,
const struct sockaddr &  hadr,
const XrdSecCredentials cred,
XrdOucErrInfo einfo 
)
pure virtual

Obtain a protocol object suitable for authentication based on cred and possibly based on the hostname or host address, as needed.

Parameters
hostThe client's host name which may be an IP address.
hadrThe client host address encoded in sockaddr.
credThe initial credentials supplied by the client, the pointer may be null if the client did not supply credentials.
einfoThe structure to record any error messages. These are normally sent to the client. If einfo is a null pointer, the messages should be sent to standard error via an XrdSysError object using the supplied XrdSysLogger when the the plugin was initialized.
Returns
Success: Address of protocol object to be used for authentication. If cred was null, a host protocol object shouldpo be returned if so allowed. Failure: Null, no protocol can be returned. The einfo parameter, if supplied, has the reason.

The documentation for this class was generated from the following file: