Changeset 55f877f08dfd49f95ae5fd916d0a9162adcb59d4
- Timestamp:
- 12/16/05 12:18:38
(3 years ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1134731918 +0000
- git-parent:
[a21fa2255e8a6cf288fe3ecc5c779428ec3585dc]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1134731918 +0000
- Message:
Implement root wrapper to allow using privileged TCP ports
while not running the whole VLC as root - closes #440
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r9ce752b |
r55f877f |
|
| 70 | 70 | include/vlc/intf.h \ |
|---|
| 71 | 71 | include/vlc/control.h \ |
|---|
| 72 | | include/vlc/control_structures.h \ |
|---|
| | 72 | include/vlc/control_structures.h \ |
|---|
| 73 | 73 | $(NULL) |
|---|
| 74 | 74 | |
|---|
| … | … | |
| 447 | 447 | src/network/udp.c \ |
|---|
| 448 | 448 | src/network/httpd.c \ |
|---|
| | 449 | src/network/rootwrap.c \ |
|---|
| 449 | 450 | src/network/tls.c \ |
|---|
| 450 | 451 | src/misc/charset.c \ |
|---|
| r8acc19a |
r55f877f |
|
| 51 | 51 | extern int net_Socket( vlc_object_t *p_this, int i_family, int i_socktype, |
|---|
| 52 | 52 | int i_protocol ); |
|---|
| | 53 | extern int rootwrap_bind (int family, int socktype, int protocol, |
|---|
| | 54 | const struct sockaddr *addr, size_t alen); |
|---|
| 53 | 55 | |
|---|
| 54 | 56 | /***************************************************************************** |
|---|
| … | … | |
| 303 | 305 | #if defined(WIN32) || defined(UNDER_CE) |
|---|
| 304 | 306 | msg_Warn( p_this, "cannot bind socket (%i)", WSAGetLastError( ) ); |
|---|
| 305 | | #else |
|---|
| 306 | | msg_Warn( p_this, "cannot bind socket (%s)", strerror( errno ) ); |
|---|
| 307 | | #endif |
|---|
| 308 | 307 | net_Close( fd ); |
|---|
| 309 | 308 | continue; |
|---|
| 310 | | } |
|---|
| 311 | | |
|---|
| | 309 | #else |
|---|
| | 310 | int saved_errno; |
|---|
| | 311 | |
|---|
| | 312 | saved_errno = errno; |
|---|
| | 313 | net_Close( fd ); |
|---|
| | 314 | fd = rootwrap_bind( ptr->ai_family, ptr->ai_socktype, |
|---|
| | 315 | ptr->ai_protocol, ptr->ai_addr, |
|---|
| | 316 | ptr->ai_addrlen ); |
|---|
| | 317 | if( fd != -1 ) |
|---|
| | 318 | { |
|---|
| | 319 | msg_Dbg( p_this, "got socket %d from rootwrap", fd ); |
|---|
| | 320 | } |
|---|
| | 321 | else |
|---|
| | 322 | { |
|---|
| | 323 | msg_Warn( p_this, "cannot bind socket (%s)", |
|---|
| | 324 | strerror( saved_errno ) ); |
|---|
| | 325 | continue; |
|---|
| | 326 | } |
|---|
| | 327 | #endif |
|---|
| | 328 | } |
|---|
| | 329 | |
|---|
| | 330 | msg_Dbg( p_this, "using socket %d from rootwrap", fd ); |
|---|
| 312 | 331 | /* Listen */ |
|---|
| 313 | 332 | if( listen( fd, 100 ) == -1 ) |
|---|
| rc59fd2b |
r55f877f |
|
| 46 | 46 | #endif |
|---|
| 47 | 47 | |
|---|
| | 48 | extern void rootwrap( void ); |
|---|
| | 49 | |
|---|
| 48 | 50 | /***************************************************************************** |
|---|
| 49 | 51 | * main: parse command line, start interface and spawn threads. |
|---|
| … | … | |
| 74 | 76 | #endif |
|---|
| 75 | 77 | |
|---|
| | 78 | rootwrap (); |
|---|
| | 79 | |
|---|
| 76 | 80 | /* Create a libvlc structure */ |
|---|
| 77 | 81 | i_ret = VLC_Create(); |
|---|