nghttpx: Use ImmutableString for user
This commit is contained in:
parent
466e4b7a1e
commit
7aabc6b125
|
@ -1738,7 +1738,7 @@ int parse_config(const char *opt, const char *optarg,
|
|||
<< strerror(errno);
|
||||
return -1;
|
||||
}
|
||||
mod_config()->user = strcopy(pwd->pw_name);
|
||||
mod_config()->user = pwd->pw_name;
|
||||
mod_config()->uid = pwd->pw_uid;
|
||||
mod_config()->gid = pwd->pw_gid;
|
||||
|
||||
|
|
|
@ -583,7 +583,7 @@ struct Config {
|
|||
ConnectionConfig conn;
|
||||
ImmutableString pid_file;
|
||||
ImmutableString conf_path;
|
||||
std::unique_ptr<char[]> user;
|
||||
ImmutableString user;
|
||||
std::unique_ptr<char[]> mruby_file;
|
||||
char **original_argv;
|
||||
char **argv;
|
||||
|
|
|
@ -64,7 +64,7 @@ void drop_privileges(
|
|||
#endif // HAVE_NEVERBLEED
|
||||
) {
|
||||
if (getuid() == 0 && get_config()->uid != 0) {
|
||||
if (initgroups(get_config()->user.get(), get_config()->gid) != 0) {
|
||||
if (initgroups(get_config()->user.c_str(), get_config()->gid) != 0) {
|
||||
auto error = errno;
|
||||
LOG(FATAL) << "Could not change supplementary groups: "
|
||||
<< strerror(error);
|
||||
|
@ -86,7 +86,7 @@ void drop_privileges(
|
|||
}
|
||||
#ifdef HAVE_NEVERBLEED
|
||||
if (nb) {
|
||||
neverbleed_setuidgid(nb, get_config()->user.get(), 1);
|
||||
neverbleed_setuidgid(nb, get_config()->user.c_str(), 1);
|
||||
}
|
||||
#endif // HAVE_NEVERBLEED
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue