#include <XrdAccAuthFile.hh>
Definition at line 44 of file XrdAccAuthFile.hh.
◆ XrdAccAuthFile()
◆ ~XrdAccAuthFile()
XrdAccAuthFile::~XrdAccAuthFile |
( |
| ) |
|
◆ Changed()
int XrdAccAuthFile::Changed |
( |
const char * |
dbpath | ) |
|
|
virtual |
Implements XrdAccAuthDB.
Definition at line 89 of file XrdAccAuthFile.cc.
95 if (!authfn || !*authfn)
return 0;
99 if (dbfn && strcmp(dbfn, authfn))
return 1;
103 if (
stat(authfn, &statbuff))
104 {Eroute->
Emsg(
"AuthFile", errno,
"find", authfn);
110 return (modtime < statbuff.st_mtime);
int stat(const char *path, struct stat *buf)
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
References XrdSysError::Emsg(), and stat().
◆ Close()
int XrdAccAuthFile::Close |
( |
| ) |
|
|
virtual |
◆ getID()
char XrdAccAuthFile::getID |
( |
char ** |
id | ) |
|
|
virtual |
Implements XrdAccAuthDB.
Definition at line 145 of file XrdAccAuthFile.cc.
147 char *pp, idcode[2] = {0,0};
151 if (!(flags & inRec))
return 0;
156 {flags = (DBflags)(flags & ~inRec);
164 if (strlen(pp) > 2 || !index(
"ghoru", *pp))
165 {Eroute->
Emsg(
"AuthFile",
"Invalid ID sprecifier -", pp);
166 flags = (DBflags)(flags | dbError);
174 {flags = (DBflags)(flags & ~inRec);
175 Eroute->
Emsg(
"AuthFile",
"ID value missing after", idcode);
176 flags = (DBflags)(flags | dbError);
182 Copy(path_buff, pp,
sizeof(path_buff)-1);
char * GetWord(int lowcase=0)
References XrdSysError::Emsg(), and XrdOucStream::GetWord().
◆ getPP()
int XrdAccAuthFile::getPP |
( |
char ** |
path, |
|
|
char ** |
priv, |
|
|
bool & |
istmplt |
|
) |
| |
|
virtual |
Implements XrdAccAuthDB.
Definition at line 194 of file XrdAccAuthFile.cc.
201 if (!(flags & inRec))
return 0;
206 {flags = (DBflags)(flags & ~inRec);
216 else {Eroute->
Emsg(
"AuthFile",
"Object ID missing after '\\'");
218 flags = (DBflags)(flags | dbError);
220 }
else if (*pp !=
'/') istmplt =
true;
225 if (path) Copy(path_buff, pp,
sizeof(path_buff)-1);
229 if (istmplt) {*priv = (
char *)0;
return 1;}
241 {flags = (DBflags)(flags & ~inRec);
242 Eroute->
Emsg(
"AuthFile",
"Privileges missing after", path_buff);
243 flags = (DBflags)(flags | dbError);
References XrdSysError::Emsg(), and XrdOucStream::GetWord().
◆ getRec()
char XrdAccAuthFile::getRec |
( |
char ** |
recname | ) |
|
|
virtual |
Implements XrdAccAuthDB.
Definition at line 258 of file XrdAccAuthFile.cc.
269 if (flags & inRec)
while(DBfile.
GetWord()) {}
270 else flags = (DBflags)(flags | inRec);
275 {*recname = (
char *)0;
return '\0';}
298 if (!idok) {Eroute->
Emsg(
"AuthFile",
"Invalid id type -", pp);
299 flags = (DBflags)(flags | dbError);
307 {Eroute->
Emsg(
"AuthFile",
"Record name is missing after",path_buff);
308 flags = (DBflags)(flags | dbError);
314 Copy(recname_buff, pp,
sizeof(recname_buff));
315 *recname = recname_buff;
References XrdSysError::Emsg(), and XrdOucStream::GetWord().
◆ Open()
int XrdAccAuthFile::Open |
( |
XrdSysError & |
eroute, |
|
|
const char * |
path = 0 |
|
) |
| |
|
virtual |
Implements XrdAccAuthDB.
Definition at line 325 of file XrdAccAuthFile.cc.
327 struct stat statbuff;
338 {
if (authfn) free(authfn); authfn = strdup(path);}
339 if( !authfn || !*authfn)
return Bail(0,
"Authorization file not specified.");
343 if (
stat(authfn, &statbuff))
return Bail(errno,
"find", authfn);
347 if ( (authFD =
open(authfn, O_RDONLY, 0)) < 0)
348 return Bail(errno,
"open authorization file",authfn);
352 modtime = statbuff.st_mtime;
359 if (DBfile.
Attach(authFD))
360 return Bail(DBfile.
LastError(),
"initialize stream for", authfn);
int open(const char *path, int oflag,...)
int Attach(int FileDescriptor, int bsz=2047)
void SetEroute(XrdSysError *eroute)
References XrdOucStream::Attach(), XrdOucStream::LastError(), XrdSysMutex::Lock(), open(), XrdOucStream::SetEroute(), stat(), and XrdOucStream::Tabs().
The documentation for this class was generated from the following files: