Check setgid too after dropping root
This commit is contained in:
parent
bb32fd1d50
commit
b63aaffcd1
4
shadow.c
4
shadow.c
@ -33,9 +33,9 @@ void initialize_pw_backend(int argc, char **argv) {
|
|||||||
swaylock_log_errno(LOG_ERROR, "Unable to drop root");
|
swaylock_log_errno(LOG_ERROR, "Unable to drop root");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
if (setuid(0) != -1) {
|
if (setuid(0) != -1 || setgid(0) != -1) {
|
||||||
swaylock_log_errno(LOG_ERROR, "Unable to drop root (we shouldn't be "
|
swaylock_log_errno(LOG_ERROR, "Unable to drop root (we shouldn't be "
|
||||||
"able to restore it after setuid)");
|
"able to restore it after setuid/setgid)");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user