#include <XrdOfsTPCAuth.hh>
Definition at line 39 of file XrdOfsTPCAuth.hh.
◆ XrdOfsTPCAuth()
XrdOfsTPCAuth::XrdOfsTPCAuth |
( |
int | vTTL | ) |
|
|
inline |
◆ ~XrdOfsTPCAuth()
XrdOfsTPCAuth::~XrdOfsTPCAuth |
( |
| ) |
|
|
inline |
◆ Add()
Definition at line 77 of file XrdOfsTPCAuth.cc.
78{
81 char Buff[512];
82
83
84
85 if (!
genOrg(Args.
Usr, Buff,
sizeof(Buff)))
return Fatal(Args, Buff, EINVAL);
87
88
89
90
91
92 authMutex.Lock();
93 if ((aP = Find(Args)))
94 {if (aP->Info.cbP)
95 {aP->expT = expT;
96 aP->Next = authQ; authQ = aP;
97 aP->Info.Reply(
SFS_OK, 0,
"", &authMutex);
98 return 1;
99 } else {
100 authMutex.UnLock();
101 return Fatal(Args,
"duplicate athorization", EPROTO);
102 }
103 }
104
105
106
108 {
109 authMutex.UnLock();
111 }
112
113
114
115 Next = authQ; authQ =
this;
inQ = 1;
116
117
118
119 authMutex.UnLock();
120 return 1;
121}
static int Fatal(Facts &Args, const char *eMsg, int eCode, int nomsg=0)
static int genOrg(const XrdSecEntity *client, char *Buff, int Blen)
References XrdOfsTPCAuth(), XrdOfsTPC::Facts::Dst, eMsg, XrdOfsTPC::Fatal(), XrdOfsTPC::genOrg(), XrdOfsTPC::Info, XrdOfsTPC::inQ, XrdOfsTPC::Facts::Key, XrdOfsTPC::Facts::Lfn, XrdOfsTPC::Facts::Org, SFS_OK, and XrdOfsTPC::Facts::Usr.
Referenced by XrdOfsTPC::Authorize().
◆ Del()
void XrdOfsTPCAuth::Del |
( |
| ) |
|
|
virtual |
◆ Expired() [1/2]
int XrdOfsTPCAuth::Expired |
( |
| ) |
|
|
inline |
◆ Expired() [2/2]
int XrdOfsTPCAuth::Expired |
( |
const char * | Dst, |
|
|
int | cnt = 1 ) |
Definition at line 154 of file XrdOfsTPCAuth.cc.
155{
156 char Buff[1024];
157
158
159
161
162
163
164 snprintf(Buff,
sizeof(Buff),
"tpc grant by %s expired for",
Info.Org);
165 Buff[sizeof(Buff)-1] = 0;
167
168
169
171 return 0;
172}
struct XrdOfsStats::StatsData Data
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
References XrdOfsTPC::Info, OfsEroute, OfsStats, and SFS_ERROR.
◆ Get()
Definition at line 204 of file XrdOfsTPCAuth.cc.
205{
206 XrdSysMutexHelper authMon(&authMutex);
209
210
211
212
213
214 if ((aP = Find(Args)))
215 {if (aP->Info.cbP)
216 {aP->Info.Reply(
SFS_ERROR, EPROTO,
"duplicate tpc auth request");
217 return Fatal(Args,
"duplicate tpc auth request", EPROTO);
218 } else {
219 aP->Refs++;
220 *theTPC = aP;
222 }
223 }
224
225
226
228 return Fatal(Args,
"insufficient memory", ENOMEM);
229
230
231
233 {delete aP;
235 }
236
237
238
239 if (aP->Info.SetCB(Args.
eRR)) {
delete aP;
return SFS_ERROR;}
240
241
242
243 aP->Next = authQ; authQ = aP;
244
245
246
247 *theTPC = aP;
248 aP->Refs = 0;
249 aP->Info.Engage();
251}
References XrdOfsTPCAuth(), XrdOfsTPCParms::Cfg, XrdOfsTPC::Facts::Dst, eMsg, XrdOfsTPC::Facts::eRR, XrdOfsTPC::Fatal(), XrdOfsTPC::Facts::Key, XrdOfsTPC::Facts::Lfn, XrdOfsTPC::Facts::Org, SFS_ERROR, SFS_OK, and SFS_STARTED.
Referenced by XrdOfsTPC::Authorize().
◆ RunTTL()
int XrdOfsTPCAuth::RunTTL |
( |
int | Init | ) |
|
|
static |
Definition at line 257 of file XrdOfsTPCAuth.cc.
258{
260 time_t eNow;
261 int eWait, eDiff, numExp;
262
263
264
266 {pthread_t tid;
267 int rc;
270 return (rc ? 0 : 1);
271 }
272
273
274
275do{authMutex.Lock();
276 cP = authQ; pP = 0;
277 eNow = time(0); eWait =
Cfg.
maxTTL; numExp = 0;
278 while(cP)
279 {if (eNow < cP->expT)
280 {eDiff = cP->expT - eNow;
281 if (eDiff < eWait) eWait = eDiff;
282 pP = cP; cP = cP->Next;
283 }
284 else {if (pP) pP->Next = cP->Next;
285 else authQ = cP->Next;
286 cP->
Expired(
"localhost", 0); numExp++;
287 nP = cP->Next;
288 if (cP->Refs < 1) delete cP;
289 cP = nP;
290 }
291 }
292 authMutex.UnLock();
293
294
295
296 if (numExp)
300 }
301
302
303
305 } while(1);
306}
void * XrdOfsTPCAuthttl(void *pp)
static int Run(pthread_t *, void *(*proc)(void *), void *arg, int opts=0, const char *desc=0)
static void Snooze(int seconds)
References XrdOfsTPCAuth(), XrdOfsTPCParms::Cfg, Expired(), XrdOfsTPC::Init(), OfsEroute, OfsStats, XrdSysThread::Run(), XrdSysTimer::Snooze(), and XrdOfsTPCAuthttl().
Referenced by XrdOfsTPC::Start(), and XrdOfsTPCAuthttl().
The documentation for this class was generated from the following files: