1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-06-23 06:25:24 +00:00

Allow for username to be stated for master/slave setups, we still default

to 'relay' though

svn path=/icecast/trunk/icecast/; revision=9274
This commit is contained in:
Karl Heyes 2005-05-13 00:35:08 +00:00
parent a922caa7f4
commit 018fff1158
5 changed files with 27 additions and 5 deletions

View File

@ -95,6 +95,7 @@ This setting applies to all mountpoints.
<pre>
&lt;authentication&gt;
&lt;source-password&gt;hackme&lt;/source-password&gt;
&lt;relay-user&gt;relay&lt;/relay-user&gt;
&lt;relay-password&gt;hackme&lt;/relay-password&gt;
&lt;admin-user&gt;admin&lt;/admin-user&gt;
&lt;admin-password&gt;hackme&lt;/admin-password&gt;
@ -106,9 +107,15 @@ This setting applies to all mountpoints.
<div class="indentedbox">
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.
</div>
<h4>relay-user</h4>
<div class="indentedbox">
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'
</div>
<h4>relay-password</h4>
<div class="indentedbox">
Currently not used.
Used in the master server as part of the authentication when a slave requests
the list of streams to relay.
</div>
<h4>admin-user</h4>
<h4>admin-password</h4>
@ -201,6 +208,7 @@ certain formats.
&lt;master-server&gt;127.0.0.1&lt;/master-server&gt;
&lt;master-server-port&gt;8001&lt;/master-server-port&gt;
&lt;master-update-interval&gt;120&lt;/master-update-interval&gt;
&lt;master-username&gt;relay&lt;/master-username&gt;
&lt;master-password&gt;hackme&lt;/master-password&gt;
&lt;relay&gt;
@ -249,9 +257,16 @@ This is the TCP Port for the server which contains the mountpoints to be relayed
<div class="indentedbox">
The interval (in seconds) that the Relay Server will poll the Master Server for any new mountpoints to relay.
</div>
<h4>master-username</h4>
<div class="indentedbox">
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
</div>
<h4>master-password</h4>
<div class="indentedbox">
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.
</div>
<br />
<h3>Specific Mountpoint Relay</h3>

View File

@ -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);

View File

@ -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;

View File

@ -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();

View File

@ -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);