Loading...
Searching...
No Matches
XrdAccCapability Class Reference

`#include <XrdAccCapability.hh>`

Collaboration diagram for XrdAccCapability:

## Public Member Functions

| XrdAccCapability (char *pathval, XrdAccPrivCaps &privval)
| XrdAccCapability (XrdAccCapability *taddr)
| ~XrdAccCapability ()
void | Add (XrdAccCapability *newcap)
XrdAccCapability * | Next ()
int | Privs (XrdAccPrivCaps &pathpriv, const char *pathname, const char *pathsub=0)
int | Privs (XrdAccPrivCaps &pathpriv, const char *pathname, const int pathlen, const char *pathsub=0)
int | Privs (XrdAccPrivCaps &pathpriv, const char *pathname, const int pathlen, const unsigned long pathhash, const char *pathsub=0)
int | Subcomp (const char *pathname, const int pathlen, const char *pathsub, const int sublen)

## Detailed Description

Definition at line 43 of file XrdAccCapability.hh.

## Constructor & Destructor Documentation

## XrdAccCapability() [1/2]

XrdAccCapability::XrdAccCapability | ( | char * | pathval,
|  | XrdAccPrivCaps & | privval )

Definition at line 43 of file XrdAccCapability.cc.

{
int i;
// Do common initialization
//
next = 0; ctmp = 0;
priv.pprivs = privval.pprivs; priv.nprivs = privval.nprivs;
plen = strlen(pathval); pins = 0; prem = 0;
pkey = XrdOucHashVal2((const char *)pathval, plen);
path = strdup(pathval);
// Now set up for @= insertions. We do this eventhough it might never be used
//
for (i = 0; i < plen; i++)
if (path[i] == '@' && path[i+1] == '=')
{pins = i; prem = plen - i - 2; break;}
}
XrdOucHashVal2
unsigned long XrdOucHashVal2(const char *KeyVal, int KeyLen)
Definition XrdOucHashVal.cc:40
XrdAccPrivCaps::nprivs
XrdAccPrivs nprivs
Definition XrdAccPrivs.hh:78
XrdAccPrivCaps::pprivs
XrdAccPrivs pprivs
Definition XrdAccPrivs.hh:77

References XrdAccPrivCaps::nprivs, XrdAccPrivCaps::pprivs, and XrdOucHashVal2().

Referenced by XrdAccCapability(), ~XrdAccCapability(), Add(), Next(), and Privs().

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

## XrdAccCapability() [2/2]

XrdAccCapability::XrdAccCapability | ( | XrdAccCapability * | taddr | ) |

inline

Definition at line 81 of file XrdAccCapability.hh.

{next = 0; ctmp = taddr;
pkey = 0; path = 0; plen = 0; pins = 0; prem = 0;
}

References XrdAccCapability().

Here is the call graph for this function:

## ~XrdAccCapability()

XrdAccCapability::~XrdAccCapability | ( |  | ) |

Definition at line 69 of file XrdAccCapability.cc.

{
XrdAccCapability *cp, *np = next;
if (path) {free(path); path = 0;}
while(np) {cp = np; np = np->next; cp->next = 0; delete cp;}
next = 0;
}
XrdAccCapability::XrdAccCapability
XrdAccCapability(char *pathval, XrdAccPrivCaps &privval)
Definition XrdAccCapability.cc:43

References XrdAccCapability().

Here is the call graph for this function:

## Member Function Documentation

## Add()

void XrdAccCapability::Add | ( | XrdAccCapability * | newcap | ) |

inline

Definition at line 46 of file XrdAccCapability.hh.

{next = newcap;}

References XrdAccCapability().

Here is the call graph for this function:

## Next()

XrdAccCapability * XrdAccCapability::Next | ( |  | ) |

inline

Definition at line 48 of file XrdAccCapability.hh.

{return next;}

References XrdAccCapability().

Here is the call graph for this function:

## Privs() [1/3]

int XrdAccCapability::Privs | ( | XrdAccPrivCaps & | pathpriv,
|  | const char * | pathname,
|  | const char * | pathsub = 0 )

inline

Definition at line 68 of file XrdAccCapability.hh.

{extern unsigned long XrdOucHashVal2(const char *,int);
int pathlen = strlen(pathname);
return Privs(pathpriv, pathname, pathlen,
XrdOucHashVal2(pathname, pathlen), pathsub);}
XrdAccCapability::Privs
int Privs(XrdAccPrivCaps &pathpriv, const char *pathname, const int pathlen, const unsigned long pathhash, const char *pathsub=0)
Definition XrdAccCapability.cc:82

References Privs(), and XrdOucHashVal2().

Here is the call graph for this function:

## Privs() [2/3]

int XrdAccCapability::Privs | ( | XrdAccPrivCaps & | pathpriv,
|  | const char * | pathname,
|  | const int | pathlen,
|  | const char * | pathsub = 0 )

inline

Definition at line 60 of file XrdAccCapability.hh.

{extern unsigned long XrdOucHashVal2(const char *,int);
return Privs(pathpriv, pathname, pathlen,
XrdOucHashVal2(pathname,(int)pathlen),pathsub);}

References Privs(), and XrdOucHashVal2().

Here is the call graph for this function:

## Privs() [3/3]

int XrdAccCapability::Privs | ( | XrdAccPrivCaps & | pathpriv,
|  | const char * | pathname,
|  | const int | pathlen,
|  | const unsigned long | pathhash,
|  | const char * | pathsub = 0 )

Definition at line 82 of file XrdAccCapability.cc.

{XrdAccCapability *cp=this;
const int psl = (pathsub ? strlen(pathsub) : 0);
do {if (cp->ctmp)
{if (cp->ctmp->Privs(pathpriv,pathname,pathlen,pathhash,pathsub))
return 1;
}
else if (pathlen >= cp->plen)
if ((!pathsub && !strncmp(pathname, cp->path, cp->plen))
|| (pathsub && cp->Subcomp(pathname,pathlen,pathsub,psl)))
{pathpriv.pprivs = (XrdAccPrivs)(pathpriv.pprivs |
cp->priv.pprivs);
pathpriv.nprivs = (XrdAccPrivs)(pathpriv.nprivs |
cp->priv.nprivs);
return 1;
}
} while ((cp = cp->next));
return 0;
}
XrdAccPrivs
XrdAccPrivs
Definition XrdAccPrivs.hh:39
XrdAccCapability::Subcomp
int Subcomp(const char *pathname, const int pathlen, const char *pathsub, const int sublen)
Definition XrdAccCapability.cc:111

References XrdAccCapability(), XrdAccPrivCaps::nprivs, XrdAccPrivCaps::pprivs, Privs(), and Subcomp().

Referenced by XrdAccAccess::Access(), Privs(), Privs(), and Privs().

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

## Subcomp()

int XrdAccCapability::Subcomp | ( | const char * | pathname,
|  | const int | pathlen,
|  | const char * | pathsub,
|  | const int | sublen )

Definition at line 111 of file XrdAccCapability.cc.

{ int ncmp;
// First check if the prefix matches
//
if (strncmp(pathname, path, pins)) return 0;
// Now, check if the substitution appears in the source path
//
if (strncmp(&pathname[pins], pathsub, sublen)) return 0;
// Now check if we can match the tail
//
ncmp = pins + sublen;
if ((pathlen - ncmp) < prem) return 0;
// Return the results of matching the tail (prem should never be 0, but hey)
//
if (prem) return !strncmp(&path[pins+2], &pathname[ncmp], prem);
return 1;
}

Referenced by Privs().

Here is the caller graph for this function:

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

- XrdAccCapability.hh
- XrdAccCapability.cc