Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
f5865886
Commit
f5865886
authored
Dec 12, 2013
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Respecting -run_as_user
parent
473e2a1c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
mongoose.c
mongoose.c
+14
-2
No files found.
mongoose.c
View file @
f5865886
...
...
@@ -84,11 +84,12 @@ typedef struct _stati64 file_stat_t;
#define __func__ __FILE__ ":" STR(__LINE__)
#endif
#else
#include <inttypes.h>
#include <dirent.h>
#include <
unistd
.h>
#include <
inttypes
.h>
#include <pthread.h>
#include <pwd.h>
#include <signal.h>
#include <unistd.h>
#include <arpa/inet.h> // For inet_pton() when USE_IPV6 is defined
#include <netinet/in.h>
#include <sys/socket.h>
...
...
@@ -3298,6 +3299,17 @@ const char *mg_set_option(struct mg_server *server, const char *name,
}
else
{
set_non_blocking_mode
(
server
->
listening_sock
);
}
}
else
if
(
ind
==
RUN_AS_USER
)
{
#ifndef _WIN32
struct
passwd
*
pw
;
if
((
pw
=
getpwnam
(
value
))
==
NULL
)
{
error_msg
=
"Unknown user"
;
}
else
if
(
setgid
(
pw
->
pw_gid
)
!=
0
)
{
error_msg
=
"setgid() failed"
;
}
else
if
(
setuid
(
pw
->
pw_uid
)
!=
0
)
{
error_msg
=
"setuid() failed"
;
}
#endif
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment