Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Icecast-Server
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
94
Issues
94
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
External Wiki
External Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xiph.Org
Icecast-Server
Commits
7a27cacf
Commit
7a27cacf
authored
Nov 29, 2014
by
Philipp Schafft
🦁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated chroot and setuid/gid support. Thanks to d26264b9 for reporting. close
#2096
svn path=/icecast/trunk/icecast/; revision=19365
parent
23a47c8f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
6 deletions
+17
-6
configure.in
configure.in
+2
-0
src/main.c
src/main.c
+15
-6
No files found.
configure.in
View file @
7a27cacf
...
...
@@ -42,6 +42,8 @@ AC_CHECK_FUNCS([strcasestr])
AC_CHECK_FUNCS([gethostname])
AC_CHECK_FUNCS([uname])
AC_CHECK_FUNCS([setenv])
AC_CHECK_FUNCS([setresuid])
AC_CHECK_FUNCS([setresgid])
dnl Checks for typedefs, structures, and compiler characteristics.
XIPH_C__FUNC__
...
...
src/main.c
View file @
7a27cacf
...
...
@@ -389,9 +389,8 @@ static void _ch_root_uid_setup(void)
if
(
getuid
())
/* root check */
{
fprintf
(
stderr
,
"WARNING: Cannot change server root unless running as root.
\n
"
);
return
;
}
if
(
chroot
(
conf
->
base_dir
))
if
(
chroot
(
conf
->
base_dir
)
==
-
1
||
chdir
(
"/"
)
==
-
1
)
{
fprintf
(
stderr
,
"WARNING: Couldn't change server root: %s
\n
"
,
strerror
(
errno
));
return
;
...
...
@@ -412,18 +411,28 @@ static void _ch_root_uid_setup(void)
}
if
(
uid
!=
(
uid_t
)
-
1
&&
gid
!=
(
gid_t
)
-
1
)
{
if
(
!
setgid
(
gid
))
#ifdef HAVE_SETRESGID
if
(
!
setresgid
(
gid
,
gid
,
gid
))
{
#else
if
(
!
setgid
(
gid
))
{
#endif
fprintf
(
stdout
,
"Changed groupid to %i.
\n
"
,
(
int
)
gid
);
else
}
else
{
fprintf
(
stdout
,
"Error changing groupid: %s.
\n
"
,
strerror
(
errno
));
}
if
(
!
initgroups
(
conf
->
user
,
gid
))
fprintf
(
stdout
,
"Changed supplementary groups based on user: %s.
\n
"
,
conf
->
user
);
else
fprintf
(
stdout
,
"Error changing supplementary groups: %s.
\n
"
,
strerror
(
errno
));
if
(
!
setuid
(
uid
))
#ifdef HAVE_SETRESUID
if
(
!
setresuid
(
uid
,
uid
,
uid
))
{
#else
if
(
!
setuid
(
uid
))
{
#endif
fprintf
(
stdout
,
"Changed userid to %i.
\n
"
,
(
int
)
uid
);
else
}
else
{
fprintf
(
stdout
,
"Error changing userid: %s.
\n
"
,
strerror
(
errno
));
}
}
}
#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