mirror of
https://github.com/SuperBFG7/ympd
synced 2025-01-30 19:04:52 +00:00
Fix: setgroups before setuid
This commit is contained in:
parent
e99bd1f66e
commit
ca4ff0e396
@ -28,6 +28,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
|
#include <grp.h>
|
||||||
|
|
||||||
#include "../dist/src/mongoose/mongoose.h"
|
#include "../dist/src/mongoose/mongoose.h"
|
||||||
#include "../dist/src/inih/ini.h"
|
#include "../dist/src/inih/ini.h"
|
||||||
@ -246,6 +247,10 @@ int main(int argc, char **argv) {
|
|||||||
printf("Unknown user\n");
|
printf("Unknown user\n");
|
||||||
mg_mgr_free(&mgr);
|
mg_mgr_free(&mgr);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
} else if (setgroups(0, NULL) != 0) {
|
||||||
|
printf("setgroups() failed\n");
|
||||||
|
mg_mgr_free(&mgr);
|
||||||
|
return EXIT_FAILURE;
|
||||||
} else if (setgid(pw->pw_gid) != 0) {
|
} else if (setgid(pw->pw_gid) != 0) {
|
||||||
printf("setgid() failed\n");
|
printf("setgid() failed\n");
|
||||||
mg_mgr_free(&mgr);
|
mg_mgr_free(&mgr);
|
||||||
|
Loading…
Reference in New Issue
Block a user