diff --git a/src/admin.c b/src/admin.c index dc340070a1703534afc3511c957bf18b7c463970..4d27e50b817352a919b1d26e8e127b28165ff8b1 100644 --- a/src/admin.c +++ b/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); diff --git a/src/connection.c b/src/connection.c index 347f4474e69d47c841a2ec31d505a584a1264e6c..f50fa097ea94626d5e0741800fd6ff3cab4a249d 100644 --- a/src/connection.c +++ b/src/connection.c @@ -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; }