Loading...
Searching...
No Matches
XrdSecPManager Class Reference

`#include <XrdSecPManager.hh>`

Collaboration diagram for XrdSecPManager:

## Public Member Functions

| XrdSecPManager (int dbg=0, bool secproxy=false, bool fwdcreds=false)
| ~XrdSecPManager ()
XrdSecPMask_t | Find (const char *pid, char **parg=0)
XrdSecProtocol * | Get (const char *hname, XrdNetAddrInfo &endPoint, const char *pname, XrdOucErrInfo *erp)
XrdSecProtocol * | Get (const char *hname, XrdNetAddrInfo &netaddr, XrdSecParameters &secparm)
XrdSecProtocol * | Get (const char *hname, XrdNetAddrInfo &netaddr, XrdSecParameters &secparm, XrdOucErrInfo *erp)
int | Load (XrdOucErrInfo *eMsg, const char pmode, const char *pid, const char *parg, const char *path)
const char * | protTLS ()
void | setDebug (int dbg)
void | setErrP (XrdSysError *eP)

## Detailed Description

Definition at line 47 of file XrdSecPManager.hh.

## Constructor & Destructor Documentation

## XrdSecPManager()

XrdSecPManager::XrdSecPManager | ( | int | dbg = 0,
|  | bool | secproxy = false,
|  | bool | fwdcreds = false )

inline

Definition at line 82 of file XrdSecPManager.hh.

: protnum(1), First(0), Last(0), errP(0),
tlsProt(0), DebugON(dbg), isProxy(secproxy),
fwdCreds(fwdcreds) {}
DebugON
int DebugON
Definition XrdCryptosslFactory.hh:43

## ~XrdSecPManager()

XrdSecPManager::~XrdSecPManager | ( |  | ) |

inline

Definition at line 87 of file XrdSecPManager.hh.

{}

## Member Function Documentation

## Find()

XrdSecPMask_t XrdSecPManager::Find | ( | const char * | pid,
|  | char ** | parg = 0 )

Definition at line 110 of file XrdSecPManager.cc.

{
XrdSecProtList *plp;
if ((plp = Lookup(pid)))
{if (parg) *parg = plp->protargs;
return plp->protnum;
}
return 0;
}
XrdSecProtList::protnum
XrdSecPMask_t protnum
Definition XrdSecPManager.cc:67
XrdSecProtList::protargs
char * protargs
Definition XrdSecPManager.cc:70

References XrdSecProtList::protargs, and XrdSecProtList::protnum.

## Get() [1/3]

XrdSecProtocol * XrdSecPManager::Get | ( | const char * | hname,
|  | XrdNetAddrInfo & | endPoint,
|  | const char * | pname,
|  | XrdOucErrInfo * | erp )

Definition at line 125 of file XrdSecPManager.cc.

{
XrdSecProtList *pl;
const char *msgv[2];
// Find the protocol and get an instance of the protocol object
//
if ((pl = Lookup(pname)))
{DEBUG("Using " <<pname <<" protocol, args='"
<<(pl->protargs ? pl->protargs : "") <<"'");
return pl->ep('s', hname, endPoint, 0, erp);
}
// Protocol is not supported
//
msgv[0] = pname;
msgv[1] = " security protocol is not supported.";
erp->setErrInfo(EPROTONOSUPPORT, msgv, 2);
return 0;
}
DEBUG
#define DEBUG(x)
Definition XrdBwmTrace.hh:54
XrdOucErrInfo::setErrInfo
int setErrInfo(int code, const char *emsg)
Definition XrdOucErrInfo.hh:147
XrdSecProtList::ep
XrdSecProtocol *(* ep)(PROTPARMS)
Definition XrdSecPManager.cc:71

References DEBUG, XrdSecProtList::ep, XrdSecProtList::protargs, and XrdOucErrInfo::setErrInfo().

Referenced by Get(), and XrdSecGetProtocol().

Here is the call graph for this function:
Here is the caller graph for this function:

## Get() [2/3]

XrdSecProtocol * XrdSecPManager::Get | ( | const char * | hname,
|  | XrdNetAddrInfo & | netaddr,
|  | XrdSecParameters & | secparm )

inline

Definition at line 59 of file XrdSecPManager.hh.

{return Get(hname, netaddr, secparm, (XrdOucErrInfo *)0);}
XrdSecPManager::Get
XrdSecProtocol * Get(const char *hname, XrdNetAddrInfo &endPoint, const char *pname, XrdOucErrInfo *erp)
Definition XrdSecPManager.cc:125

References Get().

Here is the call graph for this function:

## Get() [3/3]

XrdSecProtocol * XrdSecPManager::Get | ( | const char * | hname,
|  | XrdNetAddrInfo & | netaddr,
|  | XrdSecParameters & | secparm,
|  | XrdOucErrInfo * | erp )

Definition at line 149 of file XrdSecPManager.cc.

{
char secbuff[4096], *nscan, *pname, *pargs, *bp = secbuff;
char pcomp[XrdSecPROTOIDSIZE+4], *compProt;
XrdSecProtList *pl;
XrdSecProtocol *pp;
XrdOucErrInfo ei;
XrdOucErrInfo *erp;
char *wp;
int i;
// We support passing the list of protocols via Url parameter unless this is
// a proxy server as the url should be merely passed hrough. If the proxy is
// not forwarding creds, then we use our error object to prevent security
// yet from using anything but the proxy's credentials.
// to become more clever
//
if (isProxy)
{wp = 0;
if (!fwdCreds) eri = 0;
} else {
XrdOucEnv *envP;
if (!eri || (envP = eri->getEnv()) == 0) wp = 0;
else wp = envP->Get("xrd.wantprot");
}
// Get the appropriate protocol list as well as the right error object
//
const char *wantProt = wp ? (const char *)wp : getenv("XrdSecPROTOCOL");
erp = (eri) ? eri : &ei;
// We only scan the buffer once
//
if (secparm.size <= 0) return (XrdSecProtocol *)0;
// Copy out the wanted protocols and frame them for easy comparison
//
if (wantProt)
{i = strlen(wantProt);
compProt = (char *)malloc(i+3);
*compProt = ',';
strcpy(compProt+1, wantProt);
compProt[i+1] = ','; compProt[i+2] = 0; *pcomp = ',';
} else compProt = 0;
// Copy the string into a local buffer so that we can simplify some comparisons
// and isolate ourselves from server protocol errors.
//
if (secparm.size < (int)sizeof(secbuff)) i = secparm.size;
else i = sizeof(secbuff)-1;
strncpy(secbuff, secparm.buffer, i);
secbuff[i] = '\0';
// Find a protocol marker in the info block and check if acceptable
//
while(*bp)
{if (*bp != '&') {bp++; continue;}
else if (!*(++bp) || *bp != 'P' || !*(++bp) || *bp != '=') continue;
bp++; pname = bp; pargs = 0;
while(*bp && *bp != ',' && *bp != '&') bp++;
if (!*bp) nscan = 0;
else {if (*bp == '&') {*bp = '\0'; pargs = 0; nscan = bp;}
else {*bp = '\0'; pargs = ++bp;
while (*bp && *bp != '&') bp++;
if (*bp) {*bp ='\0'; nscan = bp;}
else nscan = 0;
}
}
if (wantProt)
{strncpy(pcomp+1, pname, XrdSecPROTOIDSIZE);
pcomp[XrdSecPROTOIDSIZE+1] = 0;
strcat(pcomp, ",");
}
if (!wantProt || strstr(compProt, pcomp))
{XrdSysMutexHelper pmHelper(pmMutex);
if ((pl = Lookup(pname)) || (pl = ldPO(erp, 'c', pname)))
{DEBUG("Using " <<pname <<" protocol, args='"
<<(pargs ? pargs : "") <<"'");
if ((pp = pl->ep('c', hname, endPoint, pargs, erp)))
{if (nscan) {i = nscan - secbuff;
secparm.buffer += i; secparm.size -= i;
} else secparm.size = -1;
if (compProt) free(compProt);
return pp;
}
}
if (erp->getErrInfo() != ENOENT) std::cerr <<erp->getErrText() <<std::endl;
} else {DEBUG("Skipping " <<pname <<" only want " <<wantProt);}
if (!nscan) break;
*nscan = '&'; bp = nscan;
}
secparm.size = -1;
if (compProt) free(compProt);
return (XrdSecProtocol *)0;
}
XrdSecPROTOIDSIZE
#define XrdSecPROTOIDSIZE
Definition XrdSecEntity.hh:47
if
if(ec< 0) ec
XrdOucEnv::Get
char * Get(const char *varname)
Definition XrdOucEnv.hh:69
XrdOucErrInfo::getErrText
const char * getErrText()
Definition XrdOucErrInfo.hh:262
XrdOucErrInfo::getErrInfo
int getErrInfo()
Definition XrdOucErrInfo.hh:243
XrdProxy::envP
XrdOucEnv * envP
Definition XrdPss.cc:109
XrdSecBuffer::buffer
char * buffer
Pointer to the buffer.
Definition XrdSecInterface.hh:53
XrdSecBuffer::size
int size
Size of the buffer or length of data in the buffer.
Definition XrdSecInterface.hh:52

References XrdSecBuffer::buffer, DEBUG, XrdSecProtList::ep, XrdOucEnv::Get(), XrdOucErrInfo::getEnv(), XrdOucErrInfo::getErrInfo(), XrdOucErrInfo::getErrText(), XrdSecBuffer::size, and XrdSecPROTOIDSIZE.

Here is the call graph for this function:

## Load()

int XrdSecPManager::Load | ( | XrdOucErrInfo * | eMsg,
|  | const char | pmode,
|  | const char * | pid,
|  | const char * | parg,
|  | const char * | path )

inline

Definition at line 69 of file XrdSecPManager.hh.

{return (0 != ldPO(eMsg, pmode, pid, parg, path));}
eMsg
#define eMsg(x)
Definition XrdSecsssAdmin.cc:53

References eMsg.

## protTLS()

const char * XrdSecPManager::protTLS | ( |  | ) |

inline

Definition at line 80 of file XrdSecPManager.hh.

{return tlsProt;}

## setDebug()

void XrdSecPManager::setDebug | ( | int | dbg | ) |

inline

Definition at line 76 of file XrdSecPManager.hh.

{DebugON = dbg;}

## setErrP()

void XrdSecPManager::setErrP | ( | XrdSysError * | eP | ) |

inline

Definition at line 78 of file XrdSecPManager.hh.

{errP = eP;}

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

- XrdSecPManager.hh
- XrdSecPManager.cc