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
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
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
spr0cketeer
Icecast-Server
Commits
b047537e
Commit
b047537e
authored
Oct 26, 2018
by
Philipp Schafft
🦁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update: Convert Icecast to use libigloo
parent
341f99be
Changes
49
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
49 changed files
with
641 additions
and
641 deletions
+641
-641
configure.ac
configure.ac
+5
-5
src/acl.c
src/acl.c
+3
-3
src/acl.h
src/acl.h
+2
-2
src/admin.c
src/admin.c
+20
-20
src/auth.c
src/auth.c
+17
-17
src/auth.h
src/auth.h
+5
-5
src/auth_htpasswd.c
src/auth_htpasswd.c
+15
-15
src/auth_url.c
src/auth_url.c
+20
-20
src/cfgfile.c
src/cfgfile.c
+3
-3
src/cfgfile.h
src/cfgfile.h
+4
-4
src/client.c
src/client.c
+11
-11
src/client.h
src/client.h
+5
-5
src/connection.c
src/connection.c
+68
-68
src/connection.h
src/connection.h
+5
-5
src/event.c
src/event.c
+8
-8
src/event.h
src/event.h
+3
-3
src/event_exec.c
src/event_exec.c
+2
-2
src/fastevent.c
src/fastevent.c
+3
-3
src/format.c
src/format.c
+8
-8
src/format.h
src/format.h
+1
-1
src/format_ebml.c
src/format_ebml.c
+1
-1
src/format_mp3.c
src/format_mp3.c
+8
-8
src/format_mp3.h
src/format_mp3.h
+1
-1
src/format_ogg.c
src/format_ogg.c
+3
-3
src/fserve.c
src/fserve.c
+36
-36
src/global.c
src/global.c
+6
-6
src/global.h
src/global.h
+4
-4
src/listensocket.c
src/listensocket.c
+29
-29
src/logging.c
src/logging.c
+25
-25
src/logging.h
src/logging.h
+2
-2
src/main.c
src/main.c
+31
-31
src/matchfile.c
src/matchfile.c
+9
-9
src/module.c
src/module.c
+15
-15
src/refobject.c
src/refobject.c
+2
-2
src/refobject.h
src/refobject.h
+2
-2
src/reportxml.c
src/reportxml.c
+9
-9
src/sighandler.c
src/sighandler.c
+3
-3
src/slave.c
src/slave.c
+39
-39
src/slave.h
src/slave.h
+1
-1
src/source.c
src/source.c
+97
-97
src/source.h
src/source.h
+8
-8
src/stats.c
src/stats.c
+67
-67
src/stats.h
src/stats.h
+3
-3
src/tls.c
src/tls.c
+2
-2
src/tls.h
src/tls.h
+2
-2
src/util.c
src/util.c
+5
-5
src/util.h
src/util.h
+3
-3
src/xslt.c
src/xslt.c
+6
-6
src/yp.c
src/yp.c
+14
-14
No files found.
configure.ac
View file @
b047537e
...
...
@@ -127,14 +127,14 @@ AC_TYPE_UID_T
dnl Checks for required libraries
dnl
dnl
permafrost
dnl
igloo
dnl
PKG_CHECK_MODULES([
PERMAFROST], [permafrost
], [], [
AC_MSG_ERROR([${
PERMAFROST_PKG_ERRORS}. permafrost
is required.])
PKG_CHECK_MODULES([
IGLOO], [igloo
], [], [
AC_MSG_ERROR([${
IGLOO_PKG_ERRORS}. igloo
is required.])
])
CFLAGS="${CFLAGS} ${
PERMAFROST
_CFLAGS}"
LIBS="${LIBS} ${
PERMAFROST
_LIBS}"
CFLAGS="${CFLAGS} ${
IGLOO
_CFLAGS}"
LIBS="${LIBS} ${
IGLOO
_LIBS}"
dnl
dnl libxml2
...
...
src/acl.c
View file @
b047537e
...
...
@@ -242,14 +242,14 @@ int acl_set_method_str__callback(acl_t *acl,
acl_policy_t
policy
,
const
char
*
str
)
{
httpp_request_type_e
method
;
igloo_
httpp_request_type_e
method
;
size_t
i
;
if
(
strcmp
(
str
,
"*"
)
==
0
)
{
for
(
i
=
0
;
i
<
(
sizeof
(
acl
->
method
)
/
sizeof
(
*
acl
->
method
));
i
++
)
acl
->
method
[
i
]
=
policy
;
}
else
{
method
=
httpp_str_to_method
(
str
);
method
=
igloo_
httpp_str_to_method
(
str
);
if
(
method
==
httpp_req_unknown
)
return
-
1
;
...
...
@@ -259,7 +259,7 @@ int acl_set_method_str__callback(acl_t *acl,
return
0
;
}
acl_policy_t
acl_test_method
(
acl_t
*
acl
,
httpp_request_type_e
method
)
acl_policy_t
acl_test_method
(
acl_t
*
acl
,
igloo_
httpp_request_type_e
method
)
{
if
(
!
acl
||
method
<
httpp_req_none
||
method
>
httpp_req_unknown
)
return
ACL_POLICY_ERROR
;
...
...
src/acl.h
View file @
b047537e
...
...
@@ -16,7 +16,7 @@
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <
permafrost
/httpp.h>
#include <
igloo
/httpp.h>
#include "icecasttypes.h"
#include "cfgfile.h"
...
...
@@ -44,7 +44,7 @@ int acl_set_ANY_str(acl_t * acl, acl_policy_t policy, const char * str, int (*ca
/* HTTP Method specific functions */
int
acl_set_method_str__callback
(
acl_t
*
acl
,
acl_policy_t
policy
,
const
char
*
str
);
#define acl_set_method_str(acl,policy,str) acl_set_ANY_str((acl), (policy), (str), acl_set_method_str__callback)
acl_policy_t
acl_test_method
(
acl_t
*
acl
,
httpp_request_type_e
method
);
acl_policy_t
acl_test_method
(
acl_t
*
acl
,
igloo_
httpp_request_type_e
method
);
/* admin/ interface specific functions */
int
acl_set_admin_str__callbck
(
acl_t
*
acl
,
acl_policy_t
policy
,
const
char
*
str
);
...
...
src/admin.c
View file @
b047537e
...
...
@@ -52,7 +52,7 @@
/* Helper macros */
#define COMMAND_REQUIRE(client,name,var) \
do { \
(var) = httpp_get_param((client)->parser, (name)); \
(var) =
igloo_
httpp_get_param((client)->parser, (name)); \
if((var) == NULL) { \
client_send_error_by_id(client, ICECAST_ERROR_ADMIN_MISSING_PARAMETER); \
return; \
...
...
@@ -60,7 +60,7 @@
} while(0);
#define COMMAND_OPTIONAL(client,name,var) \
(var) = httpp_get_param((client)->parser, (name))
(var) =
igloo_
httpp_get_param((client)->parser, (name))
#define FALLBACK_RAW_REQUEST "fallbacks"
#define FALLBACK_HTML_REQUEST "fallbacks.xsl"
...
...
@@ -329,7 +329,7 @@ xmlNodePtr admin_build_rootnode(xmlDocPtr doc, const char *name)
* doc even if the source is running */
xmlDocPtr
admin_build_sourcelist
(
const
char
*
mount
)
{
avl_node
*
node
;
igloo_
avl_node
*
node
;
source_t
*
source
;
xmlNodePtr
xmlnode
,
srcnode
;
xmlDocPtr
doc
;
...
...
@@ -344,12 +344,12 @@ xmlDocPtr admin_build_sourcelist(const char *mount)
xmlNewTextChild
(
xmlnode
,
NULL
,
XMLSTR
(
"current_source"
),
XMLSTR
(
mount
));
}
node
=
avl_get_first
(
global
.
source_tree
);
node
=
igloo_
avl_get_first
(
global
.
source_tree
);
while
(
node
)
{
source
=
(
source_t
*
)
node
->
key
;
if
(
mount
&&
strcmp
(
mount
,
source
->
mount
)
==
0
)
{
node
=
avl_get_next
(
node
);
node
=
igloo_
avl_get_next
(
node
);
continue
;
}
...
...
@@ -390,7 +390,7 @@ xmlDocPtr admin_build_sourcelist(const char *mount)
XMLSTR
(
source
->
format
->
contenttype
));
}
}
node
=
avl_get_next
(
node
);
node
=
igloo_
avl_get_next
(
node
);
}
return
(
doc
);
}
...
...
@@ -516,19 +516,19 @@ void admin_handle_request(client_t *client, const char *uri)
if
(
mount
!=
NULL
)
{
/* This is a mount request, handle it as such */
avl_tree_rlock
(
global
.
source_tree
);
igloo_
avl_tree_rlock
(
global
.
source_tree
);
source
=
source_find_mount_raw
(
mount
);
/* No Source found */
if
(
source
==
NULL
)
{
avl_tree_unlock
(
global
.
source_tree
);
igloo_
avl_tree_unlock
(
global
.
source_tree
);
ICECAST_LOG_WARN
(
"Admin command
\"
%H
\"
on non-existent source
\"
%H
\"
"
,
uri
,
mount
);
client_send_error_by_id
(
client
,
ICECAST_ERROR_ADMIN_SOURCE_DOES_NOT_EXIST
);
return
;
}
/* No Source running */
else
if
(
source
->
running
==
0
&&
source
->
on_demand
==
0
)
{
avl_tree_unlock
(
global
.
source_tree
);
igloo_
avl_tree_unlock
(
global
.
source_tree
);
ICECAST_LOG_INFO
(
"Received admin command
\"
%H
\"
on unavailable mount
\"
%H
\"
"
,
uri
,
mount
);
client_send_error_by_id
(
client
,
ICECAST_ERROR_ADMIN_SOURCE_IS_NOT_AVAILABLE
);
...
...
@@ -582,7 +582,7 @@ void admin_handle_request(client_t *client, const char *uri)
}
if
(
source
)
{
avl_tree_unlock
(
global
.
source_tree
);
igloo_
avl_tree_unlock
(
global
.
source_tree
);
}
return
;
}
...
...
@@ -695,15 +695,15 @@ static inline xmlNodePtr __add_listener(client_t *client,
xmlNewTextChild
(
node
,
NULL
,
XMLSTR
(
mode
==
OMODE_LEGACY
?
"IP"
:
"ip"
),
XMLSTR
(
client
->
con
->
ip
));
tmp
=
httpp_getvar
(
client
->
parser
,
"user-agent"
);
tmp
=
igloo_
httpp_getvar
(
client
->
parser
,
"user-agent"
);
if
(
tmp
)
xmlNewTextChild
(
node
,
NULL
,
XMLSTR
(
mode
==
OMODE_LEGACY
?
"UserAgent"
:
"useragent"
),
XMLSTR
(
tmp
));
tmp
=
httpp_getvar
(
client
->
parser
,
"referer"
);
tmp
=
igloo_
httpp_getvar
(
client
->
parser
,
"referer"
);
if
(
tmp
)
xmlNewTextChild
(
node
,
NULL
,
XMLSTR
(
"referer"
),
XMLSTR
(
tmp
));
tmp
=
httpp_getvar
(
client
->
parser
,
"host"
);
tmp
=
igloo_
httpp_getvar
(
client
->
parser
,
"host"
);
if
(
tmp
)
xmlNewTextChild
(
node
,
NULL
,
XMLSTR
(
"host"
),
XMLSTR
(
tmp
));
...
...
@@ -735,15 +735,15 @@ void admin_add_listeners_to_mount(source_t *source,
operation_mode
mode
)
{
time_t
now
=
time
(
NULL
);
avl_node
*
client_node
;
igloo_
avl_node
*
client_node
;
avl_tree_rlock
(
source
->
client_tree
);
client_node
=
avl_get_first
(
source
->
client_tree
);
igloo_
avl_tree_rlock
(
source
->
client_tree
);
client_node
=
igloo_
avl_get_first
(
source
->
client_tree
);
while
(
client_node
)
{
__add_listener
((
client_t
*
)
client_node
->
key
,
parent
,
now
,
mode
);
client_node
=
avl_get_next
(
client_node
);
client_node
=
igloo_
avl_get_next
(
client_node
);
}
avl_tree_unlock
(
source
->
client_tree
);
igloo_
avl_tree_unlock
(
source
->
client_tree
);
}
static
void
command_show_listeners
(
client_t
*
client
,
...
...
@@ -1200,9 +1200,9 @@ static void command_list_mounts(client_t *client, source_t *source, admin_format
fserve_add_client
(
client
,
NULL
);
}
else
{
xmlDocPtr
doc
;
avl_tree_rlock
(
global
.
source_tree
);
igloo_
avl_tree_rlock
(
global
.
source_tree
);
doc
=
admin_build_sourcelist
(
NULL
);
avl_tree_unlock
(
global
.
source_tree
);
igloo_
avl_tree_unlock
(
global
.
source_tree
);
admin_send_response
(
doc
,
client
,
response
,
LISTMOUNTS_HTML_REQUEST
);
...
...
src/auth.c
View file @
b047537e
...
...
@@ -24,7 +24,7 @@
#include <errno.h>
#include <stdio.h>
#include <
permafrost
/httpp.h>
#include <
igloo
/httpp.h>
#include "auth.h"
#include "source.h"
...
...
@@ -43,14 +43,14 @@
struct
auth_stack_tag
{
size_t
refcount
;
auth_t
*
auth
;
mutex_t
lock
;
igloo_
mutex_t
lock
;
auth_stack_t
*
next
;
};
/* code */
static
void
__handle_auth_client
(
auth_t
*
auth
,
auth_client
*
auth_user
);
static
mutex_t
_auth_lock
;
/* protects _current_id */
static
igloo_
mutex_t
_auth_lock
;
/* protects _current_id */
static
volatile
unsigned
long
_current_id
=
0
;
static
unsigned
long
_next_auth_id
(
void
)
{
...
...
@@ -116,7 +116,7 @@ static auth_client *auth_client_setup (client_t *client)
if
(
client
->
username
||
client
->
password
)
break
;
header
=
httpp_getvar
(
client
->
parser
,
"authorization"
);
header
=
igloo_
httpp_getvar
(
client
->
parser
,
"authorization"
);
if
(
header
==
NULL
)
break
;
...
...
@@ -201,7 +201,7 @@ void auth_release (auth_t *authenticator) {
if
(
authenticator
->
running
)
{
authenticator
->
running
=
0
;
thread_mutex_unlock
(
&
authenticator
->
lock
);
thread_join
(
authenticator
->
thread
);
igloo_
thread_join
(
authenticator
->
thread
);
thread_mutex_lock
(
&
authenticator
->
lock
);
}
...
...
@@ -214,7 +214,7 @@ void auth_release (auth_t *authenticator) {
if
(
authenticator
->
management_url
)
xmlFree
(
authenticator
->
management_url
);
thread_mutex_unlock
(
&
authenticator
->
lock
);
thread_mutex_destroy
(
&
authenticator
->
lock
);
igloo_
thread_mutex_destroy
(
&
authenticator
->
lock
);
if
(
authenticator
->
mount
)
free
(
authenticator
->
mount
);
acl_release
(
authenticator
->
acl
);
...
...
@@ -252,11 +252,11 @@ static void auth_client_free (auth_client *auth_user)
/* verify that the client is still connected. */
static
int
is_client_connected
(
client_t
*
client
)
{
/* As long as sock_active() is broken we need to disable this:
/* As long as
igloo_
sock_active() is broken we need to disable this:
int ret = 1;
if (client)
if (sock_active(client->con->sock) == 0)
if (
igloo_
sock_active(client->con->sock) == 0)
ret = 0;
return ret;
*/
...
...
@@ -433,7 +433,7 @@ static void *auth_run_thread (void *arg)
}
else
{
thread_mutex_unlock
(
&
auth
->
lock
);
}
thread_sleep
(
150000
);
igloo_
thread_sleep
(
150000
);
}
ICECAST_LOG_INFO
(
"Authentication thread shutting down"
);
return
NULL
;
...
...
@@ -715,7 +715,7 @@ static inline int auth_get_authenticator__filter_method(auth_t *auth, xmlNodePtr
while
(
cur
)
{
char
*
next
=
strstr
(
cur
,
","
);
httpp_request_type_e
idx
;
igloo_
httpp_request_type_e
idx
;
if
(
next
)
{
*
next
=
0
;
...
...
@@ -731,7 +731,7 @@ static inline int auth_get_authenticator__filter_method(auth_t *auth, xmlNodePtr
break
;
}
idx
=
httpp_str_to_method
(
cur
);
idx
=
igloo_
httpp_str_to_method
(
cur
);
if
(
idx
==
httpp_req_unknown
)
{
ICECAST_LOG_ERROR
(
"Can not add known method
\"
%H
\"
to role's %s"
,
cur
,
name
);
return
-
1
;
...
...
@@ -838,7 +838,7 @@ auth_t *auth_get_authenticator(xmlNodePtr node)
method_inited
=
1
;
while
(
cur
)
{
httpp_request_type_e
idx
;
igloo_
httpp_request_type_e
idx
;
next
=
strstr
(
cur
,
","
);
if
(
next
)
{
...
...
@@ -853,7 +853,7 @@ auth_t *auth_get_authenticator(xmlNodePtr node)
break
;
}
idx
=
httpp_str_to_method
(
cur
);
idx
=
igloo_
httpp_str_to_method
(
cur
);
if
(
idx
==
httpp_req_unknown
)
{
auth_release
(
auth
);
return
NULL
;
...
...
@@ -953,7 +953,7 @@ auth_t *auth_get_authenticator(xmlNodePtr node)
auth
->
tailp
=
&
auth
->
head
;
if
(
!
auth
->
immediate
)
{
auth
->
running
=
1
;
auth
->
thread
=
thread_create
(
"auth thread"
,
auth_run_thread
,
auth
,
THREAD_ATTACHED
);
auth
->
thread
=
thread_create
(
"auth thread"
,
auth_run_thread
,
auth
,
igloo_
THREAD_ATTACHED
);
}
}
}
...
...
@@ -1028,7 +1028,7 @@ void auth_initialise (void)
void
auth_shutdown
(
void
)
{
ICECAST_LOG_INFO
(
"Auth shutdown"
);
thread_mutex_destroy
(
&
_auth_lock
);
igloo_
thread_mutex_destroy
(
&
_auth_lock
);
}
/* authstack functions */
...
...
@@ -1070,7 +1070,7 @@ void auth_stack_release(auth_stack_t *stack) {
auth_release
(
stack
->
auth
);
auth_stack_release
(
stack
->
next
);
thread_mutex_destroy
(
&
stack
->
lock
);
igloo_
thread_mutex_destroy
(
&
stack
->
lock
);
free
(
stack
);
}
...
...
@@ -1186,7 +1186,7 @@ auth_t *auth_stack_getbyid(auth_stack_t *stack, unsigned long id) {
}
acl_t
*
auth_stack_get_anonymous_acl
(
auth_stack_t
*
stack
,
httpp_request_type_e
method
)
{
acl_t
*
auth_stack_get_anonymous_acl
(
auth_stack_t
*
stack
,
igloo_
httpp_request_type_e
method
)
{
acl_t
*
ret
=
NULL
;
if
(
!
stack
||
method
<
0
||
method
>
httpp_req_unknown
)
...
...
src/auth.h
View file @
b047537e
...
...
@@ -22,8 +22,8 @@
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <
permafrost
/thread.h>
#include <
permafrost
/httpp.h>
#include <
igloo
/thread.h>
#include <
igloo
/httpp.h>
#include "icecasttypes.h"
#include "cfgfile.h"
...
...
@@ -142,11 +142,11 @@ struct auth_tag
auth_result
(
*
deleteuser
)(
auth_t
*
auth
,
const
char
*
username
);
auth_result
(
*
listuser
)(
auth_t
*
auth
,
xmlNodePtr
srcnode
);
mutex_t
lock
;
igloo_
mutex_t
lock
;
int
running
;
size_t
refcount
;
thread_type
*
thread
;
igloo_
thread_type
*
thread
;
/* per-auth queue for clients */
auth_client
*
head
,
**
tailp
;
...
...
@@ -200,6 +200,6 @@ int auth_stack_push(auth_stack_t **stack, auth_t *auth);
int
auth_stack_append
(
auth_stack_t
*
stack
,
auth_stack_t
*
tail
);
auth_t
*
auth_stack_get
(
auth_stack_t
*
stack
);
auth_t
*
auth_stack_getbyid
(
auth_stack_t
*
stack
,
unsigned
long
id
);
acl_t
*
auth_stack_get_anonymous_acl
(
auth_stack_t
*
stack
,
httpp_request_type_e
method
);
acl_t
*
auth_stack_get_anonymous_acl
(
auth_stack_t
*
stack
,
igloo_
httpp_request_type_e
method
);
#endif
src/auth_htpasswd.c
View file @
b047537e
...
...
@@ -26,7 +26,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <
permafrost
/httpp.h>
#include <
igloo
/httpp.h>
#include "auth.h"
#include "source.h"
...
...
@@ -53,8 +53,8 @@ typedef struct {
typedef
struct
{
char
*
filename
;
rwlock_t
file_rwlock
;
avl_tree
*
users
;
igloo_
rwlock_t
file_rwlock
;
igloo_
avl_tree
*
users
;
time_t
mtime
;
}
htpasswd_auth_state
;
...
...
@@ -63,8 +63,8 @@ static void htpasswd_clear(auth_t *self)
htpasswd_auth_state
*
state
=
self
->
state
;
free
(
state
->
filename
);
if
(
state
->
users
)
avl_tree_free
(
state
->
users
,
_free_user
);
thread_rwlock_destroy
(
&
state
->
file_rwlock
);
igloo_
avl_tree_free
(
state
->
users
,
_free_user
);
igloo_
thread_rwlock_destroy
(
&
state
->
file_rwlock
);
free
(
state
);
}
...
...
@@ -109,7 +109,7 @@ static int _free_user(void *key)
static
void
htpasswd_recheckfile
(
htpasswd_auth_state
*
htpasswd
)
{
FILE
*
passwdfile
;
avl_tree
*
new_users
;
igloo_
avl_tree
*
new_users
;
int
num
=
0
;
struct
stat
file_stat
;
char
*
sep
;
...
...
@@ -123,7 +123,7 @@ static void htpasswd_recheckfile(htpasswd_auth_state *htpasswd)
/* Create a dummy users tree for things to use later */
thread_rwlock_wlock
(
&
htpasswd
->
file_rwlock
);
if
(
!
htpasswd
->
users
)
htpasswd
->
users
=
avl_tree_new
(
compare_users
,
NULL
);
htpasswd
->
users
=
igloo_
avl_tree_new
(
compare_users
,
NULL
);
thread_rwlock_unlock
(
&
htpasswd
->
file_rwlock
);
return
;
...
...
@@ -142,7 +142,7 @@ static void htpasswd_recheckfile(htpasswd_auth_state *htpasswd)
}
htpasswd
->
mtime
=
file_stat
.
st_mtime
;
new_users
=
avl_tree_new
(
compare_users
,
NULL
);
new_users
=
igloo_
avl_tree_new
(
compare_users
,
NULL
);
while
(
get_line
(
passwdfile
,
line
,
MAX_LINE_LEN
))
{
int
len
;
...
...
@@ -163,13 +163,13 @@ static void htpasswd_recheckfile(htpasswd_auth_state *htpasswd)
*
sep
=
0
;
memcpy
(
entry
->
name
,
line
,
len
);
entry
->
pass
=
entry
->
name
+
(
sep
-
line
)
+
1
;
avl_insert
(
new_users
,
entry
);
igloo_
avl_insert
(
new_users
,
entry
);
}
fclose
(
passwdfile
);
thread_rwlock_wlock
(
&
htpasswd
->
file_rwlock
);
if
(
htpasswd
->
users
)
avl_tree_free
(
htpasswd
->
users
,
_free_user
);
igloo_
avl_tree_free
(
htpasswd
->
users
,
_free_user
);
htpasswd
->
users
=
new_users
;
thread_rwlock_unlock
(
&
htpasswd
->
file_rwlock
);
}
...
...
@@ -199,7 +199,7 @@ static auth_result htpasswd_auth (auth_client *auth_user)
thread_rwlock_rlock
(
&
htpasswd
->
file_rwlock
);
entry
.
name
=
client
->
username
;
if
(
avl_get_by_key
(
htpasswd
->
users
,
&
entry
,
&
result
)
==
0
)
{
if
(
igloo_
avl_get_by_key
(
htpasswd
->
users
,
&
entry
,
&
result
)
==
0
)
{
htpasswd_user
*
found
=
result
;
char
*
hashed_pw
;
...
...
@@ -278,7 +278,7 @@ static auth_result htpasswd_adduser (auth_t *auth, const char *username, const c
thread_rwlock_wlock
(
&
state
->
file_rwlock
);
entry
.
name
=
(
char
*
)
username
;
if
(
avl_get_by_key
(
state
->
users
,
&
entry
,
&
result
)
==
0
)
{
if
(
igloo_
avl_get_by_key
(
state
->
users
,
&
entry
,
&
result
)
==
0
)
{
thread_rwlock_unlock
(
&
state
->
file_rwlock
);
return
AUTH_USEREXISTS
;
}
...
...
@@ -406,7 +406,7 @@ static auth_result htpasswd_userlist(auth_t *auth, xmlNodePtr srcnode)
{
htpasswd_auth_state
*
state
;
xmlNodePtr
newnode
;
avl_node
*
node
;
igloo_
avl_node
*
node
;
state
=
auth
->
state
;
...
...
@@ -423,12 +423,12 @@ static auth_result htpasswd_userlist(auth_t *auth, xmlNodePtr srcnode)
}
thread_rwlock_rlock
(
&
state
->
file_rwlock
);
node
=
avl_get_first
(
state
->
users
);
node
=
igloo_
avl_get_first
(
state
->
users
);
while
(
node
)
{
htpasswd_user
*
user
=
(
htpasswd_user
*
)
node
->
key
;
newnode
=
xmlNewChild
(
srcnode
,
NULL
,
XMLSTR
(
"user"
),
NULL
);
xmlNewTextChild
(
newnode
,
NULL
,
XMLSTR
(
"username"
),
XMLSTR
(
user
->
name
));
node
=
avl_get_next
(
node
);
node
=
igloo_
avl_get_next
(
node
);
}
thread_rwlock_unlock
(
&
state
->
file_rwlock
);
...
...
src/auth_url.c
View file @
b047537e
...
...
@@ -75,7 +75,7 @@
#include "cfgfile.h"
#include "connection.h"
#include <
permafrost
/httpp.h>
#include <
igloo
/httpp.h>
#include "logging.h"
#define CATMODULE "auth_url"
...
...
@@ -121,7 +121,7 @@ typedef struct {
typedef
struct
{
char
*
all_headers
;
size_t
all_headers_len
;
http_parser_t
*
parser
;
igloo_
http_parser_t
*
parser
;
}
auth_user_url_t
;
static
inline
const
char
*
__str_or_default
(
const
char
*
str
,
const
char
*
def
)
...
...
@@ -187,15 +187,15 @@ static void handle_returned_header__complete(auth_client *auth_user)
if
(
au_url
->
parser
)
return
;
au_url
->
parser
=
httpp_create_parser
();
httpp_initialize
(
au_url
->
parser
,
NULL
);
au_url
->
parser
=
igloo_
httpp_create_parser
();
igloo_
httpp_initialize
(
au_url
->
parser
,
NULL
);
if
(
!
httpp_parse_response
(
au_url
->
parser
,
au_url
->
all_headers
,
au_url
->
all_headers_len
,
NULL
))
{
if
(
!
igloo_
httpp_parse_response
(
au_url
->
parser
,
au_url
->
all_headers
,
au_url
->
all_headers_len
,
NULL
))
{
ICECAST_LOG_ERROR
(
"Can not parse auth backend reply."
);
return
;
}
tmp
=
httpp_getvar
(
au_url
->
parser
,
HTTPP_VAR_ERROR_CODE
);
tmp
=
igloo_httpp_getvar
(
au_url
->
parser
,
igloo_
HTTPP_VAR_ERROR_CODE
);
if
(
tmp
[
0
]
==
'2'
)
{
ICECAST_LOG_DEBUG
(
"Got final status: %#H"
,
tmp
);
}
else
{
...
...
@@ -207,14 +207,14 @@ static void handle_returned_header__complete(auth_client *auth_user)
}
if
(
url
->
header_auth
)
{
tmp
=
httpp_getvar
(
au_url
->
parser
,
url
->
header_auth
);
tmp
=
igloo_
httpp_getvar
(
au_url
->
parser
,
url
->
header_auth
);
if
(
tmp
)
{
url
->
result
=
auth_str2result
(
tmp
);
}
}
if
(
url
->
header_timelimit
)
{
tmp
=
httpp_getvar
(
au_url
->
parser
,
url
->
header_timelimit
);
tmp
=
igloo_
httpp_getvar
(
au_url
->
parser
,
url
->
header_timelimit
);
if
(
tmp
)
{
long
long
int
ret
;
char
*
endptr
;
...
...
@@ -229,8 +229,8 @@ static void handle_returned_header__complete(auth_client *auth_user)
}
}
action
=
httpp_getvar
(
au_url
->
parser
,
__str_or_default
(
url
->
header_alter_action
,
DEFAULT_HEADER_NEW_ALTER_ACTION
));
argument
=
httpp_getvar
(
au_url
->
parser
,
__str_or_default
(
url
->
header_alter_argument
,
DEFAULT_HEADER_NEW_ALTER_ARGUMENT
));
action
=
igloo_
httpp_getvar
(
au_url
->
parser
,
__str_or_default
(
url
->
header_alter_action
,
DEFAULT_HEADER_NEW_ALTER_ACTION
));
argument
=
igloo_
httpp_getvar
(
au_url
->
parser
,
__str_or_default
(
url
->
header_alter_argument
,
DEFAULT_HEADER_NEW_ALTER_ARGUMENT
));
if
(
action
&&
argument
)
{
if
(
auth_alter_client
(
auth_user
->
client
->
auth
,
auth_user
,
auth_str2alter
(
action
),
argument
)
!=
0
)
{
...
...
@@ -241,11 +241,11 @@ static void handle_returned_header__complete(auth_client *auth_user)
}
if
(
url
->
header_message
)
{
tmp
=
httpp_getvar
(
au_url
->
parser
,
url
->
header_message
);
tmp
=
igloo_
httpp_getvar
(
au_url
->
parser
,
url
->
header_message
);
}
else
{
tmp
=
httpp_getvar
(
au_url
->
parser
,
DEFAULT_HEADER_NEW_MESSAGE
);
tmp
=
igloo_
httpp_getvar
(
au_url
->
parser
,
DEFAULT_HEADER_NEW_MESSAGE
);
if
(
!
tmp
)
tmp
=
httpp_getvar
(
au_url
->
parser
,
DEFAULT_HEADER_OLD_MESSAGE
);
tmp
=
igloo_
httpp_getvar
(
au_url
->
parser
,
DEFAULT_HEADER_OLD_MESSAGE
);
}
if
(
tmp
)
{
snprintf
(
url
->
errormsg
,
sizeof
(
url
->
errormsg
),
"%s"
,
tmp
);
...
...
@@ -354,7 +354,7 @@ static auth_result url_remove_client(auth_client *auth_user)
port
=
config
->
port
;
config_release_config
();
agent
=
httpp_getvar
(
client
->
parser
,
"user-agent"
);
agent
=
igloo_
httpp_getvar
(
client
->
parser
,
"user-agent"
);
if
(
agent
)
{
user_agent
=
util_url_escape
(
agent
);
}
else
{
...
...
@@ -374,9 +374,9 @@ static auth_result url_remove_client(auth_client *auth_user)
}
/* get the full uri (with query params if available) */
mountreq
=
httpp_getvar
(
client
->
parser
,
HTTPP_VAR_RAWURI
);
mountreq
=
igloo_httpp_getvar
(
client
->
parser
,
igloo_
HTTPP_VAR_RAWURI
);
if
(
mountreq
==
NULL
)
mountreq
=
httpp_getvar
(
client
->
parser
,
HTTPP_VAR_URI
);
mountreq
=
igloo_httpp_getvar
(
client
->
parser
,
igloo_
HTTPP_VAR_URI
);
mount
=
util_url_escape
(
mountreq
);
ipaddr
=
util_url_escape
(
client
->
con
->
ip
);
...
...
@@ -467,7 +467,7 @@ static auth_result url_add_client(auth_client *auth_user)
port
=
config
->
port
;
config_release_config
();
agent
=
httpp_getvar
(
client
->
parser
,
"user-agent"
);
agent
=
igloo_
httpp_getvar
(
client
->
parser
,
"user-agent"
);
if
(
agent
)
{
user_agent
=
util_url_escape
(
agent
);
}
else
{
...
...
@@ -487,9 +487,9 @@ static auth_result url_add_client(auth_client *auth_user)
}
/* get the full uri (with query params if available) */
mountreq
=
httpp_getvar
(
client
->
parser
,
HTTPP_VAR_RAWURI
);
mountreq
=
igloo_httpp_getvar
(
client
->
parser
,
igloo_
HTTPP_VAR_RAWURI
);
if
(
mountreq
==
NULL
)
mountreq
=
httpp_getvar
(
client
->
parser
,
HTTPP_VAR_URI
);
mountreq
=
igloo_httpp_getvar
(
client
->
parser
,
igloo_
HTTPP_VAR_URI
);
mount
=
util_url_escape
(
mountreq
);
ipaddr
=
util_url_escape
(
client
->
con
->
ip
);
...
...
@@ -526,7 +526,7 @@ static auth_result url_add_client(auth_client *auth_user)
next_header
++
;
}
header_val
=
httpp_getvar
(
client
->
parser
,
cur_header
);
header_val
=
igloo_
httpp_getvar
(
client
->
parser
,
cur_header
);
if
(
header_val
)
{
size_t
left
=
sizeof
(
post
)
-
post_offset
;
int
ret
;
...
...
src/cfgfile.c
View file @
b047537e
...
...
@@ -26,7 +26,7 @@
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
#include <
permafrost
/thread.h>
#include <
igloo
/thread.h>
#include "cfgfile.h"
#include "global.h"
...
...
@@ -213,8 +213,8 @@ static void create_locks(void)
static
void
release_locks
(
void
)
{
thread_mutex_destroy
(
&
_locks
.
relay_lock
);
thread_rwlock_destroy
(
&
_locks
.
config_lock
);
igloo_
thread_mutex_destroy
(
&
_locks
.
relay_lock
);
igloo_
thread_rwlock_destroy
(
&
_locks
.
config_lock
);
}
void
config_initialize
(
void
)
...
...
src/cfgfile.h
View file @
b047537e
...
...
@@ -23,8 +23,8 @@
#define MAX_YP_DIRECTORIES 25
#include <libxml/tree.h>
#include <
permafrost
/thread.h>
#include <
permafrost
/avl.h>
#include <
igloo
/thread.h>
#include <
igloo
/avl.h>
#include "icecasttypes.h"
#include "compat.h"
...
...
@@ -279,8 +279,8 @@ struct ice_config_tag {
};
typedef
struct
{