check that socket path is a directory

This commit is contained in:
Alexandre Ratchov 2016-01-09 11:08:18 +01:00
parent e20bb8997d
commit 12dccf8463
1 changed files with 2 additions and 0 deletions

View File

@ -273,6 +273,8 @@ getbasepath(char *base, size_t size)
umask(omask);
if (stat(base, &sb) < 0)
err(1, "stat(\"%s\")", base);
if (!S_ISDIR(sb.st_mode))
errx(1, "%s is not a directory", base);
if (sb.st_uid != uid || (sb.st_mode & mask) != 0)
errx(1, "%s has wrong permissions", base);
}