mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2025-02-02 15:07:36 -05:00
Merge branch 'master' of ssh://git.xiph.org/icecast-server
This commit is contained in:
commit
01c896cf30
@ -263,7 +263,7 @@ static void *auth_run_thread (void *arg)
|
|||||||
thread_mutex_unlock (&auth->lock);
|
thread_mutex_unlock (&auth->lock);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ICECAST_LOG_DEBUG("%d client(s) pending on %s", auth->pending_count, auth->mount);
|
ICECAST_LOG_DEBUG("%d client(s) pending on %s (role %s)", auth->pending_count, auth->mount, auth->role);
|
||||||
auth->head = auth_user->next;
|
auth->head = auth_user->next;
|
||||||
if (auth->head == NULL)
|
if (auth->head == NULL)
|
||||||
auth->tailp = &auth->head;
|
auth->tailp = &auth->head;
|
||||||
@ -308,9 +308,11 @@ static void *auth_run_thread (void *arg)
|
|||||||
static void auth_add_client(auth_t *auth, client_t *client, void (*on_no_match)(client_t *client, void (*on_result)(client_t *client, void *userdata, auth_result result), void *userdata), void (*on_result)(client_t *client, void *userdata, auth_result result), void *userdata) {
|
static void auth_add_client(auth_t *auth, client_t *client, void (*on_no_match)(client_t *client, void (*on_result)(client_t *client, void *userdata, auth_result result), void *userdata), void (*on_result)(client_t *client, void *userdata, auth_result result), void *userdata) {
|
||||||
auth_client *auth_user;
|
auth_client *auth_user;
|
||||||
|
|
||||||
|
ICECAST_LOG_DEBUG("Trying to add client %p to auth %p's (role %s) queue.", client, auth, auth->role);
|
||||||
|
|
||||||
/* TODO: replace that magic number */
|
/* TODO: replace that magic number */
|
||||||
if (auth->pending_count > 100) {
|
if (auth->pending_count > 100) {
|
||||||
ICECAST_LOG_WARN("too many clients awaiting authentication");
|
ICECAST_LOG_WARN("too many clients awaiting authentication on auth %p", auth);
|
||||||
client_send_error(client, 403, 1, "busy, please try again later");
|
client_send_error(client, 403, 1, "busy, please try again later");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -215,7 +215,7 @@ static void __append_old_style_urlauth(auth_stack_t **stack, const char *client_
|
|||||||
xmlNodePtr role;
|
xmlNodePtr role;
|
||||||
auth_t *auth;
|
auth_t *auth;
|
||||||
|
|
||||||
if (!stack || !client_add || !!client_remove)
|
if (!stack || (!client_add && !client_remove))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
role = xmlNewNode(NULL, XMLSTR("role"));
|
role = xmlNewNode(NULL, XMLSTR("role"));
|
||||||
@ -248,8 +248,13 @@ static void __append_old_style_urlauth(auth_stack_t **stack, const char *client_
|
|||||||
__append_option_tag(role, "header_prefix", header_prefix);
|
__append_option_tag(role, "header_prefix", header_prefix);
|
||||||
|
|
||||||
auth = auth_get_authenticator(role);
|
auth = auth_get_authenticator(role);
|
||||||
auth_stack_push(stack, auth);
|
if (auth) {
|
||||||
auth_release(auth);
|
auth_stack_push(stack, auth);
|
||||||
|
auth_release(auth);
|
||||||
|
ICECAST_LOG_DEBUG("Pushed authenticator %p on stack %p.", auth, stack);
|
||||||
|
} else {
|
||||||
|
ICECAST_LOG_DEBUG("Failed to set up authenticator.");
|
||||||
|
}
|
||||||
|
|
||||||
xmlFreeNode(role);
|
xmlFreeNode(role);
|
||||||
}
|
}
|
||||||
@ -890,9 +895,9 @@ static void _parse_mount_oldstyle_authentication(mount_proxy *mount, xmlNodePtr
|
|||||||
child = node->xmlChildrenNode;
|
child = node->xmlChildrenNode;
|
||||||
|
|
||||||
while (child) {
|
while (child) {
|
||||||
if (xmlStrcmp(node->name, XMLSTR("option")) == 0) {
|
if (xmlStrcmp(child->name, XMLSTR("option")) == 0) {
|
||||||
name = (char *)xmlGetProp(node, XMLSTR("name"));
|
name = (char *)xmlGetProp(child, XMLSTR("name"));
|
||||||
value = (char *)xmlGetProp(node, XMLSTR("value"));
|
value = (char *)xmlGetProp(child, XMLSTR("value"));
|
||||||
if (name && value) {
|
if (name && value) {
|
||||||
if (strcmp(name, "allow_duplicate_users") == 0) {
|
if (strcmp(name, "allow_duplicate_users") == 0) {
|
||||||
allow_duplicate_users = util_str_to_bool(value);
|
allow_duplicate_users = util_str_to_bool(value);
|
||||||
@ -942,9 +947,9 @@ static void _parse_mount_oldstyle_authentication(mount_proxy *mount, xmlNodePtr
|
|||||||
|
|
||||||
child = node->xmlChildrenNode;
|
child = node->xmlChildrenNode;
|
||||||
while (child) {
|
while (child) {
|
||||||
if (xmlStrcmp(node->name, XMLSTR("option")) == 0) {
|
if (xmlStrcmp(child->name, XMLSTR("option")) == 0) {
|
||||||
name = (char *)xmlGetProp(node, XMLSTR("name"));
|
name = (char *)xmlGetProp(child, XMLSTR("name"));
|
||||||
value = (char *)xmlGetProp(node, XMLSTR("value"));
|
value = (char *)xmlGetProp(child, XMLSTR("value"));
|
||||||
|
|
||||||
if (name && value) {
|
if (name && value) {
|
||||||
if (strcmp(name, "mount_add") == 0) {
|
if (strcmp(name, "mount_add") == 0) {
|
||||||
@ -1248,6 +1253,8 @@ static void _parse_mount(xmlDocPtr doc, xmlNodePtr node,
|
|||||||
auth_stack_release(mount->authstack);
|
auth_stack_release(mount->authstack);
|
||||||
auth_stack_addref(mount->authstack = authstack);
|
auth_stack_addref(mount->authstack = authstack);
|
||||||
|
|
||||||
|
ICECAST_LOG_DEBUG("Mount %p (mountpoint %s) has %sactive roles on authstack.", mount, mount->mountname, authstack ? "" : "no ");
|
||||||
|
|
||||||
/* make sure we have at least the mountpoint name */
|
/* make sure we have at least the mountpoint name */
|
||||||
if (mount->mountname == NULL && mount->mounttype != MOUNT_TYPE_DEFAULT)
|
if (mount->mountname == NULL && mount->mounttype != MOUNT_TYPE_DEFAULT)
|
||||||
{
|
{
|
||||||
|
@ -946,8 +946,8 @@ static inline void source_startup (client_t *client, const char *uri)
|
|||||||
/* only called for native icecast source clients */
|
/* only called for native icecast source clients */
|
||||||
static void _handle_source_request (client_t *client, const char *uri)
|
static void _handle_source_request (client_t *client, const char *uri)
|
||||||
{
|
{
|
||||||
ICECAST_LOG_INFO("Source logging in at mountpoint \"%s\" from %s",
|
ICECAST_LOG_INFO("Source logging in at mountpoint \"%s\" from %s as role %s",
|
||||||
uri, client->con->ip);
|
uri, client->con->ip, client->role);
|
||||||
|
|
||||||
if (uri[0] != '/')
|
if (uri[0] != '/')
|
||||||
{
|
{
|
||||||
@ -1342,6 +1342,7 @@ static void _handle_authentication_global(client_t *client, void *uri, auth_resu
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ICECAST_LOG_DEBUG("Trying global authenticators for client %p.", client);
|
||||||
config = config_get_config();
|
config = config_get_config();
|
||||||
auth_stack_add_client(config->authstack, client, _handle_authed_client, uri);
|
auth_stack_add_client(config->authstack, client, _handle_authed_client, uri);
|
||||||
config_release_config();
|
config_release_config();
|
||||||
@ -1391,10 +1392,12 @@ static void _handle_authentication_mount_default(client_t *client, void *uri, au
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ICECAST_LOG_DEBUG("Trying <mount type=\"default\"> specific authenticators for client %p.", client);
|
||||||
_handle_authentication_mount_generic(client, uri, MOUNT_TYPE_DEFAULT, _handle_authentication_global);
|
_handle_authentication_mount_generic(client, uri, MOUNT_TYPE_DEFAULT, _handle_authentication_global);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _handle_authentication_mount_normal(client_t *client, char *uri) {
|
static void _handle_authentication_mount_normal(client_t *client, char *uri) {
|
||||||
|
ICECAST_LOG_DEBUG("Trying <mount type=\"normal\"> specific authenticators for client %p.", client);
|
||||||
_handle_authentication_mount_generic(client, uri, MOUNT_TYPE_NORMAL, _handle_authentication_mount_default);
|
_handle_authentication_mount_generic(client, uri, MOUNT_TYPE_NORMAL, _handle_authentication_mount_default);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
14
src/main.c
14
src/main.c
@ -227,15 +227,15 @@ static int _start_logging(void)
|
|||||||
|
|
||||||
ice_config_t *config = config_get_config_unlocked();
|
ice_config_t *config = config_get_config_unlocked();
|
||||||
|
|
||||||
if(strcmp(config->error_log, "-")) {
|
if(strcmp(config->error_log, "-") == 0) {
|
||||||
|
/* this is already in place because of _start_logging_stdout() */
|
||||||
|
} else {
|
||||||
snprintf(fn_error, FILENAME_MAX, "%s%s%s", config->log_dir, PATH_SEPARATOR, config->error_log);
|
snprintf(fn_error, FILENAME_MAX, "%s%s%s", config->log_dir, PATH_SEPARATOR, config->error_log);
|
||||||
errorlog = log_open(fn_error);
|
errorlog = log_open(fn_error);
|
||||||
log_to_stderr = 0;
|
log_to_stderr = 0;
|
||||||
if (config->logsize)
|
if (config->logsize)
|
||||||
log_set_trigger (errorlog, config->logsize);
|
log_set_trigger (errorlog, config->logsize);
|
||||||
log_set_archive_timestamp(errorlog, config->logarchive);
|
log_set_archive_timestamp(errorlog, config->logarchive);
|
||||||
} else {
|
|
||||||
/* this is already in place because of _start_logging_stdout() */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errorlog < 0) {
|
if (errorlog < 0) {
|
||||||
@ -248,16 +248,16 @@ static int _start_logging(void)
|
|||||||
}
|
}
|
||||||
log_set_level(errorlog, config->loglevel);
|
log_set_level(errorlog, config->loglevel);
|
||||||
|
|
||||||
if(strcmp(config->access_log, "-")) {
|
if(strcmp(config->access_log, "-") == 0) {
|
||||||
|
accesslog = log_open_file(stderr);
|
||||||
|
log_to_stderr = 1;
|
||||||
|
} else {
|
||||||
snprintf(fn_access, FILENAME_MAX, "%s%s%s", config->log_dir, PATH_SEPARATOR, config->access_log);
|
snprintf(fn_access, FILENAME_MAX, "%s%s%s", config->log_dir, PATH_SEPARATOR, config->access_log);
|
||||||
accesslog = log_open(fn_access);
|
accesslog = log_open(fn_access);
|
||||||
log_to_stderr = 0;
|
log_to_stderr = 0;
|
||||||
if (config->logsize)
|
if (config->logsize)
|
||||||
log_set_trigger (accesslog, config->logsize);
|
log_set_trigger (accesslog, config->logsize);
|
||||||
log_set_archive_timestamp(accesslog, config->logarchive);
|
log_set_archive_timestamp(accesslog, config->logarchive);
|
||||||
} else {
|
|
||||||
accesslog = log_open_file(stderr);
|
|
||||||
log_to_stderr = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (accesslog < 0) {
|
if (accesslog < 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user