Commit 01c896cf authored by Thomas B. Rücker's avatar Thomas B. Rücker 😊

Merge branch 'master' of ssh://git.xiph.org/icecast-server

parents 0d9b17e6 fad405a4
......@@ -263,7 +263,7 @@ static void *auth_run_thread (void *arg)
thread_mutex_unlock (&auth->lock);
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;
if (auth->head == NULL)
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) {
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 */
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");
return;
}
......
......@@ -215,7 +215,7 @@ static void __append_old_style_urlauth(auth_stack_t **stack, const char *client_
xmlNodePtr role;
auth_t *auth;
if (!stack || !client_add || !!client_remove)
if (!stack || (!client_add && !client_remove))
return;
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);
auth = auth_get_authenticator(role);
auth_stack_push(stack, auth);
auth_release(auth);
if (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);
}
......@@ -890,9 +895,9 @@ static void _parse_mount_oldstyle_authentication(mount_proxy *mount, xmlNodePtr
child = node->xmlChildrenNode;
while (child) {
if (xmlStrcmp(node->name, XMLSTR("option")) == 0) {
name = (char *)xmlGetProp(node, XMLSTR("name"));
value = (char *)xmlGetProp(node, XMLSTR("value"));
if (xmlStrcmp(child->name, XMLSTR("option")) == 0) {
name = (char *)xmlGetProp(child, XMLSTR("name"));
value = (char *)xmlGetProp(child, XMLSTR("value"));
if (name && value) {
if (strcmp(name, "allow_duplicate_users") == 0) {
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;
while (child) {
if (xmlStrcmp(node->name, XMLSTR("option")) == 0) {
name = (char *)xmlGetProp(node, XMLSTR("name"));
value = (char *)xmlGetProp(node, XMLSTR("value"));
if (xmlStrcmp(child->name, XMLSTR("option")) == 0) {
name = (char *)xmlGetProp(child, XMLSTR("name"));
value = (char *)xmlGetProp(child, XMLSTR("value"));
if (name && value) {
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_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 */
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 */
static void _handle_source_request (client_t *client, const char *uri)
{
ICECAST_LOG_INFO("Source logging in at mountpoint \"%s\" from %s",
uri, client->con->ip);
ICECAST_LOG_INFO("Source logging in at mountpoint \"%s\" from %s as role %s",
uri, client->con->ip, client->role);
if (uri[0] != '/')
{
......@@ -1342,6 +1342,7 @@ static void _handle_authentication_global(client_t *client, void *uri, auth_resu
return;
}
ICECAST_LOG_DEBUG("Trying global authenticators for client %p.", client);
config = config_get_config();
auth_stack_add_client(config->authstack, client, _handle_authed_client, uri);
config_release_config();
......@@ -1391,10 +1392,12 @@ static void _handle_authentication_mount_default(client_t *client, void *uri, au
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);
}
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);
}
......
......@@ -227,15 +227,15 @@ static int _start_logging(void)
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);
errorlog = log_open(fn_error);
log_to_stderr = 0;
if (config->logsize)
log_set_trigger (errorlog, config->logsize);
log_set_archive_timestamp(errorlog, config->logarchive);
} else {
/* this is already in place because of _start_logging_stdout() */
}
if (errorlog < 0) {
......@@ -248,16 +248,16 @@ static int _start_logging(void)
}
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);
accesslog = log_open(fn_access);
log_to_stderr = 0;
if (config->logsize)
log_set_trigger (accesslog, config->logsize);
log_set_archive_timestamp(accesslog, config->logarchive);
} else {
accesslog = log_open_file(stderr);
log_to_stderr = 1;
}
if (accesslog < 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment