Ensure the setgid bit is set in the base directory.

This commit is contained in:
default 2023-02-07 09:16:19 +01:00
parent fabe6a5006
commit 392c5147a3

View file

@ -143,11 +143,14 @@ int snac_init(const char *basedir)
}
}
if (mkdir(srv_basedir, 0775) == -1) {
if (mkdir(srv_basedir, DIR_PERM) == -1) {
printf("ERROR: cannot create directory '%s'\n", srv_basedir);
return 1;
}
/* force permissions (mkdir also uses 777) */
chmod(srv_basedir, DIR_PERM);
xs *udir = xs_fmt("%s/user", srv_basedir);
mkdir(udir, DIR_PERM);