93{
94 char *up, path[2048];
95 struct dirent *dp;
97 int rc;
98
99
100
101 if (!LogDir) return -1;
102
103
104
105 if (!pargs.dirP)
106 {
if (!(pargs.dirP =
opendir((
const char *)LogDir)))
107 {
eDest->
Emsg(
"List", errno,
"open prep log directory", LogDir);
108 return -1;
109 }
110 if (pargs.
reqid) pargs.reqlen = strlen(pargs.
reqid);
111 if (pargs.
user) pargs.usrlen = strlen(pargs.
user);
112 }
113
114
115
116 errno = 0;
117 while((dp =
readdir(pargs.dirP)))
118 {if (!(up = (char *) index((const char *)dp->d_name, '_'))) continue;
119 if (pargs.reqlen && strncmp(dp->d_name, pargs.
reqid, pargs.reqlen))
120 continue;
121 if (pargs.usrlen)
122 if (!up || strcmp((
const char *)up+1,(
const char *)pargs.
user))
123 continue;
124 strcpy(path, (const char *)LogDir);
125 strcpy(path+LogDirLen, (const char *)dp->d_name);
126 if (
stat((
const char *)path, &buf))
continue;
127 *up = ' ';
128 if ((up = (char *) index((const char *)(up+1), (int)'_'))) *up = ' ';
129 else continue;
130 if ((up = (char *) index((const char *)(up+1), (int)'_'))) *up = ' ';
131 else continue;
132 return snprintf(resp, resplen-1, "%s %lld",
133 dp->d_name, (long long) buf.st_mtime);
134 }
135
136
137
138 if ((rc = errno))
139 eDest->
Emsg(
"List", errno,
"read prep log directory", LogDir);
141 pargs.dirP = 0;
142 return (rc ? -1 : 0);
143}
static XrdSysError eDest(0,"crypto_")
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)