Skip to content

Commit 60eadab

Browse files
committed
use stat, not lstat for filtering, as we want to walk through symlinks
1 parent a6f8cdb commit 60eadab

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

doas.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,15 @@ parseconfdir(const char *dirpath, int checkperms)
214214
for (i = 0; i < dirent_count; i++)
215215
{
216216
struct stat sb;
217+
size_t pathlen;
217218

218-
snprintf(pathbuf, sizeof pathbuf, "%s/%s", dirpath, dirent_table[i]->d_name);
219+
pathlen = snprintf(pathbuf, sizeof pathbuf, "%s/%s", dirpath, dirent_table[i]->d_name);
219220
free(dirent_table[i]);
220221

222+
/* make sure path ends in .conf */
223+
if (strcmp(pathbuf + (pathlen - 5), ".conf"))
224+
continue;
225+
221226
if (stat(pathbuf, &sb) != 0)
222227
err(1, "stat(\"%s\")", pathbuf);
223228

0 commit comments

Comments
 (0)