Loading...
Searching...
No Matches
XrdNetSecurity Class Reference

`#include <XrdNetSecurity.hh>`

Collaboration diagram for XrdNetSecurity:

## Public Member Functions

| XrdNetSecurity ()
| ~XrdNetSecurity ()
void | AddHost (char *hname)
void | AddNetGroup (char *hname)
bool | Authorize (const char *hSpec)
bool | Authorize (XrdNetAddr &addr)
void | Merge (XrdNetSecurity *srcp)
void | Trace (XrdSysTrace *et=0)

## Detailed Description

Definition at line 43 of file XrdNetSecurity.hh.

## Constructor & Destructor Documentation

## XrdNetSecurity()

XrdNetSecurity::XrdNetSecurity | ( |  | ) |

inline

Definition at line 59 of file XrdNetSecurity.hh.

: NetGroups(0), eTrace(0),
chkNetLst(false), chkNetGrp(false) {}

Referenced by Merge().

Here is the caller graph for this function:

## ~XrdNetSecurity()

XrdNetSecurity::~XrdNetSecurity | ( |  | ) |

inline

Definition at line 61 of file XrdNetSecurity.hh.

{}

## Member Function Documentation

## AddHost()

void XrdNetSecurity::AddHost | ( | char * | hname | ) |

Definition at line 90 of file XrdNetSecurity.cc.

{
// If this has no asterisks, then we can add it as is. Otherwise, add it to
// the name pattern list.
//
if (!index(hname, '*') && addHIP(hname)) return;
// Add it to the pattern list
//
XrdOucNList *nlp = new XrdOucNList(hname);
HostList.Insert(nlp);
chkNetLst = true;
// Echo this back if debugging
//
DEBUG(hname <<" (" <<hname <<") added to authorized hosts.");
}
DEBUG
#define DEBUG(x)
Definition XrdBwmTrace.hh:54

References DEBUG.

## AddNetGroup()

void XrdNetSecurity::AddNetGroup | ( | char * | hname | ) |

Definition at line 113 of file XrdNetSecurity.cc.

{
XrdNetTextList *tlp = new XrdNetTextList(gname);
// Add netgroup to list of valid ones
//
tlp->next = NetGroups;
NetGroups = tlp;
chkNetGrp = true;
// All done
//
DEBUG(gname <<" added to authorized netgroups.");
}
XrdNetTextList::next
XrdNetTextList * next
Definition XrdNetSecurity.cc:67

References DEBUG, and XrdNetTextList::next.

## Authorize() [1/2]

bool XrdNetSecurity::Authorize | ( | const char * | hSpec | ) |

Definition at line 132 of file XrdNetSecurity.cc.

{
XrdNetAddr theAddr;
// Convert the specification to a host address and validate it
//
if (theAddr.Set(hSpec, -1094)) return false;
// Now authorize what we have
//
return Authorize(theAddr);
}
Authorize
XrdAccAuthorize * Authorize
Definition XrdAccTest.cc:61
XrdNetAddr::Set
const char * Set(const char *hSpec, int pNum=PortInSpec)
Definition XrdNetAddr.cc:216

References Authorize, and XrdNetAddr::Set().

Here is the call graph for this function:

## Authorize() [2/2]

bool XrdNetSecurity::Authorize | ( | XrdNetAddr & | addr | ) |

Definition at line 147 of file XrdNetSecurity.cc.

{
static const int fmtOpts = XrdNetAddr::old6Map4 | XrdNetAddr::noPort;
const char *hName;
char ipAddr[64];
XrdNetTextList *tlp;
// Convert IP address to characters
//
if (!addr.Format(ipAddr, sizeof(ipAddr), XrdNetAddr::fmtAdv6, fmtOpts))
return false;
// Check if we have seen this host before
//
okHMutex.Lock();
if (OKHosts.Find(ipAddr)) {okHMutex.UnLock(); return true;}
// Get the hostname for this IP address
//
if (!chkNetLst && !chkNetGrp) {okHMutex.UnLock(); return false;}
if (!(hName = addr.Name())) hName = ipAddr;
// Check if this host is in the the appropriate netgroup, if any
//
if ((tlp = NetGroups))
do {if (innetgr(tlp->text, hName, 0, 0))
return hostOK(hName, ipAddr, "netgroup");
} while ((tlp = tlp->next));
// Plow through the specific host list to see if the host
//
if (chkNetLst && HostList.Find(hName))
return hostOK(hName, ipAddr, "host");
// Host is not authorized
//
okHMutex.UnLock();
DEBUG(hName <<" not authorized");
return false;
}
XrdNetAddrInfo::noPort
static const int noPort
Do not add port number.
Definition XrdNetAddrInfo.hh:104
XrdNetAddrInfo::old6Map4
static const int old6Map4
Use deprecated IPV6 mapped format.
Definition XrdNetAddrInfo.hh:106
XrdNetAddrInfo::Format
int Format(char *bAddr, int bLen, fmtUse fmtType=fmtAuto, int fmtOpts=0)
Definition XrdNetAddrInfo.cc:81
XrdNetAddrInfo::fmtAdv6
@ fmtAdv6
Definition XrdNetAddrInfo.hh:102
XrdNetAddrInfo::Name
const char * Name(const char *eName=0, const char **eText=0)
Definition XrdNetAddrInfo.cc:309
XrdNetTextList::text
char * text
Definition XrdNetSecurity.cc:68

References DEBUG, XrdNetAddrInfo::fmtAdv6, XrdNetAddrInfo::Format(), XrdNetAddrInfo::Name(), XrdNetTextList::next, XrdNetAddrInfo::noPort, XrdNetAddrInfo::old6Map4, and XrdNetTextList::text.

Here is the call graph for this function:

## Merge()

void XrdNetSecurity::Merge | ( | XrdNetSecurity * | srcp | ) |

Definition at line 192 of file XrdNetSecurity.cc.

{
XrdOucNList *np;
XrdNetTextList *sp, *tp;
// First merge in all of the host entries
//
while((np = srcp->HostList.Pop())) HostList.Replace(np);
// Next merge the netgroup list
//
while((sp = srcp->NetGroups))
{tp = NetGroups; srcp->NetGroups = sp->next;
while(tp) if (!strcmp(tp->text, sp->text)) break;
else tp = tp->next;
if (tp) delete sp;
else {sp->next = NetGroups;
NetGroups = sp;
}
}
// Delete the remnants of the source object
//
delete srcp;
}
XrdOucNList_Anchor::Pop
XrdOucNList * Pop()
Definition XrdOucNList.hh:110

References XrdNetSecurity(), XrdNetTextList::next, XrdOucNList_Anchor::Pop(), and XrdNetTextList::text.

Here is the call graph for this function:

## Trace()

void XrdNetSecurity::Trace | ( | XrdSysTrace * | et = 0 | ) |

inline

Definition at line 57 of file XrdNetSecurity.hh.

{eTrace = et;}

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

- XrdNetSecurity.hh
- XrdNetSecurity.cc