mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2025-02-02 15:07:36 -05:00
Cleanup: Removed tailing spaces
This commit is contained in:
parent
e9a90f9918
commit
11d5dffd49
@ -161,7 +161,7 @@ acl_t * acl_new_from_xml_node(xmlNodePtr node) {
|
||||
} else if (strcmp((const char*)prop->name, "deny-all") == 0) {
|
||||
if (strstr(tmp, "*") || util_str_to_bool(tmp)) {
|
||||
acl_set_method_str(ret, ACL_POLICY_DENY, "*");
|
||||
acl_set_admin_str(ret, ACL_POLICY_DENY, "*");
|
||||
acl_set_admin_str(ret, ACL_POLICY_DENY, "*");
|
||||
acl_set_web_policy(ret, ACL_POLICY_DENY);
|
||||
} else {
|
||||
acl_set_method_str(ret, ACL_POLICY_ALLOW, "*");
|
||||
@ -307,7 +307,7 @@ int acl_set_max_connection_duration(acl_t * acl, time_t duration) {
|
||||
time_t acl_get_max_connection_duration(acl_t * acl) {
|
||||
if (!acl)
|
||||
return -1;
|
||||
|
||||
|
||||
return acl->max_connection_duration;
|
||||
}
|
||||
|
||||
@ -323,6 +323,6 @@ int acl_set_max_connections_per_user(acl_t * acl, size_t limit) {
|
||||
ssize_t acl_get_max_connections_per_user(acl_t * acl) {
|
||||
if (!acl)
|
||||
return -1;
|
||||
|
||||
|
||||
return acl->max_connections_per_user;
|
||||
}
|
||||
|
38
src/admin.c
38
src/admin.c
@ -264,13 +264,13 @@ xmlDocPtr admin_build_sourcelist (const char *mount)
|
||||
|
||||
if (source->running)
|
||||
{
|
||||
if (source->client)
|
||||
if (source->client)
|
||||
{
|
||||
snprintf (buf, sizeof(buf), "%lu",
|
||||
(unsigned long)(now - source->con->con_time));
|
||||
xmlNewChild (srcnode, NULL, XMLSTR("Connected"), XMLSTR(buf));
|
||||
}
|
||||
xmlNewChild (srcnode, NULL, XMLSTR("content-type"),
|
||||
xmlNewChild (srcnode, NULL, XMLSTR("content-type"),
|
||||
XMLSTR(source->format->contenttype));
|
||||
}
|
||||
}
|
||||
@ -330,7 +330,7 @@ void admin_send_response (xmlDocPtr doc, client_t *client,
|
||||
client_send_error(client, 500, 0, "Buffer reallocation failed.");
|
||||
xmlFree(buff);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME: in this section we hope no function will ever return -1 */
|
||||
@ -347,7 +347,7 @@ void admin_send_response (xmlDocPtr doc, client_t *client,
|
||||
int fullpath_xslt_template_len;
|
||||
ice_config_t *config = config_get_config();
|
||||
|
||||
fullpath_xslt_template_len = strlen (config->adminroot_dir) +
|
||||
fullpath_xslt_template_len = strlen (config->adminroot_dir) +
|
||||
strlen (xslt_template) + 2;
|
||||
fullpath_xslt_template = malloc(fullpath_xslt_template_len);
|
||||
snprintf(fullpath_xslt_template, fullpath_xslt_template_len, "%s%s%s",
|
||||
@ -417,7 +417,7 @@ void admin_handle_request(client_t *client, const char *uri)
|
||||
|
||||
if (source == NULL)
|
||||
{
|
||||
ICECAST_LOG_WARN("Admin command %s on non-existent source %s",
|
||||
ICECAST_LOG_WARN("Admin command %s on non-existent source %s",
|
||||
command_string, mount);
|
||||
avl_tree_unlock(global.source_tree);
|
||||
client_send_error(client, 400, 0, "Source does not exist");
|
||||
@ -441,7 +441,7 @@ void admin_handle_request(client_t *client, const char *uri)
|
||||
client_send_error(client, 400, 0, "illegal metadata call");
|
||||
return;
|
||||
}
|
||||
ICECAST_LOG_INFO("Received admin command %s on mount \"%s\"",
|
||||
ICECAST_LOG_INFO("Received admin command %s on mount \"%s\"",
|
||||
command_string, mount);
|
||||
admin_handle_mount_request(client, source);
|
||||
avl_tree_unlock(global.source_tree);
|
||||
@ -611,7 +611,7 @@ static void command_move_clients(client_t *client, source_t *source,
|
||||
ICECAST_LOG_DEBUG("Done optional check (%d)", parameters_passed);
|
||||
if (!parameters_passed) {
|
||||
doc = admin_build_sourcelist(source->mount);
|
||||
admin_send_response(doc, client, response,
|
||||
admin_send_response(doc, client, response,
|
||||
MOVECLIENTS_TRANSFORMED_REQUEST);
|
||||
xmlFreeDoc(doc);
|
||||
return;
|
||||
@ -651,7 +651,7 @@ static void command_move_clients(client_t *client, source_t *source,
|
||||
xmlNewChild(node, NULL, XMLSTR("message"), XMLSTR(buf));
|
||||
xmlNewChild(node, NULL, XMLSTR("return"), XMLSTR("1"));
|
||||
|
||||
admin_send_response(doc, client, response,
|
||||
admin_send_response(doc, client, response,
|
||||
ADMIN_XSL_RESPONSE);
|
||||
xmlFreeDoc(doc);
|
||||
}
|
||||
@ -731,7 +731,7 @@ static void command_show_listeners(client_t *client, source_t *source,
|
||||
|
||||
admin_add_listeners_to_mount(source, srcnode, client->mode);
|
||||
|
||||
admin_send_response(doc, client, response,
|
||||
admin_send_response(doc, client, response,
|
||||
LISTCLIENTS_TRANSFORMED_REQUEST);
|
||||
xmlFreeDoc(doc);
|
||||
}
|
||||
@ -908,7 +908,7 @@ static void command_manageauth(client_t *client, int response) {
|
||||
config_release_config();
|
||||
auth_release(auth);
|
||||
|
||||
admin_send_response(doc, client, response,
|
||||
admin_send_response(doc, client, response,
|
||||
MANAGEAUTH_TRANSFORMED_REQUEST);
|
||||
free (message);
|
||||
xmlFreeDoc(doc);
|
||||
@ -978,7 +978,7 @@ static void command_kill_client(client_t *client, source_t *source,
|
||||
xmlNewChild(node, NULL, XMLSTR("message"), XMLSTR(buf));
|
||||
xmlNewChild(node, NULL, XMLSTR("return"), XMLSTR("0"));
|
||||
}
|
||||
admin_send_response(doc, client, response,
|
||||
admin_send_response(doc, client, response,
|
||||
ADMIN_XSL_RESPONSE);
|
||||
xmlFreeDoc(doc);
|
||||
}
|
||||
@ -1030,7 +1030,7 @@ static void command_metadata(client_t *client, source_t *source,
|
||||
{
|
||||
xmlNewChild(node, NULL, XMLSTR("message"), XMLSTR("No such action"));
|
||||
xmlNewChild(node, NULL, XMLSTR("return"), XMLSTR("0"));
|
||||
admin_send_response(doc, client, response,
|
||||
admin_send_response(doc, client, response,
|
||||
ADMIN_XSL_RESPONSE);
|
||||
xmlFreeDoc(doc);
|
||||
return;
|
||||
@ -1063,10 +1063,10 @@ static void command_metadata(client_t *client, source_t *source,
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlNewChild(node, NULL, XMLSTR("message"),
|
||||
xmlNewChild(node, NULL, XMLSTR("message"),
|
||||
XMLSTR("Mountpoint will not accept URL updates"));
|
||||
xmlNewChild(node, NULL, XMLSTR("return"), XMLSTR("1"));
|
||||
admin_send_response(doc, client, response,
|
||||
admin_send_response(doc, client, response,
|
||||
ADMIN_XSL_RESPONSE);
|
||||
xmlFreeDoc(doc);
|
||||
return;
|
||||
@ -1074,7 +1074,7 @@ static void command_metadata(client_t *client, source_t *source,
|
||||
|
||||
xmlNewChild(node, NULL, XMLSTR("message"), XMLSTR("Metadata update successful"));
|
||||
xmlNewChild(node, NULL, XMLSTR("return"), XMLSTR("1"));
|
||||
admin_send_response(doc, client, response,
|
||||
admin_send_response(doc, client, response,
|
||||
ADMIN_XSL_RESPONSE);
|
||||
xmlFreeDoc(doc);
|
||||
}
|
||||
@ -1108,7 +1108,7 @@ static void command_shoutcast_metadata(client_t *client, source_t *source)
|
||||
source->format->set_tag (source->format, "title", value, NULL);
|
||||
source->format->set_tag (source->format, NULL, NULL, NULL);
|
||||
|
||||
ICECAST_LOG_DEBUG("Metadata on mountpoint %s changed to \"%s\"",
|
||||
ICECAST_LOG_DEBUG("Metadata on mountpoint %s changed to \"%s\"",
|
||||
source->mount, value);
|
||||
html_success(client, "Metadata update successful");
|
||||
}
|
||||
@ -1145,7 +1145,7 @@ static void command_queue_reload(client_t *client, int response) {
|
||||
|
||||
admin_send_response(doc, client, response, ADMIN_XSL_RESPONSE);
|
||||
xmlFreeDoc(doc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void command_list_mounts(client_t *client, int response)
|
||||
@ -1178,7 +1178,7 @@ static void command_list_mounts(client_t *client, int response)
|
||||
doc = admin_build_sourcelist(NULL);
|
||||
avl_tree_unlock (global.source_tree);
|
||||
|
||||
admin_send_response(doc, client, response,
|
||||
admin_send_response(doc, client, response,
|
||||
LISTMOUNTS_TRANSFORMED_REQUEST);
|
||||
xmlFreeDoc(doc);
|
||||
}
|
||||
@ -1196,7 +1196,7 @@ static void command_updatemetadata(client_t *client, source_t *source,
|
||||
xmlSetProp (srcnode, XMLSTR("mount"), XMLSTR(source->mount));
|
||||
xmlDocSetRootElement(doc, node);
|
||||
|
||||
admin_send_response(doc, client, response,
|
||||
admin_send_response(doc, client, response,
|
||||
UPDATEMETADATA_TRANSFORMED_REQUEST);
|
||||
xmlFreeDoc(doc);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This program is distributed under the GNU General Public License, version 2.
|
||||
* A copy of this license is included with this source.
|
||||
*
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Michael Smith <msmith@xiph.org>,
|
||||
* oddsock <oddsock@xiph.org>,
|
||||
* Karl Heyes <karl@xiph.org>
|
||||
@ -11,7 +11,7 @@
|
||||
* Copyright 2013-2014, Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>,
|
||||
*/
|
||||
|
||||
/**
|
||||
/**
|
||||
* Client authentication functions
|
||||
*/
|
||||
|
||||
@ -89,7 +89,7 @@ static auth_client *auth_client_setup (client_t *client)
|
||||
}
|
||||
|
||||
tmp = strchr(userpass, ':');
|
||||
if (tmp == NULL) {
|
||||
if (tmp == NULL) {
|
||||
free(userpass);
|
||||
break;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
* Copyright 2014, Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>,
|
||||
*/
|
||||
|
||||
/**
|
||||
/**
|
||||
* Client authentication functions
|
||||
*/
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This program is distributed under the GNU General Public License, version 2.
|
||||
* A copy of this license is included with this source.
|
||||
*
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Michael Smith <msmith@xiph.org>,
|
||||
* oddsock <oddsock@xiph.org>,
|
||||
* Karl Heyes <karl@xiph.org>
|
||||
@ -11,7 +11,7 @@
|
||||
* Copyright 2012-2014, Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>,
|
||||
*/
|
||||
|
||||
/**
|
||||
/**
|
||||
* Client authentication functions
|
||||
*/
|
||||
|
||||
@ -136,7 +136,7 @@ static void htpasswd_recheckfile (htpasswd_auth_state *htpasswd)
|
||||
passwdfile = fopen (htpasswd->filename, "rb");
|
||||
if (passwdfile == NULL)
|
||||
{
|
||||
ICECAST_LOG_WARN("Failed to open authentication database \"%s\": %s",
|
||||
ICECAST_LOG_WARN("Failed to open authentication database \"%s\": %s",
|
||||
htpasswd->filename, strerror(errno));
|
||||
return;
|
||||
}
|
||||
@ -240,7 +240,7 @@ int auth_get_htpasswd_auth (auth_t *authenticator, config_options_t *options)
|
||||
}
|
||||
|
||||
if (state->filename)
|
||||
ICECAST_LOG_INFO("Configured htpasswd authentication using password file \"%s\"",
|
||||
ICECAST_LOG_INFO("Configured htpasswd authentication using password file \"%s\"",
|
||||
state->filename);
|
||||
else
|
||||
ICECAST_LOG_ERROR("No filename given in options for authenticator.");
|
||||
@ -278,7 +278,7 @@ static auth_result htpasswd_adduser (auth_t *auth, const char *username, const c
|
||||
if (passwdfile == NULL)
|
||||
{
|
||||
thread_rwlock_unlock (&state->file_rwlock);
|
||||
ICECAST_LOG_WARN("Failed to open authentication database \"%s\": %s",
|
||||
ICECAST_LOG_WARN("Failed to open authentication database \"%s\": %s",
|
||||
state->filename, strerror(errno));
|
||||
return AUTH_FAILED;
|
||||
}
|
||||
@ -312,7 +312,7 @@ static auth_result htpasswd_deleteuser(auth_t *auth, const char *username)
|
||||
passwdfile = fopen(state->filename, "rb");
|
||||
|
||||
if(passwdfile == NULL) {
|
||||
ICECAST_LOG_WARN("Failed to open authentication database \"%s\": %s",
|
||||
ICECAST_LOG_WARN("Failed to open authentication database \"%s\": %s",
|
||||
state->filename, strerror(errno));
|
||||
thread_rwlock_unlock (&state->file_rwlock);
|
||||
return AUTH_FAILED;
|
||||
@ -332,7 +332,7 @@ static auth_result htpasswd_deleteuser(auth_t *auth, const char *username)
|
||||
tmp_passwdfile = fopen(tmpfile, "wb");
|
||||
|
||||
if(tmp_passwdfile == NULL) {
|
||||
ICECAST_LOG_WARN("Failed to open temporary authentication database \"%s\": %s",
|
||||
ICECAST_LOG_WARN("Failed to open temporary authentication database \"%s\": %s",
|
||||
tmpfile, strerror(errno));
|
||||
fclose(passwdfile);
|
||||
free(tmpfile);
|
||||
@ -367,12 +367,12 @@ static auth_result htpasswd_deleteuser(auth_t *auth, const char *username)
|
||||
/* Windows won't let us rename a file if the destination file
|
||||
exists...so, lets remove the original first */
|
||||
if (remove(state->filename) != 0) {
|
||||
ICECAST_LOG_ERROR("Problem moving temp authentication file to original \"%s\" - \"%s\": %s",
|
||||
ICECAST_LOG_ERROR("Problem moving temp authentication file to original \"%s\" - \"%s\": %s",
|
||||
tmpfile, state->filename, strerror(errno));
|
||||
}
|
||||
else {
|
||||
if (rename(tmpfile, state->filename) != 0) {
|
||||
ICECAST_LOG_ERROR("Problem moving temp authentication file to original \"%s\" - \"%s\": %s",
|
||||
ICECAST_LOG_ERROR("Problem moving temp authentication file to original \"%s\" - \"%s\": %s",
|
||||
tmpfile, state->filename, strerror(errno));
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
* Copyright 2014, Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>,
|
||||
*/
|
||||
|
||||
/**
|
||||
/**
|
||||
* Client authentication functions
|
||||
*/
|
||||
|
||||
|
@ -30,10 +30,10 @@
|
||||
#include "cfgfile.h"
|
||||
#include "refbuf.h"
|
||||
#include "client.h"
|
||||
#include "logging.h"
|
||||
#include "util.h"
|
||||
#include "auth.h"
|
||||
#include "event.h"
|
||||
#include "logging.h"
|
||||
#include "util.h"
|
||||
#include "auth.h"
|
||||
#include "event.h"
|
||||
|
||||
/* for config_reread_config() */
|
||||
#include "yp.h"
|
||||
@ -94,13 +94,13 @@ static void _parse_directory(xmlDocPtr doc, xmlNodePtr node, ice_config_t *c);
|
||||
static void _parse_paths(xmlDocPtr doc, xmlNodePtr node, ice_config_t *c);
|
||||
static void _parse_logging(xmlDocPtr doc, xmlNodePtr node, ice_config_t *c);
|
||||
static void _parse_security(xmlDocPtr doc, xmlNodePtr node, ice_config_t *c);
|
||||
static void _parse_authentication(xmlDocPtr doc, xmlNodePtr node,
|
||||
static void _parse_authentication(xmlDocPtr doc, xmlNodePtr node,
|
||||
ice_config_t *c, char **source_password);
|
||||
static void _parse_http_headers(xmlDocPtr doc, xmlNodePtr node,
|
||||
ice_config_http_header_t **http_headers);
|
||||
static void _parse_relay(xmlDocPtr doc, xmlNodePtr node, ice_config_t *c);
|
||||
static void _parse_mount(xmlDocPtr doc, xmlNodePtr node, ice_config_t *c);
|
||||
static void _parse_listen_socket(xmlDocPtr doc, xmlNodePtr node,
|
||||
static void _parse_listen_socket(xmlDocPtr doc, xmlNodePtr node,
|
||||
ice_config_t *c);
|
||||
static void _add_server(xmlDocPtr doc, xmlNodePtr node, ice_config_t *c);
|
||||
static void _parse_events(event_registration_t **events, xmlNodePtr node);
|
||||
@ -549,7 +549,7 @@ int config_parse_file(const char *filename, ice_config_t *configuration)
|
||||
xmlNodePtr node;
|
||||
|
||||
if (filename == NULL || strcmp(filename, "") == 0) return CONFIG_EINSANE;
|
||||
|
||||
|
||||
doc = xmlParseFile(filename);
|
||||
if (doc == NULL) {
|
||||
return CONFIG_EPARSE;
|
||||
@ -696,7 +696,7 @@ static inline void __check_hostname(ice_config_t *configuration) {
|
||||
}
|
||||
}
|
||||
|
||||
static void _parse_root(xmlDocPtr doc, xmlNodePtr node,
|
||||
static void _parse_root(xmlDocPtr doc, xmlNodePtr node,
|
||||
ice_config_t *configuration)
|
||||
{
|
||||
char *tmp;
|
||||
@ -756,7 +756,7 @@ static void _parse_root(xmlDocPtr doc, xmlNodePtr node,
|
||||
ICECAST_LOG_WARN("<port> must not be empty.");
|
||||
}
|
||||
} else if (xmlStrcmp (node->name, XMLSTR("bind-address")) == 0) {
|
||||
if (configuration->listen_sock->bind_address)
|
||||
if (configuration->listen_sock->bind_address)
|
||||
xmlFree(configuration->listen_sock->bind_address);
|
||||
configuration->listen_sock->bind_address = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
|
||||
} else if (xmlStrcmp (node->name, XMLSTR("master-server")) == 0) {
|
||||
@ -854,7 +854,7 @@ static void _parse_root(xmlDocPtr doc, xmlNodePtr node,
|
||||
}
|
||||
}
|
||||
|
||||
static void _parse_limits(xmlDocPtr doc, xmlNodePtr node,
|
||||
static void _parse_limits(xmlDocPtr doc, xmlNodePtr node,
|
||||
ice_config_t *configuration)
|
||||
{
|
||||
char *tmp;
|
||||
@ -1058,7 +1058,7 @@ static void _parse_mount_oldstyle_authentication(mount_proxy *mount, xmlNodePtr
|
||||
xmlFree(type);
|
||||
}
|
||||
|
||||
static void _parse_mount(xmlDocPtr doc, xmlNodePtr node,
|
||||
static void _parse_mount(xmlDocPtr doc, xmlNodePtr node,
|
||||
ice_config_t *configuration)
|
||||
{
|
||||
char *tmp;
|
||||
@ -1068,7 +1068,7 @@ static void _parse_mount(xmlDocPtr doc, xmlNodePtr node,
|
||||
char *username = NULL;
|
||||
char *password = NULL;
|
||||
auth_stack_t *authstack = NULL;
|
||||
|
||||
|
||||
/* default <mount> settings */
|
||||
mount->mounttype = MOUNT_TYPE_NORMAL;
|
||||
mount->max_listeners = -1;
|
||||
@ -1487,12 +1487,12 @@ static void _parse_listen_socket(xmlDocPtr doc, xmlNodePtr node,
|
||||
}
|
||||
else if (xmlStrcmp (node->name, XMLSTR("shoutcast-mount")) == 0) {
|
||||
if (listener->shoutcast_mount) xmlFree (listener->shoutcast_mount);
|
||||
listener->shoutcast_mount = (char *)xmlNodeListGetString(doc,
|
||||
listener->shoutcast_mount = (char *)xmlNodeListGetString(doc,
|
||||
node->xmlChildrenNode, 1);
|
||||
}
|
||||
else if (xmlStrcmp (node->name, XMLSTR("bind-address")) == 0) {
|
||||
if (listener->bind_address) xmlFree (listener->bind_address);
|
||||
listener->bind_address = (char *)xmlNodeListGetString(doc,
|
||||
listener->bind_address = (char *)xmlNodeListGetString(doc,
|
||||
node->xmlChildrenNode, 1);
|
||||
}
|
||||
else if (xmlStrcmp (node->name, XMLSTR("so-sndbuf")) == 0) {
|
||||
@ -1540,7 +1540,7 @@ static void _parse_authentication(xmlDocPtr doc, xmlNodePtr node,
|
||||
}
|
||||
else {
|
||||
if (*source_password) xmlFree(*source_password);
|
||||
*source_password =
|
||||
*source_password =
|
||||
(char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
|
||||
}
|
||||
} else if (xmlStrcmp (node->name, XMLSTR("admin-password")) == 0) {
|
||||
@ -1608,13 +1608,13 @@ static void _parse_directory(xmlDocPtr doc, xmlNodePtr node,
|
||||
if (xmlIsBlankNode(node)) continue;
|
||||
|
||||
if (xmlStrcmp (node->name, XMLSTR("yp-url")) == 0) {
|
||||
if (configuration->yp_url[configuration->num_yp_directories])
|
||||
if (configuration->yp_url[configuration->num_yp_directories])
|
||||
xmlFree(configuration->yp_url[configuration->num_yp_directories]);
|
||||
configuration->yp_url[configuration->num_yp_directories] =
|
||||
configuration->yp_url[configuration->num_yp_directories] =
|
||||
(char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
|
||||
} else if (xmlStrcmp (node->name, XMLSTR("yp-url-timeout")) == 0) {
|
||||
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
|
||||
configuration->yp_url_timeout[configuration->num_yp_directories] =
|
||||
configuration->yp_url_timeout[configuration->num_yp_directories] =
|
||||
atoi(tmp);
|
||||
if (tmp) xmlFree(tmp);
|
||||
} else if (xmlStrcmp (node->name, XMLSTR("server")) == 0) {
|
||||
@ -1683,7 +1683,7 @@ static void _parse_paths(xmlDocPtr doc, xmlNodePtr node,
|
||||
ICECAST_LOG_WARN("<adminroot> must not be empty.");
|
||||
continue;
|
||||
}
|
||||
if (configuration->adminroot_dir)
|
||||
if (configuration->adminroot_dir)
|
||||
xmlFree(configuration->adminroot_dir);
|
||||
configuration->adminroot_dir = (char *)temp;
|
||||
if(configuration->adminroot_dir[strlen(configuration->adminroot_dir)-1] == '/')
|
||||
@ -1811,7 +1811,7 @@ static void _parse_security(xmlDocPtr doc, xmlNodePtr node,
|
||||
} while ((node = node->next));
|
||||
}
|
||||
|
||||
static void _add_server(xmlDocPtr doc, xmlNodePtr node,
|
||||
static void _add_server(xmlDocPtr doc, xmlNodePtr node,
|
||||
ice_config_t *configuration)
|
||||
{
|
||||
ice_config_dir_t *dirnode, *server;
|
||||
@ -1822,7 +1822,7 @@ static void _add_server(xmlDocPtr doc, xmlNodePtr node,
|
||||
server->touch_interval = configuration->touch_interval;
|
||||
server->host = NULL;
|
||||
addnode = 0;
|
||||
|
||||
|
||||
do {
|
||||
if (node == NULL) break;
|
||||
if (xmlIsBlankNode(node)) continue;
|
||||
@ -1845,10 +1845,10 @@ static void _add_server(xmlDocPtr doc, xmlNodePtr node,
|
||||
configuration->dir_list = server;
|
||||
} else {
|
||||
while (dirnode->next) dirnode = dirnode->next;
|
||||
|
||||
|
||||
dirnode->next = server;
|
||||
}
|
||||
|
||||
|
||||
server = NULL;
|
||||
addnode = 0;
|
||||
}
|
||||
@ -2033,7 +2033,7 @@ mount_proxy *config_find_mount (ice_config_t *config, const char *mount, mount_t
|
||||
return mountinfo;
|
||||
}
|
||||
|
||||
/* Helper function to locate the configuration details of the listening
|
||||
/* Helper function to locate the configuration details of the listening
|
||||
* socket
|
||||
*/
|
||||
listener_t *config_get_listen_sock(ice_config_t *config, connection_t *con)
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This program is distributed under the GNU General Public License, version 2.
|
||||
* A copy of this license is included with this source.
|
||||
*
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Michael Smith <msmith@xiph.org>,
|
||||
* oddsock <oddsock@xiph.org>,
|
||||
* Karl Heyes <karl@xiph.org>
|
||||
@ -108,7 +108,7 @@ void client_destroy(client_t *client)
|
||||
if (auth_release_client(client))
|
||||
return;
|
||||
|
||||
/* write log entry if ip is set (some things don't set it, like outgoing
|
||||
/* write log entry if ip is set (some things don't set it, like outgoing
|
||||
* slave requests
|
||||
*/
|
||||
if (client->respcode && client->parser)
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This program is distributed under the GNU General Public License, version 2.
|
||||
* A copy of this license is included with this source.
|
||||
*
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Michael Smith <msmith@xiph.org>,
|
||||
* oddsock <oddsock@xiph.org>,
|
||||
* Karl Heyes <karl@xiph.org>
|
||||
@ -24,7 +24,7 @@ int main(void)
|
||||
ice_config_t *config;
|
||||
|
||||
config_initialize();
|
||||
|
||||
|
||||
config_parse_file("icecast.xml");
|
||||
|
||||
config = config_get_config_unlocked();
|
||||
@ -54,7 +54,7 @@ void _dump_config(ice_config_t *config)
|
||||
while (node) {
|
||||
printf("directory.touch_interval = %d\n", node->touch_interval);
|
||||
printf("directory.host = %s\n", node->host);
|
||||
|
||||
|
||||
node = node->next;
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This program is distributed under the GNU General Public License, version 2.
|
||||
* A copy of this license is included with this source.
|
||||
*
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Michael Smith <msmith@xiph.org>,
|
||||
* oddsock <oddsock@xiph.org>,
|
||||
* Karl Heyes <karl@xiph.org>
|
||||
@ -136,7 +136,7 @@ static int free_filtered_ip (void*x)
|
||||
void connection_initialize(void)
|
||||
{
|
||||
if (_initialized) return;
|
||||
|
||||
|
||||
thread_spin_create (&_connection_lock);
|
||||
thread_mutex_create(&move_clients_mutex);
|
||||
thread_rwlock_create(&_source_shutdown_rwlock);
|
||||
@ -158,13 +158,13 @@ void connection_initialize(void)
|
||||
void connection_shutdown(void)
|
||||
{
|
||||
if (!_initialized) return;
|
||||
|
||||
|
||||
#ifdef HAVE_OPENSSL
|
||||
SSL_CTX_free (ssl_ctx);
|
||||
#endif
|
||||
if (banned_ip.contents) avl_tree_free (banned_ip.contents, free_filtered_ip);
|
||||
if (allowed_ip.contents) avl_tree_free (allowed_ip.contents, free_filtered_ip);
|
||||
|
||||
|
||||
thread_cond_destroy(&global.shutdown_cond);
|
||||
thread_rwlock_destroy(&_source_shutdown_rwlock);
|
||||
thread_spin_destroy (&_connection_lock);
|
||||
@ -223,13 +223,13 @@ static void get_ssl_certificate (ice_config_t *config)
|
||||
ICECAST_LOG_ERROR("Invalid %s - Private key does not match cert public key", config->cert_file);
|
||||
break;
|
||||
}
|
||||
if (SSL_CTX_set_cipher_list(ssl_ctx, config->cipher_list) <= 0)
|
||||
{
|
||||
ICECAST_LOG_WARN("Invalid cipher list: %s", config->cipher_list);
|
||||
}
|
||||
if (SSL_CTX_set_cipher_list(ssl_ctx, config->cipher_list) <= 0)
|
||||
{
|
||||
ICECAST_LOG_WARN("Invalid cipher list: %s", config->cipher_list);
|
||||
}
|
||||
ssl_ok = 1;
|
||||
ICECAST_LOG_INFO("SSL certificate found at %s", config->cert_file);
|
||||
ICECAST_LOG_INFO("SSL using ciphers %s", config->cipher_list);
|
||||
ICECAST_LOG_INFO("SSL using ciphers %s", config->cipher_list);
|
||||
return;
|
||||
} while (0);
|
||||
ICECAST_LOG_INFO("No SSL capability on any configured ports");
|
||||
@ -1337,7 +1337,7 @@ static void _handle_authentication_global(client_t *client, void *uri, auth_resu
|
||||
auth_stack_release(client->authstack);
|
||||
client->authstack = NULL;
|
||||
|
||||
if (result != AUTH_NOMATCH &&
|
||||
if (result != AUTH_NOMATCH &&
|
||||
!(result == AUTH_OK && client->admin_command != -1 && acl_test_admin(client->acl, client->admin_command) == ACL_POLICY_DENY)) {
|
||||
_handle_authed_client(client, uri, result);
|
||||
return;
|
||||
@ -1529,7 +1529,7 @@ static void _handle_connection(void)
|
||||
}
|
||||
|
||||
_handle_authentication(client, uri);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
free (node);
|
||||
|
10
src/format.c
10
src/format.c
@ -3,7 +3,7 @@
|
||||
* This program is distributed under the GNU General Public License, version 2.
|
||||
* A copy of this license is included with this source.
|
||||
*
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Michael Smith <msmith@xiph.org>,
|
||||
* oddsock <oddsock@xiph.org>,
|
||||
* Karl Heyes <karl@xiph.org>
|
||||
@ -96,7 +96,7 @@ int format_get_plugin(format_type_t type, source_t *source)
|
||||
break;
|
||||
}
|
||||
if (ret < 0)
|
||||
stats_event (source->mount, "content-type",
|
||||
stats_event (source->mount, "content-type",
|
||||
source->format->contenttype);
|
||||
|
||||
return ret;
|
||||
@ -104,7 +104,7 @@ int format_get_plugin(format_type_t type, source_t *source)
|
||||
|
||||
|
||||
/* clients need to be start from somewhere in the queue so we will look for
|
||||
* a refbuf which has been previously marked as a sync point.
|
||||
* a refbuf which has been previously marked as a sync point.
|
||||
*/
|
||||
static void find_client_start(source_t *source, client_t *client)
|
||||
{
|
||||
@ -259,7 +259,7 @@ int format_generic_write_to_client(client_t *client)
|
||||
|
||||
|
||||
/* This is the commonly used for source streams, here we just progress to
|
||||
* the next buffer in the queue if there is no more left to be written from
|
||||
* the next buffer in the queue if there is no more left to be written from
|
||||
* the existing buffer.
|
||||
*/
|
||||
int format_advance_queue(source_t *source, client_t *client)
|
||||
@ -338,7 +338,7 @@ static int format_prepare_headers (source_t *source, client_t *client)
|
||||
if (bitrate_filtered == 0)
|
||||
brfield = strstr(var->value, "bitrate=");
|
||||
if (brfield && sscanf (brfield, "bitrate=%u", &bitrate))
|
||||
{
|
||||
{
|
||||
bytes = snprintf (ptr, remaining, "icy-br:%u\r\n", bitrate);
|
||||
next = 0;
|
||||
bitrate_filtered = 1;
|
||||
|
@ -124,11 +124,11 @@ static int send_ebml_header(client_t *client)
|
||||
int len = EBML_SLICE_SIZE;
|
||||
int ret;
|
||||
|
||||
if (ebml_client_data->header->len - ebml_client_data->header_pos < len)
|
||||
if (ebml_client_data->header->len - ebml_client_data->header_pos < len)
|
||||
{
|
||||
len = ebml_client_data->header->len - ebml_client_data->header_pos;
|
||||
}
|
||||
ret = client_send_bytes (client,
|
||||
ret = client_send_bytes (client,
|
||||
ebml_client_data->header->data + ebml_client_data->header_pos,
|
||||
len);
|
||||
|
||||
@ -259,7 +259,7 @@ static void ebml_write_buf_to_file (source_t *source, refbuf_t *refbuf)
|
||||
if (ebml_source_state->file_headers_written == 0)
|
||||
{
|
||||
if (fwrite (ebml_source_state->header->data, 1,
|
||||
ebml_source_state->header->len,
|
||||
ebml_source_state->header->len,
|
||||
source->dumpfile) != ebml_source_state->header->len)
|
||||
ebml_write_buf_to_file_fail(source);
|
||||
else
|
||||
@ -336,7 +336,7 @@ static int ebml_read(ebml_t *ebml, char *buffer, int len)
|
||||
if (len < 1)
|
||||
return 0;
|
||||
|
||||
if (ebml->header_read == 1)
|
||||
if (ebml->header_read == 1)
|
||||
{
|
||||
if (ebml->cluster_start > 0)
|
||||
read_space = ebml->cluster_start;
|
||||
@ -393,13 +393,13 @@ static int ebml_last_was_sync(ebml_t *ebml)
|
||||
ebml->cluster_start -= 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if (ebml->cluster_start == -1)
|
||||
{
|
||||
ebml->cluster_start -= 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
@ -425,11 +425,11 @@ static int ebml_wrote(ebml_t *ebml, int len)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
ICECAST_LOG_DEBUG("EBML: Adding to header, ofset is %d size is %d adding %d",
|
||||
/*
|
||||
ICECAST_LOG_DEBUG("EBML: Adding to header, ofset is %d size is %d adding %d",
|
||||
ebml->header_size, ebml->header_position, len);
|
||||
*/
|
||||
|
||||
|
||||
memcpy(ebml->header + ebml->header_position, ebml->input_buffer, len);
|
||||
ebml->header_position += len;
|
||||
}
|
||||
@ -437,7 +437,7 @@ static int ebml_wrote(ebml_t *ebml, int len)
|
||||
{
|
||||
memcpy(ebml->buffer + ebml->position, ebml->input_buffer, len);
|
||||
}
|
||||
|
||||
|
||||
for (b = 0; b < len - 4; b++)
|
||||
{
|
||||
if (!memcmp(ebml->input_buffer + b, ebml->cluster_id, 4))
|
||||
@ -445,7 +445,7 @@ static int ebml_wrote(ebml_t *ebml, int len)
|
||||
/*
|
||||
ICECAST_LOG_DEBUG("EBML: found cluster");
|
||||
*/
|
||||
|
||||
|
||||
if (ebml->header_size == 0)
|
||||
{
|
||||
ebml->header_size = ebml->header_position - len + b;
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This program is distributed under the GNU General Public License, version 2.
|
||||
* A copy of this license is included with this source.
|
||||
*
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Michael Smith <msmith@xiph.org>,
|
||||
* oddsock <oddsock@xiph.org>,
|
||||
* Karl Heyes <karl@xiph.org>
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This program is distributed under the GNU General Public License, version 2.
|
||||
* A copy of this license is included with this source.
|
||||
*
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Michael Smith <msmith@xiph.org>,
|
||||
* oddsock <oddsock@xiph.org>,
|
||||
* Karl Heyes <karl@xiph.org>
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This program is distributed under the GNU General Public License, version 2.
|
||||
* A copy of this license is included with this source.
|
||||
*
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Michael Smith <msmith@xiph.org>,
|
||||
* oddsock <oddsock@xiph.org>,
|
||||
* Karl Heyes <karl@xiph.org>
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This program is distributed under the GNU General Public License, version 2.
|
||||
* A copy of this license is included with this source.
|
||||
*
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Michael Smith <msmith@xiph.org>,
|
||||
* oddsock <oddsock@xiph.org>,
|
||||
* Karl Heyes <karl@xiph.org>
|
||||
@ -454,7 +454,7 @@ static void format_mp3_free_plugin(format_plugin_t *self)
|
||||
|
||||
/* This does the actual reading, making sure the read data is packaged in
|
||||
* blocks of 1400 bytes (near the common MTU size). This is because many
|
||||
* incoming streams come in small packets which could waste a lot of
|
||||
* incoming streams come in small packets which could waste a lot of
|
||||
* bandwidth with many listeners due to headers and such like.
|
||||
*/
|
||||
static int complete_read(source_t *source)
|
||||
@ -469,7 +469,7 @@ static int complete_read(source_t *source)
|
||||
|
||||
if (source_mp3->read_data == NULL)
|
||||
{
|
||||
source_mp3->read_data = refbuf_new (REFBUF_SIZE);
|
||||
source_mp3->read_data = refbuf_new (REFBUF_SIZE);
|
||||
source_mp3->read_count = 0;
|
||||
}
|
||||
buf = source_mp3->read_data->data + source_mp3->read_count;
|
||||
@ -596,7 +596,7 @@ static refbuf_t *mp3_get_filter_meta(source_t *source)
|
||||
source_mp3->build_metadata_offset += bytes;
|
||||
break;
|
||||
}
|
||||
/* copy all bytes except the last one, that way we
|
||||
/* copy all bytes except the last one, that way we
|
||||
* know a null byte terminates the message */
|
||||
memcpy (source_mp3->build_metadata + source_mp3->build_metadata_offset,
|
||||
src, metadata_remaining-1);
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This program is distributed under the GNU General Public License, version 2.
|
||||
* A copy of this license is included with this source.
|
||||
*
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Michael Smith <msmith@xiph.org>,
|
||||
* oddsock <oddsock@xiph.org>,
|
||||
* Karl Heyes <karl@xiph.org>
|
||||
@ -458,7 +458,7 @@ static refbuf_t *ogg_get_buffer(source_t *source)
|
||||
}
|
||||
|
||||
|
||||
static int create_ogg_client_data (source_t *source, client_t *client)
|
||||
static int create_ogg_client_data (source_t *source, client_t *client)
|
||||
{
|
||||
struct ogg_client *client_data = calloc (1, sizeof (struct ogg_client));
|
||||
int ret = -1;
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This program is distributed under the GNU General Public License, version 2.
|
||||
* A copy of this license is included with this source.
|
||||
*
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Michael Smith <msmith@xiph.org>,
|
||||
* oddsock <oddsock@xiph.org>,
|
||||
* Karl Heyes <karl@xiph.org>
|
||||
|
@ -1,9 +1,9 @@
|
||||
/* Icecast
|
||||
*
|
||||
*
|
||||
* This program is distributed under the GNU General Public License, version 2.
|
||||
* A copy of this license is included with this source.
|
||||
*
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org>,
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org>,
|
||||
* Michael Smith <msmith@xiph.org>,
|
||||
* oddsock <oddsock@xiph.org>,
|
||||
* Karl Heyes <karl@xiph.org>
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This program is distributed under the GNU General Public License, version 2.
|
||||
* A copy of this license is included with this source.
|
||||
*
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Michael Smith <msmith@xiph.org>,
|
||||
* oddsock <oddsock@xiph.org>,
|
||||
* Karl Heyes <karl@xiph.org>
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This program is distributed under the GNU General Public License, version 2.
|
||||
* A copy of this license is included with this source.
|
||||
*
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Michael Smith <msmith@xiph.org>,
|
||||
* oddsock <oddsock@xiph.org>,
|
||||
* Karl Heyes <karl@xiph.org>
|
||||
@ -35,7 +35,7 @@
|
||||
#include "logging.h"
|
||||
|
||||
|
||||
typedef struct vorbis_codec_tag
|
||||
typedef struct vorbis_codec_tag
|
||||
{
|
||||
vorbis_info vi;
|
||||
|
||||
@ -229,7 +229,7 @@ static void initiate_flush (vorbis_codec_t *source_vorbis)
|
||||
}
|
||||
|
||||
|
||||
/* process the vorbis audio packets. Here we just take each packet out
|
||||
/* process the vorbis audio packets. Here we just take each packet out
|
||||
* and add them into the new stream, flushing after so many samples. We
|
||||
* also check if an new headers are requested after each processed page
|
||||
*/
|
||||
@ -410,7 +410,7 @@ ogg_codec_t *initial_vorbis_page (format_plugin_t *plugin, ogg_page *page)
|
||||
* and schedule a new set of header pages
|
||||
*/
|
||||
static void vorbis_set_tag (format_plugin_t *plugin, const char *tag, const char *in_value, const char *charset)
|
||||
{
|
||||
{
|
||||
ogg_state_t *ogg_info = plugin->_state;
|
||||
ogg_codec_t *codec = ogg_info->codecs;
|
||||
vorbis_codec_t *source_vorbis;
|
||||
|
12
src/fserve.c
12
src/fserve.c
@ -3,7 +3,7 @@
|
||||
* This program is distributed under the GNU General Public License, version 2.
|
||||
* A copy of this license is included with this source.
|
||||
*
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Michael Smith <msmith@xiph.org>,
|
||||
* oddsock <oddsock@xiph.org>,
|
||||
* Karl Heyes <karl@xiph.org>
|
||||
@ -452,7 +452,7 @@ int fserve_client_create (client_t *httpclient, const char *path)
|
||||
char *sourceuri = strdup (path);
|
||||
char *dot = strrchr(sourceuri, '.');
|
||||
|
||||
/* at least a couple of players (fb2k/winamp) are reported to send a
|
||||
/* at least a couple of players (fb2k/winamp) are reported to send a
|
||||
* host header but without the port number. So if we are missing the
|
||||
* port then lets treat it as if no host line was sent */
|
||||
if (host && strchr (host, ':') == NULL)
|
||||
@ -472,7 +472,7 @@ int fserve_client_create (client_t *httpclient, const char *path)
|
||||
{
|
||||
config = config_get_config();
|
||||
snprintf (httpclient->refbuf->data + ret, BUFSIZE - ret,
|
||||
"http://%s:%d%s\r\n",
|
||||
"http://%s:%d%s\r\n",
|
||||
config->hostname, config->port,
|
||||
sourceuri
|
||||
);
|
||||
@ -481,8 +481,8 @@ int fserve_client_create (client_t *httpclient, const char *path)
|
||||
else
|
||||
{
|
||||
snprintf (httpclient->refbuf->data + ret, BUFSIZE - ret,
|
||||
"http://%s%s\r\n",
|
||||
host,
|
||||
"http://%s%s\r\n",
|
||||
host,
|
||||
sourceuri
|
||||
);
|
||||
}
|
||||
@ -630,7 +630,7 @@ int fserve_client_create (client_t *httpclient, const char *path)
|
||||
fail:
|
||||
fclose (file);
|
||||
httpclient->respcode = 416;
|
||||
sock_write (httpclient->con->sock,
|
||||
sock_write (httpclient->con->sock,
|
||||
"HTTP/1.0 416 Request Range Not Satisfiable\r\n\r\n");
|
||||
client_destroy (httpclient);
|
||||
return -1;
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This program is distributed under the GNU General Public License, version 2.
|
||||
* A copy of this license is included with this source.
|
||||
*
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Michael Smith <msmith@xiph.org>,
|
||||
* oddsock <oddsock@xiph.org>,
|
||||
* Karl Heyes <karl@xiph.org>
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This program is distributed under the GNU General Public License, version 2.
|
||||
* A copy of this license is included with this source.
|
||||
*
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Michael Smith <msmith@xiph.org>,
|
||||
* oddsock <oddsock@xiph.org>,
|
||||
* Karl Heyes <karl@xiph.org>
|
||||
@ -103,7 +103,7 @@ int get_clf_time (char *buffer, unsigned len, struct tm *t)
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
/*
|
||||
** ADDR IDENT USER DATE REQUEST CODE BYTES REFERER AGENT [TIME]
|
||||
**
|
||||
** ADDR = client->con->ip
|
||||
@ -139,7 +139,7 @@ void logging_access(client_t *client)
|
||||
stayed = now - client->con->con_time;
|
||||
|
||||
if (client->username == NULL)
|
||||
username = "-";
|
||||
username = "-";
|
||||
else
|
||||
username = client->username;
|
||||
|
||||
|
16
src/main.c
16
src/main.c
@ -3,7 +3,7 @@
|
||||
* This program is distributed under the GNU General Public License, version 2.
|
||||
* A copy of this license is included with this source.
|
||||
*
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Michael Smith <msmith@xiph.org>,
|
||||
* oddsock <oddsock@xiph.org>,
|
||||
* Karl Heyes <karl@xiph.org>,
|
||||
@ -243,7 +243,7 @@ static int _start_logging(void)
|
||||
|
||||
if (errorlog < 0) {
|
||||
buf[sizeof(buf)-1] = 0;
|
||||
snprintf(buf, sizeof(buf)-1,
|
||||
snprintf(buf, sizeof(buf)-1,
|
||||
"FATAL: could not open error logging (%s): %s",
|
||||
log_to_stderr?"standard error":fn_error,
|
||||
strerror(errno));
|
||||
@ -277,7 +277,7 @@ static int _start_logging(void)
|
||||
playlistlog = log_open(fn_playlist);
|
||||
if (playlistlog < 0) {
|
||||
buf[sizeof(buf)-1] = 0;
|
||||
snprintf(buf, sizeof(buf)-1,
|
||||
snprintf(buf, sizeof(buf)-1,
|
||||
"FATAL: could not open playlist logging (%s): %s",
|
||||
log_to_stderr?"standard error":fn_playlist,
|
||||
strerror(errno));
|
||||
@ -296,7 +296,7 @@ static int _start_logging(void)
|
||||
log_set_level(playlistlog, 4);
|
||||
|
||||
if (errorlog >= 0 && accesslog >= 0) return 1;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -403,7 +403,7 @@ static void _ch_root_uid_setup(void)
|
||||
else
|
||||
fprintf(stdout, "Changed root successfully to \"%s\".\n", conf->base_dir);
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_SETUID
|
||||
@ -514,7 +514,7 @@ int main(int argc, char **argv)
|
||||
config_release_config();
|
||||
if (ret < 0) {
|
||||
memset(pbuf, '\000', sizeof(pbuf));
|
||||
snprintf(pbuf, sizeof(pbuf)-1,
|
||||
snprintf(pbuf, sizeof(pbuf)-1,
|
||||
"FATAL: error parsing config file (%s)", filename);
|
||||
_fatal_error(pbuf);
|
||||
switch (ret) {
|
||||
@ -540,7 +540,7 @@ int main(int argc, char **argv)
|
||||
_print_usage();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* override config file options with commandline options */
|
||||
config_parse_cmdline(argc, argv);
|
||||
|
||||
@ -558,7 +558,7 @@ int main(int argc, char **argv)
|
||||
stats_initialize(); /* We have to do this later on because of threading */
|
||||
fserve_initialize(); /* This too */
|
||||
|
||||
#ifdef HAVE_SETUID
|
||||
#ifdef HAVE_SETUID
|
||||
/* We'll only have getuid() if we also have setuid(), it's reasonable to
|
||||
* assume */
|
||||
if(!getuid()) /* Running as root! Don't allow this */
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This program is distributed under the GNU General Public License, version 2.
|
||||
* A copy of this license is included with this source.
|
||||
*
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Michael Smith <msmith@xiph.org>,
|
||||
* oddsock <oddsock@xiph.org>,
|
||||
* Karl Heyes <karl@xiph.org>
|
||||
@ -80,7 +80,7 @@ void MD5Init(struct MD5Context *ctx)
|
||||
* Update context to reflect the concatenation of another buffer full
|
||||
* of bytes.
|
||||
*/
|
||||
void MD5Update(struct MD5Context *ctx, unsigned char const *buf,
|
||||
void MD5Update(struct MD5Context *ctx, unsigned char const *buf,
|
||||
unsigned len)
|
||||
{
|
||||
uint32_t t;
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This program is distributed under the GNU General Public License, version 2.
|
||||
* A copy of this license is included with this source.
|
||||
*
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Michael Smith <msmith@xiph.org>,
|
||||
* oddsock <oddsock@xiph.org>,
|
||||
* Karl Heyes <karl@xiph.org>
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This program is distributed under the GNU General Public License, version 2.
|
||||
* A copy of this license is included with this source.
|
||||
*
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Michael Smith <msmith@xiph.org>,
|
||||
* oddsock <oddsock@xiph.org>,
|
||||
* Karl Heyes <karl@xiph.org>
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This program is distributed under the GNU General Public License, version 2.
|
||||
* A copy of this license is included with this source.
|
||||
*
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Michael Smith <msmith@xiph.org>,
|
||||
* oddsock <oddsock@xiph.org>,
|
||||
* Karl Heyes <karl@xiph.org>
|
||||
@ -700,7 +700,7 @@ static int update_from_master(ice_config_t *config)
|
||||
|
||||
thread_mutex_lock (&(config_locks()->relay_lock));
|
||||
cleanup_relays = update_relays (&global.master_relays, new_relays);
|
||||
|
||||
|
||||
relay_check_streams (global.master_relays, cleanup_relays, 0);
|
||||
relay_check_streams (NULL, new_relays, 0);
|
||||
|
||||
|
26
src/source.c
26
src/source.c
@ -3,7 +3,7 @@
|
||||
* This program is distributed under the GNU General Public License, version 2.
|
||||
* A copy of this license is included with this source.
|
||||
*
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Michael Smith <msmith@xiph.org>,
|
||||
* oddsock <oddsock@xiph.org>,
|
||||
* Karl Heyes <karl@xiph.org>
|
||||
@ -133,14 +133,14 @@ source_t *source_find_mount_raw(const char *mount)
|
||||
while (node) {
|
||||
source = (source_t *) node->key;
|
||||
cmp = strcmp(mount, source->mount);
|
||||
if (cmp < 0)
|
||||
if (cmp < 0)
|
||||
node = node->left;
|
||||
else if (cmp > 0)
|
||||
node = node->right;
|
||||
else
|
||||
return source;
|
||||
}
|
||||
|
||||
|
||||
/* didn't find it */
|
||||
return NULL;
|
||||
}
|
||||
@ -394,7 +394,7 @@ void source_move_clients(source_t *source, source_t *dest)
|
||||
client = (client_t *)(node->key);
|
||||
avl_delete (source->pending_tree, client, NULL);
|
||||
|
||||
/* when switching a client to a different queue, be wary of the
|
||||
/* when switching a client to a different queue, be wary of the
|
||||
* refbuf it's referring to, if it's http headers then we need
|
||||
* to write them so don't release it.
|
||||
*/
|
||||
@ -419,7 +419,7 @@ void source_move_clients(source_t *source, source_t *dest)
|
||||
client = (client_t *)(node->key);
|
||||
avl_delete (source->client_tree, client, NULL);
|
||||
|
||||
/* when switching a client to a different queue, be wary of the
|
||||
/* when switching a client to a different queue, be wary of the
|
||||
* refbuf it's referring to, if it's http headers then we need
|
||||
* to write them so don't release it.
|
||||
*/
|
||||
@ -525,8 +525,8 @@ static refbuf_t *get_next_buffer (source_t *source)
|
||||
/* general send routine per listener. The deletion_expected tells us whether
|
||||
* the last in the queue is about to disappear, so if this client is still
|
||||
* referring to it after writing then drop the client as it's fallen too far
|
||||
* behind
|
||||
*/
|
||||
* behind
|
||||
*/
|
||||
static void send_to_listener (source_t *source, client_t *client, int deletion_expected)
|
||||
{
|
||||
int bytes;
|
||||
@ -772,8 +772,8 @@ void source_main (source_t *source)
|
||||
client_node = avl_get_first(source->pending_tree);
|
||||
while (client_node) {
|
||||
|
||||
if(source->max_listeners != -1 &&
|
||||
source->listeners >= (unsigned long)source->max_listeners)
|
||||
if(source->max_listeners != -1 &&
|
||||
source->listeners >= (unsigned long)source->max_listeners)
|
||||
{
|
||||
/* The common case is caught in the main connection handler,
|
||||
* this deals with rarer cases (mostly concerning fallbacks)
|
||||
@ -788,7 +788,7 @@ void source_main (source_t *source)
|
||||
"mountpoint (%s).", source->mount);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/* Otherwise, the client is accepted, add it */
|
||||
avl_insert(source->client_tree, client_node->key);
|
||||
|
||||
@ -801,8 +801,8 @@ void source_main (source_t *source)
|
||||
|
||||
/** clear pending tree **/
|
||||
while (avl_get_first(source->pending_tree)) {
|
||||
avl_delete(source->pending_tree,
|
||||
avl_get_first(source->pending_tree)->key,
|
||||
avl_delete(source->pending_tree,
|
||||
avl_get_first(source->pending_tree)->key,
|
||||
source_remove_client);
|
||||
}
|
||||
|
||||
@ -925,7 +925,7 @@ static int _free_client(void *key)
|
||||
client_send_error(client, 404, 0, "Mount unavailable");
|
||||
else
|
||||
client_destroy(client);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
22
src/stats.c
22
src/stats.c
@ -3,7 +3,7 @@
|
||||
* This program is distributed under the GNU General Public License, version 2.
|
||||
* A copy of this license is included with this source.
|
||||
*
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Michael Smith <msmith@xiph.org>,
|
||||
* oddsock <oddsock@xiph.org>,
|
||||
* Karl Heyes <karl@xiph.org>
|
||||
@ -193,7 +193,7 @@ void stats_shutdown(void)
|
||||
stats_t *stats_get_stats(void)
|
||||
{
|
||||
/* lock global stats
|
||||
|
||||
|
||||
copy stats
|
||||
|
||||
unlock global stats
|
||||
@ -378,14 +378,14 @@ static stats_node_t *_find_node(avl_tree *stats_tree, const char *name)
|
||||
while (node) {
|
||||
stats = (stats_node_t *) node->key;
|
||||
cmp = strcmp(name, stats->name);
|
||||
if (cmp < 0)
|
||||
if (cmp < 0)
|
||||
node = node->left;
|
||||
else if (cmp > 0)
|
||||
node = node->right;
|
||||
else
|
||||
return stats;
|
||||
}
|
||||
|
||||
|
||||
/* didn't find it */
|
||||
return NULL;
|
||||
}
|
||||
@ -419,7 +419,7 @@ static stats_source_t *_find_source(avl_tree *source_tree, const char *source)
|
||||
static stats_event_t *_copy_event(stats_event_t *event)
|
||||
{
|
||||
stats_event_t *copy = (stats_event_t *)calloc(1, sizeof(stats_event_t));
|
||||
if (event->source)
|
||||
if (event->source)
|
||||
copy->source = (char *)strdup(event->source);
|
||||
else
|
||||
copy->source = NULL;
|
||||
@ -708,7 +708,7 @@ static void *_stats_thread(void *arg)
|
||||
process_global_event (event);
|
||||
else
|
||||
process_source_event (event);
|
||||
|
||||
|
||||
/* now we have an event that's been processed into the running stats */
|
||||
/* this event should get copied to event listeners' queues */
|
||||
listener = (event_listener_t *)_event_listeners;
|
||||
@ -759,7 +759,7 @@ static void _unregister_listener(event_listener_t *listener)
|
||||
static stats_event_t *_make_event_from_node(stats_node_t *node, char *source)
|
||||
{
|
||||
stats_event_t *event = (stats_event_t *)malloc(sizeof(stats_event_t));
|
||||
|
||||
|
||||
if (source != NULL)
|
||||
event->source = (char *)strdup(source);
|
||||
else
|
||||
@ -836,7 +836,7 @@ static xmlNodePtr _dump_stats_to_doc (xmlNodePtr root, const char *show_mount, i
|
||||
thread_mutex_lock(&_stats_mutex);
|
||||
/* general stats first */
|
||||
avlnode = avl_get_first(_stats.global_tree);
|
||||
|
||||
|
||||
while (avlnode) {
|
||||
stats_node_t *stat = avlnode->key;
|
||||
if (stat->hidden <= hidden)
|
||||
@ -896,7 +896,7 @@ static xmlNodePtr _dump_stats_to_doc (xmlNodePtr root, const char *show_mount, i
|
||||
|
||||
|
||||
/* factoring out code for stats loops
|
||||
** this function copies all stats to queue, and registers
|
||||
** this function copies all stats to queue, and registers
|
||||
** the queue for all new events atomically.
|
||||
** note: mutex must already be created!
|
||||
*/
|
||||
@ -931,7 +931,7 @@ static void _register_listener (event_listener_t *listener)
|
||||
|
||||
node2 = avl_get_next(node2);
|
||||
}
|
||||
|
||||
|
||||
node = avl_get_next(node);
|
||||
}
|
||||
|
||||
@ -1092,7 +1092,7 @@ static int _free_stats(void *key)
|
||||
free(node->value);
|
||||
free(node->name);
|
||||
free(node);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
14
src/util.c
14
src/util.c
@ -3,7 +3,7 @@
|
||||
* This program is distributed under the GNU General Public License, version 2.
|
||||
* A copy of this license is included with this source.
|
||||
*
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Michael Smith <msmith@xiph.org>,
|
||||
* oddsock <oddsock@xiph.org>,
|
||||
* Karl Heyes <karl@xiph.org>
|
||||
@ -107,7 +107,7 @@ int util_read_header(sock_t sock, char *buff, unsigned long len, int entire)
|
||||
if ((read_bytes = recv(sock, &c, 1, 0))) {
|
||||
if (c != '\r') buff[pos++] = c;
|
||||
if (entire) {
|
||||
if ((pos > 1) && (buff[pos - 1] == '\n' &&
|
||||
if ((pos > 1) && (buff[pos - 1] == '\n' &&
|
||||
buff[pos - 2] == '\n')) {
|
||||
ret = 1;
|
||||
break;
|
||||
@ -126,7 +126,7 @@ int util_read_header(sock_t sock, char *buff, unsigned long len, int entire)
|
||||
}
|
||||
|
||||
if (ret) buff[pos] = '\0';
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -203,7 +203,7 @@ static int verify_path(char *path) {
|
||||
else
|
||||
indotseq = 0;
|
||||
}
|
||||
|
||||
|
||||
dir = 0;
|
||||
path++;
|
||||
}
|
||||
@ -266,7 +266,7 @@ char *util_url_escape (const char *src)
|
||||
{
|
||||
int len = strlen(src);
|
||||
/* Efficiency not a big concern here, keep the code simple/conservative */
|
||||
char *dst = calloc(1, len*3 + 1);
|
||||
char *dst = calloc(1, len*3 + 1);
|
||||
unsigned char *source = (unsigned char *)src;
|
||||
int i,j=0;
|
||||
|
||||
@ -793,8 +793,8 @@ int util_dict_set(util_dict *dict, const char *key, const char *val)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* given a dictionary, URL-encode each val and
|
||||
stringify it in order as key=val&key=val... if val
|
||||
/* given a dictionary, URL-encode each val and
|
||||
stringify it in order as key=val&key=val... if val
|
||||
is set, or just key&key if val is NULL.
|
||||
TODO: Memory management needs overhaul. */
|
||||
char *util_dict_urlencode(util_dict *dict, char delim)
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This program is distributed under the GNU General Public License, version 2.
|
||||
* A copy of this license is included with this source.
|
||||
*
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Michael Smith <msmith@xiph.org>,
|
||||
* oddsock <oddsock@xiph.org>,
|
||||
* Karl Heyes <karl@xiph.org>
|
||||
@ -142,7 +142,7 @@ static xsltStylesheetPtr xslt_get_stylesheet(const char *fn) {
|
||||
struct stat file;
|
||||
|
||||
if(stat(fn, &file)) {
|
||||
ICECAST_LOG_WARN("Error checking for stylesheet file \"%s\": %s", fn,
|
||||
ICECAST_LOG_WARN("Error checking for stylesheet file \"%s\": %s", fn,
|
||||
strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
@ -159,7 +159,7 @@ static xsltStylesheetPtr xslt_get_stylesheet(const char *fn) {
|
||||
if(file.st_mtime > cache[i].last_modified)
|
||||
{
|
||||
xsltFreeStylesheet(cache[i].stylesheet);
|
||||
|
||||
|
||||
cache[i].last_modified = file.st_mtime;
|
||||
cache[i].stylesheet = xsltParseStylesheetFile(XMLSTR(fn));
|
||||
cache[i].cache_age = time(NULL);
|
||||
|
6
src/yp.c
6
src/yp.c
@ -3,7 +3,7 @@
|
||||
* This program is distributed under the GNU General Public License, version 2.
|
||||
* A copy of this license is included with this source.
|
||||
*
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
||||
* Michael Smith <msmith@xiph.org>,
|
||||
* oddsock <oddsock@xiph.org>,
|
||||
* Karl Heyes <karl@xiph.org>
|
||||
@ -35,7 +35,7 @@
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
#define CATMODULE "yp"
|
||||
#define CATMODULE "yp"
|
||||
|
||||
struct yp_server
|
||||
{
|
||||
@ -223,7 +223,7 @@ void yp_recheck_config (ice_config_t *config)
|
||||
client_limit = config->client_limit;
|
||||
free ((char*)server_version);
|
||||
server_version = strdup (config->server_id);
|
||||
/* for each yp url in config, check to see if one exists
|
||||
/* for each yp url in config, check to see if one exists
|
||||
if not, then add it. */
|
||||
for (i=0 ; i < config->num_yp_directories; i++)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user