@@ 142-154 (lines=13) @@ | ||
139 | } |
|
140 | } |
|
141 | ||
142 | if (isset(Daemon::$config->group->value)) { |
|
143 | if ($sg === false) { |
|
144 | $this->log('Couldn\'t change group to \'' . Daemon::$config->group->value . '\'. You must replace config-variable \'group\' with existing group.'); |
|
145 | exit(0); |
|
146 | } elseif (($sg['gid'] != posix_getgid()) && (!posix_setgid($sg['gid']))) { |
|
147 | $this->log('Couldn\'t change group to \'' . Daemon::$config->group->value . "'. Error (" . ($errno = posix_get_last_error()) . '): ' . posix_strerror($errno)); |
|
148 | exit(0); |
|
149 | } |
|
150 | } |
|
151 | ||
152 | if (isset(Daemon::$config->user->value)) { |
|
153 | if ($su === false) { |
|
154 | $this->log('Couldn\'t change user to \'' . Daemon::$config->user->value . '\', user not found. You must replace config-variable \'user\' with existing username.'); |
|
155 | exit(0); |
|
156 | } elseif (($su['uid'] != posix_getuid()) && (!posix_setuid($su['uid']))) { |
|
157 | $this->log('Couldn\'t change user to \'' . Daemon::$config->user->value . "'. Error (" . ($errno = posix_get_last_error()) . '): ' . posix_strerror($errno)); |
|
@@ 152-164 (lines=13) @@ | ||
149 | } |
|
150 | } |
|
151 | ||
152 | if (isset(Daemon::$config->user->value)) { |
|
153 | if ($su === false) { |
|
154 | $this->log('Couldn\'t change user to \'' . Daemon::$config->user->value . '\', user not found. You must replace config-variable \'user\' with existing username.'); |
|
155 | exit(0); |
|
156 | } elseif (($su['uid'] != posix_getuid()) && (!posix_setuid($su['uid']))) { |
|
157 | $this->log('Couldn\'t change user to \'' . Daemon::$config->user->value . "'. Error (" . ($errno = posix_get_last_error()) . '): ' . posix_strerror($errno)); |
|
158 | exit(0); |
|
159 | } |
|
160 | } |
|
161 | ||
162 | if (Daemon::$config->cwd->value !== '.') { |
|
163 | if (!@chdir(Daemon::$config->cwd->value)) { |
|
164 | $this->log('Couldn\'t change directory to \'' . Daemon::$config->cwd->value . '.'); |
|
165 | } |
|
166 | } |
|
167 | } |