Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
4100226d
Commit
4100226d
authored
Nov 06, 2004
by
Gildas Bazin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* Merged trunk changes r9191:9196 to 0.8.1 branch.
parent
959745b1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
187 additions
and
41 deletions
+187
-41
Makefile.am
Makefile.am
+1
-0
TODO
TODO
+10
-0
include/vlc_tls.h
include/vlc_tls.h
+4
-2
modules/access_output/http.c
modules/access_output/http.c
+72
-9
modules/control/http.c
modules/control/http.c
+5
-30
src/misc/tls.c
src/misc/tls.c
+95
-0
No files found.
Makefile.am
View file @
4100226d
...
@@ -361,6 +361,7 @@ SOURCES_libvlc_common = \
...
@@ -361,6 +361,7 @@ SOURCES_libvlc_common = \
src/stream_output/sap.c
\
src/stream_output/sap.c
\
src/misc/charset.c
\
src/misc/charset.c
\
src/misc/httpd.c
\
src/misc/httpd.c
\
src/misc/tls.c
\
src/misc/mtime.c
\
src/misc/mtime.c
\
src/misc/block.c
\
src/misc/block.c
\
src/misc/modules.c
\
src/misc/modules.c
\
...
...
TODO
View file @
4100226d
...
@@ -563,6 +563,16 @@ Unfortunatly it is very Win32 focused.
...
@@ -563,6 +563,16 @@ Unfortunatly it is very Win32 focused.
Status: Todo
Status: Todo
Task
Difficulty: Medium
Platform: any
Urgency: Wishlist
Description: More service discovry modules
- Port UPnP support from http://sourceforge.net/project/showfiles.php?group_id=89768 <br />
- libhal based discovery (should be able to find cd,dvd,capture cards,etc etc <br />
- Perhaps a generalized webpage parser (use user supplied templates to parse
streams from popular websites )
Status: Todo
# Do not remove me
# Do not remove me
Task
Task
include/vlc_tls.h
View file @
4100226d
...
@@ -68,7 +68,8 @@ struct tls_session_t
...
@@ -68,7 +68,8 @@ struct tls_session_t
* Allocates a whole server's TLS credentials.
* Allocates a whole server's TLS credentials.
* Returns NULL on error.
* Returns NULL on error.
*****************************************************************************/
*****************************************************************************/
# define tls_ServerCreate( a, b, c ) (((tls_t *)a)->pf_server_create (a, b, c))
# define __tls_ServerCreate( a, b, c ) (((tls_t *)a)->pf_server_create (a, b, c))
VLC_EXPORT
(
tls_server_t
*
,
tls_ServerCreate
,
(
vlc_object_t
*
,
const
char
*
,
const
char
*
)
);
/*****************************************************************************
/*****************************************************************************
* tls_ServerAddCA:
* tls_ServerAddCA:
...
@@ -88,7 +89,8 @@ struct tls_session_t
...
@@ -88,7 +89,8 @@ struct tls_session_t
# define tls_ServerAddCRL( a, b ) (((tls_server_t *)a)->pf_add_CRL (a, b))
# define tls_ServerAddCRL( a, b ) (((tls_server_t *)a)->pf_add_CRL (a, b))
# define tls_ServerDelete( a ) (((tls_server_t *)a)->pf_delete ( a ))
# define __tls_ServerDelete( a ) (((tls_server_t *)a)->pf_delete ( a ))
VLC_EXPORT
(
void
,
tls_ServerDelete
,
(
tls_server_t
*
)
);
# define tls_ServerSessionPrepare( a ) (((tls_server_t *)a)->pf_session_prepare (a))
# define tls_ServerSessionPrepare( a ) (((tls_server_t *)a)->pf_session_prepare (a))
...
...
modules/access_output/http.c
View file @
4100226d
...
@@ -30,10 +30,12 @@
...
@@ -30,10 +30,12 @@
#include <vlc/sout.h>
#include <vlc/sout.h>
#include "vlc_httpd.h"
#include "vlc_httpd.h"
#include "vlc_tls.h"
#define FREE( p ) if( p ) { free( p); (p) = NULL; }
#define FREE( p ) if( p ) { free( p); (p) = NULL; }
#define DEFAULT_PORT 8080
#define DEFAULT_PORT 8080
#define DEFAULT_SSL_PORT 8443
/*****************************************************************************
/*****************************************************************************
* Module descriptor
* Module descriptor
...
@@ -51,15 +53,28 @@ static void Close( vlc_object_t * );
...
@@ -51,15 +53,28 @@ static void Close( vlc_object_t * );
"requested to access the stream." )
"requested to access the stream." )
#define MIME_TEXT N_("Mime")
#define MIME_TEXT N_("Mime")
#define MIME_LONGTEXT N_("Allows you to give the mime returned by the server." )
#define MIME_LONGTEXT N_("Allows you to give the mime returned by the server." )
#define CERT_TEXT N_( "Certificate file" )
#define CERT_LONGTEXT N_( "HTTP/SSL stream output x509 PEM certificate file" )
#define KEY_TEXT N_( "Private key file" )
#define KEY_LONGTEXT N_( "HTTP/SSL stream output x509 PEM private key file" )
#define CA_TEXT N_( "Root CA file" )
#define CA_LONGTEXT N_( "HTTP/SSL stream output x509 PEM trusted root CA certificates file" )
#define CRL_TEXT N_( "CRL file" )
#define CRL_LONGTEXT N_( "HTTP/SSL stream output Certificates Revocation List file" )
vlc_module_begin
();
vlc_module_begin
();
set_description
(
_
(
"HTTP stream output"
)
);
set_description
(
_
(
"HTTP stream output"
)
);
set_capability
(
"sout access"
,
0
);
set_capability
(
"sout access"
,
0
);
add_shortcut
(
"http"
);
add_shortcut
(
"http"
);
add_shortcut
(
"https"
);
add_shortcut
(
"mmsh"
);
add_shortcut
(
"mmsh"
);
add_string
(
SOUT_CFG_PREFIX
"user"
,
""
,
NULL
,
USER_TEXT
,
USER_LONGTEXT
,
VLC_TRUE
);
add_string
(
SOUT_CFG_PREFIX
"user"
,
""
,
NULL
,
USER_TEXT
,
USER_LONGTEXT
,
VLC_TRUE
);
add_string
(
SOUT_CFG_PREFIX
"pwd"
,
""
,
NULL
,
PASS_TEXT
,
PASS_LONGTEXT
,
VLC_TRUE
);
add_string
(
SOUT_CFG_PREFIX
"pwd"
,
""
,
NULL
,
PASS_TEXT
,
PASS_LONGTEXT
,
VLC_TRUE
);
add_string
(
SOUT_CFG_PREFIX
"mime"
,
""
,
NULL
,
MIME_TEXT
,
MIME_LONGTEXT
,
VLC_TRUE
);
add_string
(
SOUT_CFG_PREFIX
"mime"
,
""
,
NULL
,
MIME_TEXT
,
MIME_LONGTEXT
,
VLC_TRUE
);
add_string
(
SOUT_CFG_PREFIX
"cert"
,
"vlc.pem"
,
NULL
,
CERT_TEXT
,
CERT_LONGTEXT
,
VLC_TRUE
);
add_string
(
SOUT_CFG_PREFIX
"key"
,
NULL
,
NULL
,
KEY_TEXT
,
KEY_LONGTEXT
,
VLC_TRUE
);
add_string
(
SOUT_CFG_PREFIX
"ca"
,
NULL
,
NULL
,
CA_TEXT
,
CA_LONGTEXT
,
VLC_TRUE
);
add_string
(
SOUT_CFG_PREFIX
"crl"
,
NULL
,
NULL
,
CRL_TEXT
,
CRL_LONGTEXT
,
VLC_TRUE
);
set_callbacks
(
Open
,
Close
);
set_callbacks
(
Open
,
Close
);
vlc_module_end
();
vlc_module_end
();
...
@@ -96,6 +111,7 @@ static int Open( vlc_object_t *p_this )
...
@@ -96,6 +111,7 @@ static int Open( vlc_object_t *p_this )
{
{
sout_access_out_t
*
p_access
=
(
sout_access_out_t
*
)
p_this
;
sout_access_out_t
*
p_access
=
(
sout_access_out_t
*
)
p_this
;
sout_access_out_sys_t
*
p_sys
;
sout_access_out_sys_t
*
p_sys
;
tls_server_t
*
p_tls
;
char
*
psz_parser
,
*
psz_name
;
char
*
psz_parser
,
*
psz_name
;
...
@@ -111,7 +127,7 @@ static int Open( vlc_object_t *p_this )
...
@@ -111,7 +127,7 @@ static int Open( vlc_object_t *p_this )
malloc
(
sizeof
(
sout_access_out_sys_t
)
)
)
)
malloc
(
sizeof
(
sout_access_out_sys_t
)
)
)
)
{
{
msg_Err
(
p_access
,
"Not enough memory"
);
msg_Err
(
p_access
,
"Not enough memory"
);
return
(
VLC_EGENERIC
)
;
return
VLC_ENOMEM
;
}
}
sout_CfgParse
(
p_access
,
SOUT_CFG_PREFIX
,
ppsz_sout_options
,
p_access
->
p_cfg
);
sout_CfgParse
(
p_access
,
SOUT_CFG_PREFIX
,
ppsz_sout_options
,
p_access
->
p_cfg
);
...
@@ -145,11 +161,6 @@ static int Open( vlc_object_t *p_this )
...
@@ -145,11 +161,6 @@ static int Open( vlc_object_t *p_this )
psz_file_name
=
psz_parser
;
psz_file_name
=
psz_parser
;
}
}
if
(
i_bind_port
<=
0
)
{
i_bind_port
=
DEFAULT_PORT
;
}
if
(
!*
psz_file_name
)
if
(
!*
psz_file_name
)
{
{
psz_file_name
=
strdup
(
"/"
);
psz_file_name
=
strdup
(
"/"
);
...
@@ -167,13 +178,65 @@ static int Open( vlc_object_t *p_this )
...
@@ -167,13 +178,65 @@ static int Open( vlc_object_t *p_this )
psz_file_name
=
strdup
(
psz_file_name
);
psz_file_name
=
strdup
(
psz_file_name
);
}
}
p_sys
->
p_httpd_host
=
httpd_HostNew
(
VLC_OBJECT
(
p_access
),
psz_bind_addr
,
/* SSL support */
i_bind_port
);
if
(
p_access
->
psz_access
&&
!
strcmp
(
p_access
->
psz_access
,
"https"
)
)
{
const
char
*
psz_cert
,
*
psz_key
;
psz_cert
=
config_GetPsz
(
p_this
,
SOUT_CFG_PREFIX
"cert"
);
psz_key
=
config_GetPsz
(
p_this
,
SOUT_CFG_PREFIX
"key"
);
p_tls
=
tls_ServerCreate
(
p_this
,
psz_cert
,
psz_key
);
if
(
p_tls
==
NULL
)
{
msg_Err
(
p_this
,
"TLS initialization error"
);
free
(
psz_file_name
);
free
(
psz_name
);
free
(
p_sys
);
return
VLC_EGENERIC
;
}
psz_cert
=
config_GetPsz
(
p_this
,
SOUT_CFG_PREFIX
"ca"
);
if
(
(
psz_cert
!=
NULL
)
&&
tls_ServerAddCA
(
p_tls
,
psz_cert
)
)
{
msg_Err
(
p_this
,
"TLS CA error"
);
tls_ServerDelete
(
p_tls
);
free
(
psz_file_name
);
free
(
psz_name
);
free
(
p_sys
);
return
VLC_EGENERIC
;
}
psz_cert
=
config_GetPsz
(
p_this
,
SOUT_CFG_PREFIX
"crl"
);
if
(
(
psz_cert
!=
NULL
)
&&
tls_ServerAddCRL
(
p_tls
,
psz_cert
)
)
{
msg_Err
(
p_this
,
"TLS CRL error"
);
tls_ServerDelete
(
p_tls
);
free
(
psz_file_name
);
free
(
psz_name
);
free
(
p_sys
);
return
VLC_EGENERIC
;
}
if
(
i_bind_port
<=
0
)
i_bind_port
=
DEFAULT_SSL_PORT
;
}
else
{
p_tls
=
NULL
;
if
(
i_bind_port
<=
0
)
i_bind_port
=
DEFAULT_PORT
;
}
p_sys
->
p_httpd_host
=
httpd_TLSHostNew
(
VLC_OBJECT
(
p_access
),
psz_bind_addr
,
i_bind_port
,
p_tls
);
if
(
p_sys
->
p_httpd_host
==
NULL
)
if
(
p_sys
->
p_httpd_host
==
NULL
)
{
{
msg_Err
(
p_access
,
"cannot listen on %s:%d"
,
msg_Err
(
p_access
,
"cannot listen on %s:%d"
,
psz_bind_addr
,
i_bind_port
);
psz_bind_addr
,
i_bind_port
);
if
(
p_tls
!=
NULL
)
tls_ServerDelete
(
p_tls
);
free
(
psz_name
);
free
(
psz_name
);
free
(
psz_file_name
);
free
(
psz_file_name
);
free
(
p_sys
);
free
(
p_sys
);
...
...
modules/control/http.c
View file @
4100226d
...
@@ -79,13 +79,13 @@ static void Close( vlc_object_t * );
...
@@ -79,13 +79,13 @@ static void Close( vlc_object_t * );
#define SRC_TEXT N_( "Source directory" )
#define SRC_TEXT N_( "Source directory" )
#define SRC_LONGTEXT N_( "Source directory" )
#define SRC_LONGTEXT N_( "Source directory" )
#define CERT_TEXT N_( "Certificate file" )
#define CERT_TEXT N_( "Certificate file" )
#define CERT_LONGTEXT N_( "
x509 PEM certificates path file
" )
#define CERT_LONGTEXT N_( "
HTTP interface x509 PEM certificate file (enables SSL)
" )
#define KEY_TEXT N_( "Private key file" )
#define KEY_TEXT N_( "Private key file" )
#define KEY_LONGTEXT N_( "x509 PEM private key file" )
#define KEY_LONGTEXT N_( "
HTTP interface
x509 PEM private key file" )
#define CA_TEXT N_( "Root CA file" )
#define CA_TEXT N_( "Root CA file" )
#define CA_LONGTEXT N_( "x509 PEM trusted root CA certificates file" )
#define CA_LONGTEXT N_( "
HTTP interface
x509 PEM trusted root CA certificates file" )
#define CRL_TEXT N_( "CRL file" )
#define CRL_TEXT N_( "CRL file" )
#define CRL_LONGTEXT N_( "
Certificates revocation l
ist file" )
#define CRL_LONGTEXT N_( "
HTTP interace Certificates Revocation L
ist file" )
vlc_module_begin
();
vlc_module_begin
();
set_description
(
_
(
"HTTP remote control interface"
)
);
set_description
(
_
(
"HTTP remote control interface"
)
);
...
@@ -190,7 +190,6 @@ struct intf_sys_t
...
@@ -190,7 +190,6 @@ struct intf_sys_t
playlist_t
*
p_playlist
;
playlist_t
*
p_playlist
;
input_thread_t
*
p_input
;
input_thread_t
*
p_input
;
vlm_t
*
p_vlm
;
vlm_t
*
p_vlm
;
tls_t
*
p_tls
;
};
};
...
@@ -232,32 +231,16 @@ static int Open( vlc_object_t *p_this )
...
@@ -232,32 +231,16 @@ static int Open( vlc_object_t *p_this )
p_sys
->
p_input
=
NULL
;
p_sys
->
p_input
=
NULL
;
p_sys
->
p_vlm
=
NULL
;
p_sys
->
p_vlm
=
NULL
;
/* TODO: avoid possible code duplication in other modules */
psz_cert
=
config_GetPsz
(
p_intf
,
"http-intf-cert"
);
psz_cert
=
config_GetPsz
(
p_intf
,
"http-intf-cert"
);
if
(
psz_cert
!=
NULL
)
if
(
psz_cert
!=
NULL
)
{
{
const
char
*
psz_pem
;
const
char
*
psz_pem
;
p_sys
->
p_tls
=
vlc_object_create
(
p_this
,
VLC_OBJECT_TLS
);
vlc_object_attach
(
p_sys
->
p_tls
,
p_this
);
p_sys
->
p_tls
->
p_module
=
module_Need
(
p_sys
->
p_tls
,
"tls"
,
0
,
0
);
if
(
p_sys
->
p_tls
->
p_module
==
NULL
)
{
msg_Err
(
p_this
,
"cannot find TLS/SSL provider"
);
vlc_object_detach
(
p_sys
->
p_tls
);
vlc_object_destroy
(
p_sys
->
p_tls
);
p_sys
->
p_tls
=
NULL
;
return
VLC_EGENERIC
;
}
msg_Dbg
(
p_intf
,
"enablind TLS for HTTP interface (cert file: %s)"
,
msg_Dbg
(
p_intf
,
"enablind TLS for HTTP interface (cert file: %s)"
,
psz_cert
);
psz_cert
);
psz_pem
=
config_GetPsz
(
p_intf
,
"http-intf-key"
);
psz_pem
=
config_GetPsz
(
p_intf
,
"http-intf-key"
);
if
(
psz_pem
==
NULL
)
psz_pem
=
psz_cert
;
p_tls
=
tls_ServerCreate
(
p_
sys
->
p_tl
s
,
psz_cert
,
psz_pem
);
p_tls
=
tls_ServerCreate
(
p_
thi
s
,
psz_cert
,
psz_pem
);
if
(
p_tls
==
NULL
)
if
(
p_tls
==
NULL
)
{
{
msg_Err
(
p_intf
,
"TLS initialization error"
);
msg_Err
(
p_intf
,
"TLS initialization error"
);
...
@@ -288,7 +271,6 @@ static int Open( vlc_object_t *p_this )
...
@@ -288,7 +271,6 @@ static int Open( vlc_object_t *p_this )
}
}
else
else
{
{
p_sys
->
p_tls
=
NULL
;
p_tls
=
NULL
;
p_tls
=
NULL
;
if
(
i_port
<=
0
)
if
(
i_port
<=
0
)
i_port
=
8080
;
i_port
=
8080
;
...
@@ -415,13 +397,6 @@ void Close ( vlc_object_t *p_this )
...
@@ -415,13 +397,6 @@ void Close ( vlc_object_t *p_this )
free
(
p_sys
->
pp_files
);
free
(
p_sys
->
pp_files
);
}
}
httpd_HostDelete
(
p_sys
->
p_httpd_host
);
httpd_HostDelete
(
p_sys
->
p_httpd_host
);
/* TODO: do this in the httpd code to avoid code duplication */
if
(
p_sys
->
p_tls
!=
NULL
)
{
module_Unneed
(
p_sys
->
p_tls
,
p_sys
->
p_tls
->
p_module
);
vlc_object_detach
(
p_sys
->
p_tls
);
vlc_object_destroy
(
p_sys
->
p_tls
);
}
free
(
p_sys
);
free
(
p_sys
);
}
}
...
...
src/misc/tls.c
0 → 100644
View file @
4100226d
/*****************************************************************************
* tls.c
*****************************************************************************
* Copyright (C) 2004 VideoLAN
* $Id: httpd.c 8263 2004-07-24 09:06:58Z courmisch $
*
* Authors: Remi Denis-Courmont <courmisch@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include <stdlib.h>
#include <vlc/vlc.h>
#include "vlc_tls.h"
/*
* TODO:
* - client side stuff,
* - server-side client cert validation,
* - client-side server cert validation (?).
*/
/*****************************************************************************
* tls_ServerCreate:
*****************************************************************************
* Allocates a whole server's TLS credentials.
* Returns NULL on error.
*****************************************************************************/
tls_server_t
*
tls_ServerCreate
(
vlc_object_t
*
p_this
,
const
char
*
psz_cert
,
const
char
*
psz_key
)
{
tls_t
*
p_tls
;
tls_server_t
*
p_server
;
const
char
*
psz_pem
;
p_tls
=
vlc_object_create
(
p_this
,
VLC_OBJECT_TLS
);
vlc_object_attach
(
p_tls
,
p_this
);
p_tls
->
p_module
=
module_Need
(
p_tls
,
"tls"
,
0
,
0
);
if
(
p_tls
->
p_module
!=
NULL
)
{
if
(
psz_key
==
NULL
)
psz_key
=
psz_cert
;
p_server
=
__tls_ServerCreate
(
p_tls
,
psz_cert
,
psz_key
);
if
(
p_server
!=
NULL
)
{
msg_Dbg
(
p_this
,
"TLS/SSL provider initialized"
);
return
p_server
;
}
else
msg_Err
(
p_this
,
"TLS/SSL provider error"
);
module_Unneed
(
p_tls
,
p_tls
->
p_module
);
}
else
msg_Err
(
p_this
,
"TLS/SSL provider not found"
);
vlc_object_detach
(
p_tls
);
vlc_object_destroy
(
p_tls
);
return
NULL
;
}
/*****************************************************************************
* tls_ServerDelete:
*****************************************************************************
* Releases data allocated with tls_ServerCreate
*****************************************************************************/
void
tls_ServerDelete
(
tls_server_t
*
p_server
)
{
tls_t
*
p_tls
=
p_server
->
p_tls
;
__tls_ServerDelete
(
p_server
);
module_Unneed
(
p_tls
,
p_tls
->
p_module
);
vlc_object_detach
(
p_tls
);
vlc_object_destroy
(
p_tls
);
}
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