Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Marvin Scholz
Icecast-Server
Commits
d7cd12de
Commit
d7cd12de
authored
Nov 06, 2016
by
Philipp Schafft
🦁
Browse files
Cleanup: Wording and object names from SSL to TLS
parent
e513f09b
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/cfgfile.c
View file @
d7cd12de
...
...
@@ -1678,7 +1678,7 @@ static void _parse_listen_socket(xmlDocPtr doc,
}
else
if
(
xmlStrcmp
(
node
->
name
,
XMLSTR
(
"tls"
))
==
0
||
xmlStrcmp
(
node
->
name
,
XMLSTR
(
"ssl"
))
==
0
)
{
tmp
=
(
char
*
)
xmlNodeListGetString
(
doc
,
node
->
xmlChildrenNode
,
1
);
listener
->
ssl
=
util_str_to_bool
(
tmp
);
listener
->
tls
=
util_str_to_bool
(
tmp
);
if
(
tmp
)
xmlFree
(
tmp
);
}
else
if
(
xmlStrcmp
(
node
->
name
,
XMLSTR
(
"shoutcast-compat"
))
==
0
)
{
...
...
src/cfgfile.h
View file @
d7cd12de
...
...
@@ -172,7 +172,7 @@ typedef struct _listener_t {
char
*
bind_address
;
int
shoutcast_compat
;
char
*
shoutcast_mount
;
int
ssl
;
int
tls
;
}
listener_t
;
typedef
struct
ice_config_tag
{
...
...
src/client.c
View file @
d7cd12de
...
...
@@ -122,7 +122,7 @@ static inline void client_reuseconnection(client_t *client) {
client_destroy
(
client
);
if
(
reuse
==
ICECAST_REUSE_UPGRADETLS
)
connection_uses_
ssl
(
con
);
connection_uses_
tls
(
con
);
connection_queue
(
con
);
}
...
...
src/connection.c
View file @
d7cd12de
...
...
@@ -98,7 +98,7 @@ static int _initialized = 0;
static
volatile
client_queue_t
*
_req_queue
=
NULL
,
**
_req_queue_tail
=
&
_req_queue
;
static
volatile
client_queue_t
*
_con_queue
=
NULL
,
**
_con_queue_tail
=
&
_con_queue
;
static
int
ssl
_ok
;
static
int
tls
_ok
;
static
tls_ctx_t
*
tls_ctx
;
/* filtering client connection based on IP */
...
...
@@ -107,7 +107,7 @@ static matchfile_t *banned_ip, *allowed_ip;
rwlock_t
_source_shutdown_rwlock
;
static
void
_handle_connection
(
void
);
static
void
get_
ssl
_certificate
(
ice_config_t
*
config
);
static
void
get_
tls
_certificate
(
ice_config_t
*
config
);
void
connection_initialize
(
void
)
{
...
...
@@ -145,7 +145,7 @@ void connection_shutdown(void)
void
connection_reread_config
(
struct
ice_config_tag
*
config
)
{
get_
ssl
_certificate
(
config
);
get_
tls
_certificate
(
config
);
}
static
unsigned
long
_next_connection_id
(
void
)
...
...
@@ -161,9 +161,9 @@ static unsigned long _next_connection_id(void)
#ifdef ICECAST_CAP_TLS
static
void
get_
ssl
_certificate
(
ice_config_t
*
config
)
static
void
get_
tls
_certificate
(
ice_config_t
*
config
)
{
config
->
tls_ok
=
ssl
_ok
=
0
;
config
->
tls_ok
=
tls
_ok
=
0
;
tls_ctx_unref
(
tls_ctx
);
tls_ctx
=
tls_ctx_new
(
config
->
cert_file
,
config
->
cert_file
,
config
->
cipher_list
);
...
...
@@ -172,14 +172,14 @@ static void get_ssl_certificate(ice_config_t *config)
return
;
}
config
->
tls_ok
=
ssl
_ok
=
1
;
config
->
tls_ok
=
tls
_ok
=
1
;
}
/* handlers for reading and writing a connection_t when there is
ssl
/* handlers for reading and writing a connection_t when there is
TLS
* configured on the listening port
*/
static
int
connection_read_
ssl
(
connection_t
*
con
,
void
*
buf
,
size_t
len
)
static
int
connection_read_
tls
(
connection_t
*
con
,
void
*
buf
,
size_t
len
)
{
ssize_t
bytes
=
tls_read
(
con
->
tls
,
buf
,
len
);
...
...
@@ -191,7 +191,7 @@ static int connection_read_ssl(connection_t *con, void *buf, size_t len)
return
bytes
;
}
static
int
connection_send_
ssl
(
connection_t
*
con
,
const
void
*
buf
,
size_t
len
)
static
int
connection_send_
tls
(
connection_t
*
con
,
const
void
*
buf
,
size_t
len
)
{
ssize_t
bytes
=
tls_write
(
con
->
tls
,
buf
,
len
);
...
...
@@ -206,10 +206,10 @@ static int connection_send_ssl(connection_t *con, const void *buf, size_t len)
}
#else
/*
SSL
not compiled in, so at least log it */
static
void
get_
ssl
_certificate
(
ice_config_t
*
config
)
/*
TLS
not compiled in, so at least log it */
static
void
get_
tls
_certificate
(
ice_config_t
*
config
)
{
ssl
_ok
=
0
;
tls
_ok
=
0
;
ICECAST_LOG_INFO
(
"No TLS capability. "
"Rebuild Icecast with OpenSSL support to enable this."
);
}
...
...
@@ -259,17 +259,17 @@ connection_t *connection_create (sock_t sock, sock_t serversock, char *ip)
return
con
;
}
/* prepare connection for interacting over a
SSL
connection
/* prepare connection for interacting over a
TLS
connection
*/
void
connection_uses_
ssl
(
connection_t
*
con
)
void
connection_uses_
tls
(
connection_t
*
con
)
{
#ifdef ICECAST_CAP_TLS
if
(
con
->
tls
)
return
;
con
->
tlsmode
=
ICECAST_TLSMODE_RFC2818
;
con
->
read
=
connection_read_
ssl
;
con
->
send
=
connection_send_
ssl
;
con
->
read
=
connection_read_
tls
;
con
->
send
=
connection_send_
tls
;
con
->
tls
=
tls_new
(
tls_ctx
);
tls_set_incoming
(
con
->
tls
);
tls_set_socket
(
con
->
tls
,
con
->
sock
);
...
...
@@ -448,7 +448,7 @@ static void process_request_queue (void)
if
(
client
->
con
->
tlsmode
==
ICECAST_TLSMODE_AUTO
)
{
if
(
recv
(
client
->
con
->
sock
,
&
peak
,
1
,
MSG_PEEK
)
==
1
)
{
if
(
peak
==
0x16
)
{
/* TLS Record Protocol Content type 0x16 == Handshake */
connection_uses_
ssl
(
client
->
con
);
connection_uses_
tls
(
client
->
con
);
}
}
}
...
...
@@ -549,8 +549,8 @@ static client_queue_t *create_client_node(client_t *client)
if
(
listener
)
{
if
(
listener
->
shoutcast_compat
)
node
->
shoutcast
=
1
;
if
(
listener
->
ssl
&&
ssl
_ok
)
connection_uses_
ssl
(
client
->
con
);
if
(
listener
->
tls
&&
tls
_ok
)
connection_uses_
tls
(
client
->
con
);
if
(
listener
->
shoutcast_mount
)
node
->
shoutcast_mount
=
strdup
(
listener
->
shoutcast_mount
);
}
...
...
@@ -602,7 +602,7 @@ void connection_accept_loop(void)
int
duration
=
300
;
config
=
config_get_config
();
get_
ssl
_certificate
(
config
);
get_
tls
_certificate
(
config
);
config_release_config
();
while
(
global
.
running
==
ICECAST_RUNNING
)
{
...
...
src/connection.h
View file @
d7cd12de
...
...
@@ -68,7 +68,7 @@ void connection_close(connection_t *con);
connection_t
*
connection_create
(
sock_t
sock
,
sock_t
serversock
,
char
*
ip
);
int
connection_complete_source
(
struct
source_tag
*
source
,
int
response
);
void
connection_queue
(
connection_t
*
con
);
void
connection_uses_
ssl
(
connection_t
*
con
);
void
connection_uses_
tls
(
connection_t
*
con
);
ssize_t
connection_read_bytes
(
connection_t
*
con
,
void
*
buf
,
size_t
len
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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