00001 #ifndef __NETSECURITY__ 00002 #define __NETSECURITY__ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d N e t S e c u r i t y . h h */ 00006 /* */ 00007 /* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */ 00008 /* All Rights Reserved. See XrdInfo.cc for complete License Terms */ 00009 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 00010 /* DE-AC03-76-SFO0515 with the Department of Energy */ 00011 /******************************************************************************/ 00012 00013 // $Id: XrdNetSecurity.hh 22437 2008-03-04 14:35:16Z rdm $ 00014 00015 #include <ctype.h> 00016 #include <stdlib.h> 00017 00018 #include "XrdOuc/XrdOucHash.hh" 00019 #include "XrdOuc/XrdOucNList.hh" 00020 #include "XrdSys/XrdSysPthread.hh" 00021 00022 class XrdNetTextList; 00023 class XrdOucTrace; 00024 struct sockaddr; 00025 00026 class XrdNetSecurity 00027 { 00028 public: 00029 00030 void AddHost(char *hname); 00031 00032 void AddNetGroup(char *hname); 00033 00034 char *Authorize(struct sockaddr *addr); 00035 00036 void Merge(XrdNetSecurity *srcp); // Deletes srcp 00037 00038 void Trace(XrdOucTrace *et=0) {eTrace = et;} 00039 00040 XrdNetSecurity() {NetGroups = 0; eTrace = 0; lifetime = 8*60*60;} 00041 ~XrdNetSecurity() {} 00042 00043 private: 00044 00045 char *hostOK(char *hname, const char *ipname, const char *why); 00046 00047 XrdOucNList_Anchor HostList; 00048 00049 XrdNetTextList *NetGroups; 00050 00051 XrdOucHash<char> OKHosts; 00052 XrdSysMutex okHMutex; 00053 XrdOucTrace *eTrace; 00054 00055 int lifetime; 00056 static const char *TraceID; 00057 }; 00058 #endif