mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-11-03 04:17:17 -05:00
Fix: Fixed regression for ICY source client's auth
This allows ICY source clients to log in again with 2.4.x-style config. ICY does not provide a username. Therefore the username was unset. This patch sets the username for ICY source connections and allow them to be handled as if a username was provided. Configuration tag <shoutcast-user> was added to select the username to set to. This defaults to "source".
This commit is contained in:
parent
578366e541
commit
bcc0e86ca0
@ -55,6 +55,7 @@
|
||||
#define CONFIG_DEFAULT_SOURCE_TIMEOUT 10
|
||||
#define CONFIG_DEFAULT_MASTER_USERNAME "relay"
|
||||
#define CONFIG_DEFAULT_SHOUTCAST_MOUNT "/stream"
|
||||
#define CONFIG_DEFAULT_SHOUTCAST_USER "source"
|
||||
#define CONFIG_DEFAULT_FILESERVE 1
|
||||
#define CONFIG_DEFAULT_TOUCH_FREQ 5
|
||||
#define CONFIG_DEFAULT_HOSTNAME "localhost"
|
||||
@ -595,6 +596,7 @@ void config_clear(ice_config_t *c)
|
||||
if (c->access_log) xmlFree(c->access_log);
|
||||
if (c->error_log) xmlFree(c->error_log);
|
||||
if (c->shoutcast_mount) xmlFree(c->shoutcast_mount);
|
||||
if (c->shoutcast_user) xmlFree(c->shoutcast_user);
|
||||
if (c->authstack) auth_stack_release(c->authstack);
|
||||
if (c->master_server) xmlFree(c->master_server);
|
||||
if (c->master_username) xmlFree(c->master_username);
|
||||
@ -799,6 +801,8 @@ static void _set_defaults(ice_config_t *configuration)
|
||||
->source_timeout = CONFIG_DEFAULT_SOURCE_TIMEOUT;
|
||||
configuration
|
||||
->shoutcast_mount = (char *) xmlCharStrdup(CONFIG_DEFAULT_SHOUTCAST_MOUNT);
|
||||
configuration
|
||||
->shoutcast_user = (char *) xmlCharStrdup(CONFIG_DEFAULT_SHOUTCAST_USER);
|
||||
configuration
|
||||
->fileserve = CONFIG_DEFAULT_FILESERVE;
|
||||
configuration
|
||||
@ -1817,6 +1821,10 @@ static void _parse_authentication(xmlDocPtr doc, xmlNodePtr node,
|
||||
if(relay_username)
|
||||
xmlFree(relay_username);
|
||||
relay_username = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
|
||||
} else if (xmlStrcmp(node->name, XMLSTR("shoutcast-user")) == 0) {
|
||||
if (configuration->shoutcast_user)
|
||||
xmlFree(configuration->shoutcast_user);
|
||||
configuration->shoutcast_user = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
|
||||
} else if (xmlStrcmp(node->name, XMLSTR("role")) == 0) {
|
||||
auth_t *auth = auth_get_authenticator(node);
|
||||
auth_stack_push(&new_style, auth);
|
||||
|
@ -198,6 +198,7 @@ typedef struct ice_config_tag {
|
||||
int on_demand; /* global setting for all relays */
|
||||
|
||||
char *shoutcast_mount;
|
||||
char *shoutcast_user;
|
||||
struct auth_stack_tag *authstack;
|
||||
|
||||
struct event_registration_tag *event;
|
||||
|
@ -1019,6 +1019,9 @@ static void _handle_shoutcast_compatible(client_queue_t *node)
|
||||
*ptr = '\0';
|
||||
|
||||
client->password = strdup(client->refbuf->data);
|
||||
config = config_get_config();
|
||||
client->username = strdup(config->shoutcast_user);
|
||||
config_release_config();
|
||||
node->offset -= (headers - client->refbuf->data);
|
||||
memmove(client->refbuf->data, headers, node->offset+1);
|
||||
node->shoutcast = 2;
|
||||
|
Loading…
Reference in New Issue
Block a user