Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
5c62c801
Commit
5c62c801
authored
Aug 07, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup and fix aliasing warnings
parent
fe1b933e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
8 deletions
+19
-8
bin/rootwrap.c
bin/rootwrap.c
+19
-8
No files found.
bin/rootwrap.c
View file @
5c62c801
...
@@ -106,34 +106,45 @@ static int send_fd (int p, int fd)
...
@@ -106,34 +106,45 @@ static int send_fd (int p, int fd)
*/
*/
static
void
rootprocess
(
int
fd
)
static
void
rootprocess
(
int
fd
)
{
{
struct
sockaddr_storage
ss
;
union
{
struct
sockaddr
sa
;
struct
sockaddr_storage
ss
;
struct
sockaddr_in
sin
;
#ifdef AF_INET6
struct
sockaddr_in6
sin6
;
#endif
}
addr
;
while
(
recv
(
fd
,
&
ss
,
sizeof
(
ss
),
0
)
==
sizeof
(
ss
))
while
(
recv
(
fd
,
&
addr
.
ss
,
sizeof
(
addr
.
ss
),
0
)
==
sizeof
(
addr
.
ss
))
{
{
unsigned
len
;
unsigned
len
;
int
sock
;
int
sock
;
int
family
;
switch
(
ss
.
ss
_family
)
switch
(
addr
.
sa
.
sa
_family
)
{
{
case
AF_INET
:
case
AF_INET
:
if
(
!
is_allowed_port
(
((
struct
sockaddr_in
*
)
&
ss
)
->
sin_port
))
if
(
!
is_allowed_port
(
addr
.
sin
.
sin_port
))
{
{
if
(
send_err
(
fd
,
EACCES
))
if
(
send_err
(
fd
,
EACCES
))
return
;
return
;
continue
;
continue
;
}
}
len
=
sizeof
(
struct
sockaddr_in
);
len
=
sizeof
(
struct
sockaddr_in
);
family
=
PF_INET
;
break
;
break
;
#ifdef AF_INET6
#ifdef AF_INET6
case
AF_INET6
:
case
AF_INET6
:
if
(
!
is_allowed_port
(
((
struct
sockaddr_in6
*
)
&
ss
)
->
sin6_port
))
if
(
!
is_allowed_port
(
addr
.
sin6
.
sin6_port
))
{
{
if
(
send_err
(
fd
,
EACCES
))
if
(
send_err
(
fd
,
EACCES
))
return
;
return
;
continue
;
continue
;
}
}
len
=
sizeof
(
struct
sockaddr_in6
);
len
=
sizeof
(
struct
sockaddr_in6
);
family
=
PF_INET6
;
break
;
break
;
#endif
#endif
...
@@ -143,17 +154,17 @@ static void rootprocess (int fd)
...
@@ -143,17 +154,17 @@ static void rootprocess (int fd)
continue
;
continue
;
}
}
sock
=
socket
(
ss
.
ss_
family
,
SOCK_STREAM
,
IPPROTO_TCP
);
sock
=
socket
(
family
,
SOCK_STREAM
,
IPPROTO_TCP
);
if
(
sock
!=
-
1
)
if
(
sock
!=
-
1
)
{
{
const
int
val
=
1
;
const
int
val
=
1
;
setsockopt
(
sock
,
SOL_SOCKET
,
SO_REUSEADDR
,
&
val
,
sizeof
(
val
));
setsockopt
(
sock
,
SOL_SOCKET
,
SO_REUSEADDR
,
&
val
,
sizeof
(
val
));
#ifdef AF_INET6
#ifdef AF_INET6
if
(
ss
.
ss
_family
==
AF_INET6
)
if
(
addr
.
sa
.
sa
_family
==
AF_INET6
)
setsockopt
(
sock
,
IPPROTO_IPV6
,
IPV6_V6ONLY
,
&
val
,
sizeof
(
val
));
setsockopt
(
sock
,
IPPROTO_IPV6
,
IPV6_V6ONLY
,
&
val
,
sizeof
(
val
));
#endif
#endif
if
(
bind
(
sock
,
(
struct
sockaddr
*
)
&
ss
,
len
)
==
0
)
if
(
bind
(
sock
,
&
addr
.
sa
,
len
)
==
0
)
{
{
send_fd
(
fd
,
sock
);
send_fd
(
fd
,
sock
);
close
(
sock
);
close
(
sock
);
...
...
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