[xiph-commits] r8232 - icecast/trunk/icecast/src

karl at motherfish-iii.xiph.org karl at motherfish-iii.xiph.org
Fri Nov 19 07:05:37 PST 2004


Author: karl
Date: 2004-11-19 07:05:36 -0800 (Fri, 19 Nov 2004)
New Revision: 8232

Modified:
   icecast/trunk/icecast/src/admin.c
   icecast/trunk/icecast/src/connection.c
Log:
allow for shoutcast metadata updates to auth with admin/per-mount/global
source password


Modified: icecast/trunk/icecast/src/admin.c
===================================================================
--- icecast/trunk/icecast/src/admin.c	2004-11-19 07:51:22 UTC (rev 8231)
+++ icecast/trunk/icecast/src/admin.c	2004-11-19 15:05:36 UTC (rev 8232)
@@ -301,10 +301,18 @@
 
     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,21 +857,13 @@
 {
     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");
         return;
@@ -875,17 +875,6 @@
         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);

Modified: icecast/trunk/icecast/src/connection.c
===================================================================
--- icecast/trunk/icecast/src/connection.c	2004-11-19 07:51:22 UTC (rev 8231)
+++ icecast/trunk/icecast/src/connection.c	2004-11-19 15:05:36 UTC (rev 8232)
@@ -603,13 +603,18 @@
     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;
 }



More information about the commits mailing list