mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-16 00:00:07 +01:00
unix privs change group before user
Otherwise we no longer have privs to change the group after doing the user Signed-off-by: Andy Green <andy.green@linaro.org>
This commit is contained in:
parent
314ca966a0
commit
d2a95e0c82
1 changed files with 4 additions and 4 deletions
|
@ -270,6 +270,10 @@ lws_plat_set_socket_options(struct lws_context *context, int fd)
|
||||||
LWS_VISIBLE void
|
LWS_VISIBLE void
|
||||||
lws_plat_drop_app_privileges(struct lws_context_creation_info *info)
|
lws_plat_drop_app_privileges(struct lws_context_creation_info *info)
|
||||||
{
|
{
|
||||||
|
if (info->gid != -1)
|
||||||
|
if (setgid(info->gid))
|
||||||
|
lwsl_warn("setgid: %s\n", strerror(LWS_ERRNO));
|
||||||
|
|
||||||
if (info->uid != -1) {
|
if (info->uid != -1) {
|
||||||
struct passwd *p = getpwuid(info->uid);
|
struct passwd *p = getpwuid(info->uid);
|
||||||
|
|
||||||
|
@ -282,10 +286,6 @@ lws_plat_drop_app_privileges(struct lws_context_creation_info *info)
|
||||||
} else
|
} else
|
||||||
lwsl_warn("getpwuid: unable to find uid %d", info->uid);
|
lwsl_warn("getpwuid: unable to find uid %d", info->uid);
|
||||||
}
|
}
|
||||||
if (info->gid != -1)
|
|
||||||
if (setgid(info->gid))
|
|
||||||
lwsl_warn("setgid: %s\n", strerror(LWS_ERRNO));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Add table
Reference in a new issue