mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 00:37:00 +08:00
Check for root permissions after parsing command line
This commit is contained in:
10
src/main.c
10
src/main.c
@@ -370,17 +370,17 @@ int main(int argc, char** argv)
|
||||
signal(SIGCHLD, handle_children);
|
||||
signal(SIGALRM, handle_alarm);
|
||||
|
||||
if (getuid() != 0) {
|
||||
fprintf(stderr, "This server requires root access to operate.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* load configuration */
|
||||
ret = cmd_parser(argc, argv, &config);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "Error in arguments\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (getuid() != 0) {
|
||||
fprintf(stderr, "This server requires root access to operate.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
s.config = &config;
|
||||
s.tun = &tun;
|
||||
|
||||
Reference in New Issue
Block a user