XRootD
Loading...
Searching...
No Matches
XrdAccConfig Class Reference

#include <XrdAccConfig.hh>

Collaboration diagram for XrdAccConfig:

Public Member Functions

 XrdAccConfig ()
 ~XrdAccConfig ()
int ConfigDB (int Warm, XrdSysError &Eroute)
int Configure (XrdSysError &Eroute, const char *cfn)

Public Attributes

XrdAccAccessAuthorization
int AuthRT
XrdAccGroups GroupMaster

Detailed Description

Definition at line 64 of file XrdAccConfig.hh.

Constructor & Destructor Documentation

◆ XrdAccConfig()

XrdAccConfig::XrdAccConfig ( )

Definition at line 103 of file XrdAccConfig.cc.

104{
105
106// Initialize path value and databse pointer to nil
107//
108 dbpath = strdup("/opt/xrd/etc/Authfile");
109 Database = 0;
110 Authorization = 0;
111 spChar = 0;
112 uriPath = false;
113
114// Establish other defaults
115//
116 ConfigDefaults();
117}
XrdAccAccess * Authorization

References Authorization.

◆ ~XrdAccConfig()

XrdAccConfig::~XrdAccConfig ( )
inline

Definition at line 84 of file XrdAccConfig.hh.

84{} // Configuration is never destroyed!

Member Function Documentation

◆ ConfigDB()

int XrdAccConfig::ConfigDB ( int Warm,
XrdSysError & Eroute )

Definition at line 166 of file XrdAccConfig.cc.

167{
168/*
169 Function: Establish default values using a configuration file.
170
171 Input: None.
172
173 Output: 0 upon success or !0 otherwise.
174*/
175 char buff[128];
176 int retc, anum = 0, NoGo = 0;
177 struct XrdAccAccess_Tables tabs;
178 XrdOucLock cdb_Lock(&Config_Context);
179
180// Indicate type of start we are doing
181//
182 if (!Database) NoGo = !(Database = XrdAccAuthDBObject(&Eroute));
183 else if (Warm && !Database->Changed(dbpath)) return 0;
184
185// Try to open the authorization database
186//
187 if (!Database || !Database->Open(Eroute, dbpath)) return 1;
188
189// Allocate new hash tables
190//
191 if (!(tabs.G_Hash = new XrdOucHash<XrdAccCapability>()) ||
192 !(tabs.H_Hash = new XrdOucHash<XrdAccCapability>()) ||
193 !(tabs.N_Hash = new XrdOucHash<XrdAccCapability>()) ||
194 !(tabs.O_Hash = new XrdOucHash<XrdAccCapability>()) ||
195 !(tabs.R_Hash = new XrdOucHash<XrdAccCapability>()) ||
196 !(tabs.T_Hash = new XrdOucHash<XrdAccCapability>()) ||
197 !(tabs.U_Hash = new XrdOucHash<XrdAccCapability>()) )
198 {Eroute.Emsg("ConfigDB","Insufficient storage for id tables.");
199 Database->Close(); return 1;
200 }
201
202// Now start processing records until eof.
203//
204 rulenum = 0;
205 while((retc = ConfigDBrec(Eroute, tabs))) {NoGo |= retc < 0; anum++;}
206 snprintf(buff, sizeof(buff), "%d auth entries processed in ", anum);
207 Eroute.Say("Config ", buff, dbpath);
208
209// All done, close the database and return if we failed
210//
211 if (!Database->Close() || NoGo) return 1;
212
213// Do final setup for special identifiers (this will correctly order them)
214//
215 if (tabs.SYList) idChk(Eroute, tabs.SYList, tabs);
216
217// Set the access control tables
218//
219 if (!tabs.G_Hash->Num()) {delete tabs.G_Hash; tabs.G_Hash=0;}
220 if (!tabs.H_Hash->Num()) {delete tabs.H_Hash; tabs.H_Hash=0;}
221 if (!tabs.N_Hash->Num()) {delete tabs.N_Hash; tabs.N_Hash=0;}
222 if (!tabs.O_Hash->Num()) {delete tabs.O_Hash; tabs.O_Hash=0;}
223 if (!tabs.R_Hash->Num()) {delete tabs.R_Hash; tabs.R_Hash=0;}
224 if (!tabs.T_Hash->Num()) {delete tabs.T_Hash; tabs.T_Hash=0;}
225 if (!tabs.U_Hash->Num()) {delete tabs.U_Hash; tabs.U_Hash=0;}
226 Authorization->SwapTabs(tabs);
227
228// All done
229//
230 return NoGo;
231}
XrdAccAuthDB * XrdAccAuthDBObject(XrdSysError *erp)
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
void Say(const char *text1, const char *text2=0, const char *txt3=0, const char *text4=0, const char *text5=0, const char *txt6=0)

References Authorization, XrdSysError::Emsg(), XrdAccAccess_Tables::G_Hash, XrdAccAccess_Tables::H_Hash, XrdAccAccess_Tables::N_Hash, XrdOucHash< T >::Num(), XrdAccAccess_Tables::O_Hash, XrdAccAccess_Tables::R_Hash, XrdSysError::Say(), XrdAccAccess_Tables::SYList, XrdAccAccess_Tables::T_Hash, XrdAccAccess_Tables::U_Hash, and XrdAccAuthDBObject().

Referenced by Configure().

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

◆ Configure()

int XrdAccConfig::Configure ( XrdSysError & Eroute,
const char * cfn )

Definition at line 123 of file XrdAccConfig.cc.

123 {
124/*
125 Function: Establish default values using a configuration file.
126
127 Input: None.
128
129 Output: 0 upon success or !0 otherwise.
130*/
131 char *var;
132 int retc, NoGo = 0, Cold = (Database == 0);
133 pthread_t reftid;
134
135// Print warm-up message
136//
137 Eroute.Say("++++++ Authorization system initialization started.");
138
139// Process the configuration file and authorization database
140//
141 if (!(Authorization = new XrdAccAccess(&Eroute))
142 || (NoGo = ConfigFile(Eroute, cfn))
143 || (NoGo = ConfigDB(0, Eroute)))
144 {if (Authorization) {delete Authorization, Authorization = 0;}
145 NoGo = 1;
146 }
147
148// Start a refresh thread unless this was a refresh thread call
149//
150 if (Cold && !NoGo)
151 {if ((retc=XrdSysThread::Run(&reftid,XrdAccConfig_Refresh,(void *)&Eroute)))
152 Eroute.Emsg("ConfigDB",retc,"start refresh thread.");
153 }
154
155// All done
156//
157 var = (NoGo > 0 ? (char *)"failed." : (char *)"completed.");
158 Eroute.Say("------ Authorization system initialization ", var);
159 return (NoGo > 0);
160}
void * XrdAccConfig_Refresh(void *start_data)
int ConfigDB(int Warm, XrdSysError &Eroute)
static int Run(pthread_t *, void *(*proc)(void *), void *arg, int opts=0, const char *desc=0)

References Authorization, ConfigDB(), XrdSysThread::Run(), XrdSysError::Say(), and XrdAccConfig_Refresh().

Here is the call graph for this function:

Member Data Documentation

◆ Authorization

XrdAccAccess* XrdAccConfig::Authorization

Definition at line 78 of file XrdAccConfig.hh.

Referenced by XrdAccConfig(), ConfigDB(), and Configure().

◆ AuthRT

int XrdAccConfig::AuthRT

Definition at line 81 of file XrdAccConfig.hh.

◆ GroupMaster

XrdAccGroups XrdAccConfig::GroupMaster

Definition at line 79 of file XrdAccConfig.hh.


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