85 if (!genOrg(Args.
Usr, Buff,
sizeof(Buff)))
return Fatal(Args, Buff, EINVAL);
93 if ((aP = Find(Args)))
96 aP->Next = authQ; authQ = aP;
97 aP->Info.Reply(
SFS_OK, 0,
"", &authMutex);
101 return Fatal(Args,
"duplicate athorization", EPROTO);
115 Next = authQ; authQ =
this; inQ = 1;
135 {
if (
this == authQ) authQ = Next;
137 while(pP && pP->Next !=
this) pP = pP->Next;
138 if (pP) pP->Next = Next;
145 if (Refs <= 1)
delete this;
164 snprintf(Buff,
sizeof(Buff),
"tpc grant by %s expired for",
Info.Org);
165 Buff[
sizeof(Buff)-1] = 0;
185 while(cP && !(cP->Info.Match(Args.
Key, Args.
Org, Args.
Lfn, Args.
Dst)))
186 {pP = cP; cP = cP->Next;}
190 if (cP) {
if (pP) pP->Next = cP->Next;
191 else authQ = cP->Next;
214 if ((aP = Find(Args)))
216 {aP->Info.Reply(
SFS_ERROR, EPROTO,
"duplicate tpc auth request");
217 return Fatal(Args,
"duplicate tpc auth request", EPROTO);
228 return Fatal(Args,
"insufficient memory", ENOMEM);
239 if (aP->Info.SetCB(Args.
eRR)) {
delete aP;
return SFS_ERROR;}
243 aP->Next = authQ; authQ = aP;
261 int eWait, eDiff, numExp;
277 eNow = time(0); eWait =
Cfg.
maxTTL; numExp = 0;
279 {
if (eNow < cP->expT)
280 {eDiff = cP->expT - eNow;
281 if (eDiff < eWait) eWait = eDiff;
282 pP = cP; cP = cP->Next;
284 else {
if (pP) pP->Next = cP->Next;
285 else authQ = cP->Next;
286 cP->
Expired(
"localhost", 0); numExp++;
288 if (cP->Refs < 1)
delete cP;
void Fatal(const char *op, const char *target)
void * XrdOfsTPCAuthttl(void *pp)
struct XrdOfsStats::StatsData Data
static int Get(Facts &Args, XrdOfsTPCAuth **theTPC)
static int RunTTL(int Init)
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
static int Run(pthread_t *, void *(*proc)(void *), void *arg, int opts=0, const char *desc=0)
static void Snooze(int seconds)