Skip to content

Commit

Permalink
Allow objectid's to be specified in the authorization file.
Browse files Browse the repository at this point in the history
  • Loading branch information
abh3 committed Jun 14, 2016
1 parent 57f770e commit 23f3456
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/XrdAcc/XrdAccAuthDB.hh
Expand Up @@ -88,7 +88,7 @@ virtual int Open(XrdSysError &eroute, const char *path=0) = 0;

virtual char getRec(char **recname) = 0;

virtual int getPP(char **path, char **priv) = 0;
virtual int getPP(char **path, char **priv, bool &istmplt) = 0;

virtual int Close() = 0;

Expand Down
19 changes: 15 additions & 4 deletions src/XrdAcc/XrdAccAuthFile.cc
Expand Up @@ -142,7 +142,7 @@ int XrdAccAuthFile::Close()
/* g e t P P */
/******************************************************************************/

int XrdAccAuthFile::getPP(char **path, char **priv)
int XrdAccAuthFile::getPP(char **path, char **priv, bool &istmplt)
{
// char *pp, *bp;
char *pp;
Expand All @@ -158,15 +158,26 @@ int XrdAccAuthFile::getPP(char **path, char **priv)
return 0;
}

// Check of objectid specification
//
istmplt = false;
*path = path_buff;
if (*pp == '\\')
{if (*(pp+1)) pp++;
else {Eroute->Emsg("AuthFile", "Object ID missing after '\\'");
*path = 0;
flags = (DBflags)(flags | dbError);
}
} else if (*pp != '/') istmplt = true;

// Copy the value since the stream buffer might get overlaid.
//
// bp = Copy(path_buff, pp, sizeof(path_buff)-1);
Copy(path_buff, pp, sizeof(path_buff)-1);
*path = path_buff;
if (path) Copy(path_buff, pp, sizeof(path_buff)-1);

// Check if this is really a path or a template
//
if (*path_buff != '/') {*priv = (char *)0; return 1;}
if (istmplt) {*priv = (char *)0; return 1;}

// Verify that the path ends correctly (normally we would force a slash to
// appear at the end but that prevents caps on files. So, we commented the
Expand Down
2 changes: 1 addition & 1 deletion src/XrdAcc/XrdAccAuthFile.hh
Expand Up @@ -48,7 +48,7 @@ int Open(XrdSysError &eroute, const char *path=0);

char getRec(char **recname);

int getPP(char **path, char **priv);
int getPP(char **path, char **priv, bool &istmplt);

int Close();

Expand Down
5 changes: 3 additions & 2 deletions src/XrdAcc/XrdAccConfig.cc
Expand Up @@ -533,6 +533,7 @@ int XrdAccConfig::ConfigDBrec(XrdSysError &Eroute,
XrdAccPrivCaps xprivs;
XrdAccCapability mycap((char *)"", xprivs), *currcap, *lastcap = &mycap;
XrdAccCapName *ncp;
bool istmplt;

// Prepare the next record in the database
//
Expand Down Expand Up @@ -585,10 +586,10 @@ int XrdAccConfig::ConfigDBrec(XrdSysError &Eroute,
// Now start getting <path> <priv> pairs until we hit the logical end
//
while(1) {NoGo = 0;
if (!Database->getPP(&path, &privs)) break;
if (!Database->getPP(&path, &privs, istmplt)) break;
if (!path) continue; // Skip pathless entries
NoGo = 1;
if (*path != '/')
if (istmplt)
{if ((currcap = tabs.T_Hash->Find(path)))
currcap = new XrdAccCapability(currcap);
else {Eroute.Emsg("ConfigXeq", "Missing template -", path);
Expand Down

0 comments on commit 23f3456

Please sign in to comment.