mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-12-04 14:46:30 -05:00
allow for shoutcast metadata updates to auth with admin/per-mount/global
source password svn path=/icecast/trunk/icecast/; revision=8232
This commit is contained in:
parent
731f24d050
commit
889e260490
31
src/admin.c
31
src/admin.c
@ -301,10 +301,18 @@ void admin_handle_request(client_t *client, char *uri)
|
||||
|
||||
if (command == COMMAND_SHOUTCAST_METADATA_UPDATE) {
|
||||
|
||||
ice_config_t *config = config_get_config ();
|
||||
ice_config_t *config;
|
||||
char *pass = httpp_get_query_param (client->parser, "pass");
|
||||
if (pass == NULL)
|
||||
{
|
||||
client_send_400 (client, "missing pass parameter");
|
||||
return;
|
||||
}
|
||||
config = config_get_config ();
|
||||
httpp_set_query_param (client->parser, "mount", config->shoutcast_mount);
|
||||
httpp_setvar (client->parser, HTTPP_VAR_PROTOCOL, "ICY");
|
||||
httpp_setvar (client->parser, HTTPP_VAR_ICYPASSWORD, pass);
|
||||
config_release_config ();
|
||||
noauth = 1;
|
||||
}
|
||||
|
||||
mount = httpp_get_query_param(client->parser, "mount");
|
||||
@ -849,20 +857,12 @@ static void command_shoutcast_metadata(client_t *client, source_t *source)
|
||||
{
|
||||
char *action;
|
||||
char *value;
|
||||
char *source_pass;
|
||||
char *config_source_pass;
|
||||
ice_config_t *config;
|
||||
mp3_state *state;
|
||||
|
||||
DEBUG0("Got shoutcast metadata update request");
|
||||
|
||||
COMMAND_REQUIRE(client, "mode", action);
|
||||
COMMAND_REQUIRE(client, "song", value);
|
||||
COMMAND_REQUIRE(client, "pass", source_pass);
|
||||
|
||||
config = config_get_config();
|
||||
config_source_pass = strdup(config->source_password);
|
||||
config_release_config();
|
||||
|
||||
if (source->format->type == FORMAT_TYPE_VORBIS) {
|
||||
client_send_400 (client, "Cannot update metadata on vorbis streams");
|
||||
@ -875,17 +875,6 @@ static void command_shoutcast_metadata(client_t *client, source_t *source)
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(source_pass, config_source_pass) != 0)
|
||||
{
|
||||
ERROR0("Invalid source password specified, metadata not updated");
|
||||
client_send_400 (client, "Invalid source password");
|
||||
return;
|
||||
}
|
||||
|
||||
if (config_source_pass) {
|
||||
free(config_source_pass);
|
||||
}
|
||||
|
||||
state = source->format->_state;
|
||||
|
||||
mp3_set_tag (source->format, "title", value);
|
||||
|
@ -603,13 +603,18 @@ int connection_check_admin_pass(http_parser_t *parser)
|
||||
ice_config_t *config = config_get_config();
|
||||
char *pass = config->admin_password;
|
||||
char *user = config->admin_username;
|
||||
char *protocol;
|
||||
|
||||
if(!pass || !user) {
|
||||
config_release_config();
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = _check_pass_http(parser, user, pass);
|
||||
protocol = httpp_getvar (parser, HTTPP_VAR_PROTOCOL);
|
||||
if (protocol && strcmp (protocol, "ICY") == 0)
|
||||
ret = _check_pass_icy (parser, pass);
|
||||
else
|
||||
ret = _check_pass_http (parser, user, pass);
|
||||
config_release_config();
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user