mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-10-24 17:33:46 +00:00
Fix #939
This commit is contained in:
+3
-3
@@ -1785,9 +1785,6 @@ main(int argc, char **argv)
|
||||
LOGI("initializing ciphers... %s", method);
|
||||
int m = enc_init(password, method);
|
||||
|
||||
// init block list
|
||||
init_block_list();
|
||||
|
||||
// initialize ev loop
|
||||
struct ev_loop *loop = EV_DEFAULT;
|
||||
|
||||
@@ -1864,6 +1861,9 @@ main(int argc, char **argv)
|
||||
run_as(user);
|
||||
}
|
||||
|
||||
// init block list
|
||||
init_block_list();
|
||||
|
||||
// Init connections
|
||||
cork_dllist_init(&connections);
|
||||
|
||||
|
||||
+4
-4
@@ -109,14 +109,14 @@ run_as(const char *user)
|
||||
|
||||
if (err == 0 && pwd) {
|
||||
/* setgid first, because we may not be allowed to do it anymore after setuid */
|
||||
if (setregid(pwd->pw_gid, 0) != 0) {
|
||||
if (setgid(pwd->pw_gid) != 0) {
|
||||
LOGE(
|
||||
"Could not change group id to that of run_as user '%s': %s",
|
||||
user, strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (setreuid(pwd->pw_uid, 0) != 0) {
|
||||
if (setuid(pwd->pw_uid) != 0) {
|
||||
LOGE(
|
||||
"Could not change user id to that of run_as user '%s': %s",
|
||||
user, strerror(errno));
|
||||
@@ -150,12 +150,12 @@ run_as(const char *user)
|
||||
return 0;
|
||||
}
|
||||
/* setgid first, because we may not allowed to do it anymore after setuid */
|
||||
if (setregid(pwd->pw_gid, 0) != 0) {
|
||||
if (setgid(pwd->pw_gid) != 0) {
|
||||
LOGE("Could not change group id to that of run_as user '%s': %s",
|
||||
user, strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
if (setreuid(pwd->pw_uid, 0) != 0) {
|
||||
if (setuid(pwd->pw_uid) != 0) {
|
||||
LOGE("Could not change user id to that of run_as user '%s': %s",
|
||||
user, strerror(errno));
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user