From 018fff1158beec4c32e6c97e46a43ba6d98496b5 Mon Sep 17 00:00:00 2001 From: Karl Heyes Date: Fri, 13 May 2005 00:35:08 +0000 Subject: [PATCH] Allow for username to be stated for master/slave setups, we still default to 'relay' though svn path=/icecast/trunk/icecast/; revision=9274 --- doc/icecast2_config_file.html | 19 +++++++++++++++++-- src/cfgfile.c | 8 +++++++- src/cfgfile.h | 1 + src/connection.c | 2 +- src/slave.c | 2 +- 5 files changed, 27 insertions(+), 5 deletions(-) diff --git a/doc/icecast2_config_file.html b/doc/icecast2_config_file.html index bdcbff36..cf30426f 100644 --- a/doc/icecast2_config_file.html +++ b/doc/icecast2_config_file.html @@ -95,6 +95,7 @@ This setting applies to all mountpoints.
     <authentication>
         <source-password>hackme</source-password>
+        <relay-user>relay</relay-user>
         <relay-password>hackme</relay-password>
         <admin-user>admin</admin-user>
         <admin-password>hackme</admin-password>
@@ -106,9 +107,15 @@ This setting applies to all mountpoints.
 
The unencrypted password used by sources to connect to icecast2. Currently, the username for all source connections must be 'source'. This is likely to change in the future.
+

relay-user

+
+Used in the master server as part of the authentication when a slave requests +the list of streams to relay. The default username is 'relay' +

relay-password

-Currently not used. +Used in the master server as part of the authentication when a slave requests +the list of streams to relay.

admin-user

admin-password

@@ -201,6 +208,7 @@ certain formats. <master-server>127.0.0.1</master-server> <master-server-port>8001</master-server-port> <master-update-interval>120</master-update-interval> + <master-username>relay</master-username> <master-password>hackme</master-password> <relay> @@ -249,9 +257,16 @@ This is the TCP Port for the server which contains the mountpoints to be relayed
The interval (in seconds) that the Relay Server will poll the Master Server for any new mountpoints to relay.
+

master-username

+
+This is the relay username on the master server. It is used to query the +server for a list of mountpoints to relay. If not specified then 'relay' is +used +

master-password

-This is the admin password on the Master server. It is used to query the server for a list of mountpoints to relay. +This is the relay password on the Master server. It is used to query the +server for a list of mountpoints to relay.

Specific Mountpoint Relay

diff --git a/src/cfgfile.c b/src/cfgfile.c index 48f21777..2e3a1de2 100644 --- a/src/cfgfile.c +++ b/src/cfgfile.c @@ -38,6 +38,7 @@ #define CONFIG_DEFAULT_SOURCE_TIMEOUT 10 #define CONFIG_DEFAULT_SOURCE_PASSWORD "changeme" #define CONFIG_DEFAULT_RELAY_PASSWORD "changeme" +#define CONFIG_DEFAULT_MASTER_USERNAME "relay" #define CONFIG_DEFAULT_SHOUTCAST_MOUNT "/stream" #define CONFIG_DEFAULT_ICE_LOGIN 0 #define CONFIG_DEFAULT_FILESERVE 1 @@ -163,6 +164,7 @@ void config_clear(ice_config_t *c) if (c->listeners[i].bind_address) xmlFree(c->listeners[i].bind_address); } if (c->master_server) xmlFree(c->master_server); + if (c->master_username) xmlFree(c->master_username); if (c->master_password) xmlFree(c->master_password); if (c->user) xmlFree(c->user); if (c->group) xmlFree(c->group); @@ -341,6 +343,7 @@ static void _set_defaults(ice_config_t *configuration) configuration->master_server = NULL; configuration->master_server_port = 0; configuration->master_update_interval = CONFIG_MASTER_UPDATE_INTERVAL; + configuration->master_username = xmlStrdup (CONFIG_DEFAULT_MASTER_USERNAME); configuration->master_password = NULL; configuration->base_dir = CONFIG_DEFAULT_BASE_DIR; configuration->log_dir = CONFIG_DEFAULT_LOG_DIR; @@ -355,7 +358,7 @@ static void _set_defaults(ice_config_t *configuration) configuration->user = CONFIG_DEFAULT_USER; configuration->group = CONFIG_DEFAULT_GROUP; configuration->num_yp_directories = 0; - configuration->relay_username = NULL; + configuration->relay_username = xmlStrdup (CONFIG_DEFAULT_MASTER_USERNAME); configuration->relay_password = NULL; /* default to a typical prebuffer size used by clients */ configuration->burst_size = 65536; @@ -414,6 +417,9 @@ static void _parse_root(xmlDocPtr doc, xmlNodePtr node, } else if (strcmp(node->name, "master-server") == 0) { if (configuration->master_server) xmlFree(configuration->master_server); configuration->master_server = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1); + } else if (strcmp(node->name, "master-username") == 0) { + if (configuration->master_username) xmlFree(configuration->master_username); + configuration->master_username = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1); } else if (strcmp(node->name, "master-password") == 0) { if (configuration->master_password) xmlFree(configuration->master_password); configuration->master_password = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1); diff --git a/src/cfgfile.h b/src/cfgfile.h index fababb8f..5f57a648 100644 --- a/src/cfgfile.h +++ b/src/cfgfile.h @@ -118,6 +118,7 @@ typedef struct ice_config_tag char *master_server; int master_server_port; int master_update_interval; + char *master_username; char *master_password; relay_server *relay; diff --git a/src/connection.c b/src/connection.c index e4ceb63a..c2173470 100644 --- a/src/connection.c +++ b/src/connection.c @@ -634,7 +634,7 @@ int connection_check_relay_pass(http_parser_t *parser) int ret; ice_config_t *config = config_get_config(); char *pass = config->relay_password; - char *user = "relay"; + char *user = config->relay_username; if(!pass || !user) { config_release_config(); diff --git a/src/slave.c b/src/slave.c index c6326ef1..f2a81503 100644 --- a/src/slave.c +++ b/src/slave.c @@ -409,7 +409,7 @@ static int update_from_master(ice_config_t *config) relay_server *new_relays = NULL, *cleanup_relays; int len, count = 1; - username = strdup ("relay"); + username = strdup (config->master_username); if (config->master_password) password = strdup (config->master_password);