[xiph-commits] r10807 - in icecast/branches/kh/icecast: . src win32

karl at svn.xiph.org karl at svn.xiph.org
Sun Feb 12 13:50:42 PST 2006


Author: karl
Date: 2006-02-12 13:50:10 -0800 (Sun, 12 Feb 2006)
New Revision: 10807

Removed:
   icecast/branches/kh/icecast/src/os.h
Modified:
   icecast/branches/kh/icecast/configure.in
   icecast/branches/kh/icecast/src/Makefile.am
   icecast/branches/kh/icecast/src/admin.c
   icecast/branches/kh/icecast/src/admin.h
   icecast/branches/kh/icecast/src/auth.c
   icecast/branches/kh/icecast/src/auth.h
   icecast/branches/kh/icecast/src/auth_htpasswd.c
   icecast/branches/kh/icecast/src/auth_url.c
   icecast/branches/kh/icecast/src/cfgfile.c
   icecast/branches/kh/icecast/src/cfgfile.h
   icecast/branches/kh/icecast/src/client.c
   icecast/branches/kh/icecast/src/client.h
   icecast/branches/kh/icecast/src/compat.h
   icecast/branches/kh/icecast/src/connection.c
   icecast/branches/kh/icecast/src/connection.h
   icecast/branches/kh/icecast/src/format.c
   icecast/branches/kh/icecast/src/format_flac.c
   icecast/branches/kh/icecast/src/format_mp3.c
   icecast/branches/kh/icecast/src/format_ogg.c
   icecast/branches/kh/icecast/src/format_vorbis.c
   icecast/branches/kh/icecast/src/fserve.c
   icecast/branches/kh/icecast/src/logging.c
   icecast/branches/kh/icecast/src/logging.h
   icecast/branches/kh/icecast/src/main.c
   icecast/branches/kh/icecast/src/md5.c
   icecast/branches/kh/icecast/src/md5.h
   icecast/branches/kh/icecast/src/refbuf.c
   icecast/branches/kh/icecast/src/refbuf.h
   icecast/branches/kh/icecast/src/slave.c
   icecast/branches/kh/icecast/src/slave.h
   icecast/branches/kh/icecast/src/source.c
   icecast/branches/kh/icecast/src/source.h
   icecast/branches/kh/icecast/src/stats.c
   icecast/branches/kh/icecast/src/stats.h
   icecast/branches/kh/icecast/src/util.c
   icecast/branches/kh/icecast/src/util.h
   icecast/branches/kh/icecast/src/xslt.c
   icecast/branches/kh/icecast/src/xslt.h
   icecast/branches/kh/icecast/src/yp.c
   icecast/branches/kh/icecast/src/yp.h
   icecast/branches/kh/icecast/win32/Icecast2win.clw
   icecast/branches/kh/icecast/win32/Icecast2win.cpp
   icecast/branches/kh/icecast/win32/Icecast2win.dsp
   icecast/branches/kh/icecast/win32/Icecast2win.dsw
   icecast/branches/kh/icecast/win32/Icecast2win.rc
   icecast/branches/kh/icecast/win32/Icecast2winDlg.cpp
   icecast/branches/kh/icecast/win32/Icecast2winDlg.h
   icecast/branches/kh/icecast/win32/Makefile.am
   icecast/branches/kh/icecast/win32/icecast.dsp
   icecast/branches/kh/icecast/win32/icecast2.iss
   icecast/branches/kh/icecast/win32/icecast2_console.dsp
   icecast/branches/kh/icecast/win32/resource.h
Log:
commit work that has accumulated. mainly source auth via authenticator and
cleanup of type warnings from gcc4.x. 


Modified: icecast/branches/kh/icecast/configure.in
===================================================================
--- icecast/branches/kh/icecast/configure.in	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/configure.in	2006-02-12 21:50:10 UTC (rev 10807)
@@ -53,12 +53,14 @@
 
 dnl Checks for header files.
 AC_HEADER_STDC
+AC_HEADER_TIME
 
 AC_CHECK_HEADERS([alloca.h])
 AC_CHECK_HEADERS(pwd.h, AC_DEFINE(CHUID, 1, [Define if you have pwd.h]),,)
 AC_CHECK_HEADERS(unistd.h, AC_DEFINE(CHROOT, 1, [Define if you have unistd.h]),,)
 
 dnl Checks for typedefs, structures, and compiler characteristics.
+XIPH_C__FUNC__
 
 dnl Check for types
 

Modified: icecast/branches/kh/icecast/src/Makefile.am
===================================================================
--- icecast/branches/kh/icecast/src/Makefile.am	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/Makefile.am	2006-02-12 21:50:10 UTC (rev 10807)
@@ -6,7 +6,7 @@
 
 bin_PROGRAMS = icecast
 
-noinst_HEADERS = admin.h cfgfile.h os.h logging.h sighandler.h connection.h \
+noinst_HEADERS = admin.h cfgfile.h logging.h sighandler.h connection.h \
     global.h util.h slave.h source.h stats.h refbuf.h client.h \
     compat.h fserve.h xslt.h yp.h event.h md5.h \
     auth.h auth_htpasswd.h auth_cmd.h auth_url.h \

Modified: icecast/branches/kh/icecast/src/admin.c
===================================================================
--- icecast/branches/kh/icecast/src/admin.c	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/admin.c	2006-02-12 21:50:10 UTC (rev 10807)
@@ -30,9 +30,10 @@
 #include "global.h"
 #include "event.h"
 #include "stats.h"
-#include "os.h"
+#include "compat.h"
 #include "xslt.h"
 #include "fserve.h"
+#include "admin.h"
 
 #include "format.h"
 
@@ -121,8 +122,18 @@
 #define TRANSFORMED 2
 #define PLAINTEXT   3
 
-int admin_get_command(char *command)
+static int admin_get_command (const char *uri)
 {
+    const char *command;
+
+    if (strcmp(uri, "/admin.cgi") == 0)
+    {
+        INFO0("(admin.cgi)");
+        return COMMAND_SHOUTCAST_METADATA_UPDATE;
+    }
+    command = uri + 7;
+    INFO1("(%s)", uri);
+
     if(!strcmp(command, FALLBACK_RAW_REQUEST))
         return COMMAND_RAW_FALLBACK;
     else if(!strcmp(command, FALLBACK_TRANSFORMED_REQUEST))
@@ -131,8 +142,6 @@
         return COMMAND_RAW_METADATA_UPDATE;
     else if(!strcmp(command, METADATA_TRANSFORMED_REQUEST))
         return COMMAND_TRANSFORMED_METADATA_UPDATE;
-    else if(!strcmp(command, SHOUTCAST_METADATA_REQUEST))
-        return COMMAND_SHOUTCAST_METADATA_UPDATE;
     else if(!strcmp(command, LISTCLIENTS_RAW_REQUEST))
         return COMMAND_RAW_SHOW_LISTENERS;
     else if(!strcmp(command, LISTCLIENTS_TRANSFORMED_REQUEST))
@@ -213,7 +222,7 @@
 
 static void admin_handle_mount_request(client_t *client, source_t *source,
         int command);
-static void admin_handle_general_request(client_t *client, int command);
+static void admin_handle_general_request(client_t *client, const char *command);
 static void admin_send_response(xmlDocPtr doc, client_t *client, 
         int response, char *xslt_template);
 
@@ -229,12 +238,12 @@
     char buf[22];
     time_t now = time(NULL);
 
-    doc = xmlNewDoc("1.0");
-    xmlnode = xmlNewDocNode(doc, NULL, "icestats", NULL);
+    doc = xmlNewDoc(XMLSTR("1.0"));
+    xmlnode = xmlNewDocNode(doc, NULL, XMLSTR("icestats"), NULL);
     xmlDocSetRootElement(doc, xmlnode);
 
     if (mount) {
-        xmlNewChild(xmlnode, NULL, "current_source", mount);
+        xmlNewChild(xmlnode, NULL, XMLSTR("current_source"), mount);
     }
 
     node = avl_get_first(global.source_tree);
@@ -252,7 +261,7 @@
             ice_config_t *config;
             mount_proxy *mountinfo;
 
-            srcnode = xmlNewChild (xmlnode, NULL, "source", NULL);
+            srcnode = xmlNewChild (xmlnode, NULL, XMLSTR("source"), NULL);
             xmlSetProp (srcnode, "mount", source->mount);
 
             xmlNewChild (srcnode, NULL, "fallback", 
@@ -288,7 +297,7 @@
     return(doc);
 }
 
-void admin_send_response(xmlDocPtr doc, client_t *client, 
+static void admin_send_response(xmlDocPtr doc, client_t *client, 
         int response, char *xslt_template)
 {
     if (response == RAW)
@@ -329,37 +338,60 @@
 }
 
 
-void admin_handle_request(client_t *client, char *uri)
+void admin_mount_request (client_t *client, const char *uri)
 {
-    char *mount, *command_string;
-    int command;
+    source_t *source;
+    int command = admin_get_command (uri);
+    const char *mount = httpp_get_query_param (client->parser, "mount");
 
-    DEBUG1("Admin request (%s)", uri);
-    if (!((strcmp(uri, "/admin.cgi") == 0) ||
-                (strncmp("/admin/", uri, 7) == 0))) {
-        ERROR0("Internal error: admin request isn't");
-        client_send_401(client);
-        return;
-    }
+    avl_tree_rlock(global.source_tree);
+    source = source_find_mount_raw(mount);
 
-    if (strcmp(uri, "/admin.cgi") == 0) {
-        command_string = uri + 1;
+    if (source == NULL)
+    {
+        WARN1("Admin command on non-existent source %s", mount);
+        avl_tree_unlock(global.source_tree);
+        client_send_400 (client, "Source does not exist");
     }
-    else {
-        command_string = uri + 7;
+    else
+    {
+        if (source->running == 0 && source->on_demand == 0)
+        {
+            avl_tree_unlock (global.source_tree);
+            INFO1("Received admin command on unavailable mount \"%s\"", mount);
+            client_send_400 (client, "Source is not available");
+            return;
+        }
+        if (command == COMMAND_SHOUTCAST_METADATA_UPDATE &&
+                source->shoutcast_compat == 0)
+        {
+            avl_tree_unlock (global.source_tree);
+            ERROR0 ("illegal change of metadata on non-shoutcast "
+                    "compatible stream");
+            client_send_400 (client, "illegal metadata call");
+            return;
+        }
+        admin_handle_mount_request (client, source, command);
+        avl_tree_unlock(global.source_tree);
     }
+}
 
-    DEBUG1("Got command (%s)", command_string);
-    command = admin_get_command(command_string);
 
-    if (command == COMMAND_SHOUTCAST_METADATA_UPDATE) {
+int admin_handle_request (client_t *client, const char *uri)
+{
+    char *mount;
 
+    if (strcmp (uri, "/admin.cgi") != 0 && strncmp("/admin/", uri, 7) != 0)
+        return -1;
+
+    if (strcmp (uri, "/admin.cgi") == 0)
+    {
         ice_config_t *config;
         char *pass = httpp_get_query_param (client->parser, "pass");
         if (pass == NULL)
         {
             client_send_400 (client, "missing pass parameter");
-            return;
+            return 0;
         }
         config = config_get_config ();
         httpp_set_query_param (client->parser, "mount", config->shoutcast_mount);
@@ -368,91 +400,69 @@
         config_release_config ();
     }
 
+    if (connection_check_admin_pass (client->parser))
+        client->authenticated = 1;
+
     mount = httpp_get_query_param(client->parser, "mount");
 
-    if(mount != NULL) {
-        source_t *source;
+    if (mount)
+    {
+        /* certain commands may not need auth */
+        if (strcmp (uri, BUILDM3U_RAW_REQUEST) == 0)
+            client->authenticated = 1;
 
-        if (command == COMMAND_BUILDM3U) {
-            client->authenticated = 1;
-        }
         /* This is a mount request, but admin user is allowed */
-        if (client->authenticated != 1)
+        if (client->authenticated == 0)
         {
-            if (connection_check_admin_pass(client->parser) == 0)
+            switch (connection_check_source_pass (client, uri))
             {
-                if (connection_check_source_pass(client->parser, mount) == 0)
-                {
-                    INFO1("Bad or missing password on mount modification admin "
-                            "request (command: %s)", command_string);
+                case 0:
+                    break;
+                default:
+                    INFO1("Bad or missing password on mount modification "
+                            "admin request (%s)", uri);
                     client_send_401(client);
-                    return;
-                }
+                    /* fall through */
+                case 1:
+                    return 0;
             }
         }
-        
-        avl_tree_rlock(global.source_tree);
-        source = source_find_mount_raw(mount);
+        admin_mount_request (client, uri);
+        return 0;
+    }
 
-        if (source == NULL)
+    admin_handle_general_request (client, uri);
+    return 0;
+}
+
+
+static int check_general_request_auth (client_t *client, int command)
+{
+    if (client->authenticated)
+        return 0;
+    if  (command == COMMAND_PLAINTEXT_LISTSTREAM)
+    {
+        if (connection_check_relay_pass (client->parser))
         {
-            WARN2("Admin command %s on non-existent source %s", 
-                    command_string, mount);
-            avl_tree_unlock(global.source_tree);
-            client_send_400 (client, "Source does not exist");
+            client->authenticated = 1;
+            return 0;
         }
-        else
-        {
-            if (source->running == 0 && source->on_demand == 0)
-            {
-                avl_tree_unlock (global.source_tree);
-                INFO2("Received admin command %s on unavailable mount \"%s\"",
-                        command_string, mount);
-                client_send_400 (client, "Source is not available");
-                return;
-            }
-            if (command == COMMAND_SHOUTCAST_METADATA_UPDATE &&
-                    source->shoutcast_compat == 0)
-            {
-                avl_tree_unlock (global.source_tree);
-                ERROR0 ("illegal change of metadata on non-shoutcast "
-                        "compatible stream");
-                client_send_400 (client, "illegal metadata call");
-                return;
-            }
-            INFO2("Received admin command %s on mount \"%s\"", 
-                    command_string, mount);
-            admin_handle_mount_request (client, source, command);
-            avl_tree_unlock(global.source_tree);
-        }
     }
-    else {
-        if (command == COMMAND_PLAINTEXT_LISTSTREAM) {
-            /* this request is used by a slave relay to retrieve
-               mounts from the master, so handle this request
-               validating against the relay password */
-            if(!connection_check_relay_pass(client->parser)) {
-                INFO1("Bad or missing password on admin command "
-                      "request (command: %s)", command_string);
-                client_send_401(client);
-                return;
-            }
-        }
-        else {
-            if(!connection_check_admin_pass (client->parser)) {
-                INFO1("Bad or missing password on admin command "
-                      "request (command: %s)", command_string);
-                client_send_401(client);
-                return;
-            }
-        }
-        
-        admin_handle_general_request(client, command);
-    }
+    return -1;
 }
 
-static void admin_handle_general_request(client_t *client, int command)
+
+static void admin_handle_general_request(client_t *client, const char *uri)
 {
+    int command = admin_get_command (uri);
+
+    if (check_general_request_auth (client, command) < 0)
+    {
+        INFO1("Bad or missing password on admin command request (%s)", uri);
+        client_send_401 (client);
+        return;
+    }
+
     switch(command) {
         case COMMAND_RAW_LIST_MOUNTS:
             command_list_mounts(client, RAW);
@@ -903,14 +913,14 @@
         }
     }
 
-    doc = xmlNewDoc("1.0");
-    node = xmlNewDocNode(doc, NULL, "icestats", NULL);
-    srcnode = xmlNewChild(node, NULL, "source", NULL);
-    xmlSetProp(srcnode, "mount", source->mount);
+    doc = xmlNewDoc(XMLSTR "1.0");
+    node = xmlNewDocNode(doc, NULL, XMLSTR("icestats"), NULL);
+    srcnode = xmlNewChild(node, NULL, XMLSTR("source"), NULL);
+    xmlSetProp(srcnode, XMLSTR "mount", XMLSTR(source->mount));
 
     if (message) {
-        msgnode = xmlNewChild(node, NULL, "iceresponse", NULL);
-        xmlNewChild(msgnode, NULL, "message", message);
+        msgnode = xmlNewChild(node, NULL, XMLSTR("iceresponse"), NULL);
+        xmlNewChild(msgnode, NULL, XMLSTR "message", XMLSTR(message));
     }
 
     xmlDocSetRootElement(doc, node);
@@ -934,10 +944,10 @@
     xmlDocPtr doc;
     xmlNodePtr node;
 
-    doc = xmlNewDoc("1.0");
-    node = xmlNewDocNode(doc, NULL, "iceresponse", NULL);
-    xmlNewChild(node, NULL, "message", "Source Removed");
-    xmlNewChild(node, NULL, "return", "1");
+    doc = xmlNewDoc(XMLSTR("1.0"));
+    node = xmlNewDocNode(doc, NULL, XMLSTR("iceresponse"), NULL);
+    xmlNewChild(node, NULL, XMLSTR("message"), XMLSTR("Source Removed"));
+    xmlNewChild(node, NULL, XMLSTR("return"), XMLSTR("1"));
     xmlDocSetRootElement(doc, node);
 
     source->running = 0;
@@ -964,8 +974,8 @@
     thread_mutex_lock (&source->lock);
     listener = source_find_client(source, id);
 
-    doc = xmlNewDoc("1.0");
-    node = xmlNewDocNode(doc, NULL, "iceresponse", NULL);
+    doc = xmlNewDoc(XMLSTR("1.0"));
+    node = xmlNewDocNode(doc, NULL, XMLSTR("iceresponse"), NULL);
     xmlDocSetRootElement(doc, node);
 
     if(listener != NULL) {
@@ -976,14 +986,14 @@
          */
         listener->con->error = 1;
         snprintf(buf, sizeof(buf), "Client %d removed", id);
-        xmlNewChild(node, NULL, "message", buf);
-        xmlNewChild(node, NULL, "return", "1");
+        xmlNewChild(node, NULL, XMLSTR("message"), XMLSTR(buf));
+        xmlNewChild(node, NULL, XMLSTR("return"), XMLSTR("1"));
     }
     else {
         memset(buf, '\000', sizeof(buf));
         snprintf(buf, sizeof(buf)-1, "Client %d not found", id);
-        xmlNewChild(node, NULL, "message", buf);
-        xmlNewChild(node, NULL, "return", "0");
+        xmlNewChild(node, NULL, XMLSTR("message"), XMLSTR(buf));
+        xmlNewChild(node, NULL, XMLSTR("return"), XMLSTR("0"));
     }
     thread_mutex_unlock (&source->lock);
     admin_send_response(doc, client, response, 
@@ -1018,8 +1028,8 @@
     xmlDocPtr doc;
     xmlNodePtr node;
 
-    doc = xmlNewDoc("1.0");
-    node = xmlNewDocNode(doc, NULL, "iceresponse", NULL);
+    doc = xmlNewDoc(XMLSTR("1.0"));
+    node = xmlNewDocNode(doc, NULL, XMLSTR("iceresponse"), NULL);
     xmlDocSetRootElement(doc, node);
 
     DEBUG0("Got metadata update request");
@@ -1062,8 +1072,8 @@
             break;
         }
         thread_mutex_unlock (&source->lock);
-        xmlNewChild(node, NULL, "message", "Metadata update successful");
-        xmlNewChild(node, NULL, "return", "1");
+        xmlNewChild(node, NULL, XMLSTR("message"), XMLSTR("Metadata update successful"));
+        xmlNewChild(node, NULL, XMLSTR("return"), XMLSTR("1"));
         admin_send_response(doc, client, response, 
                 ADMIN_XSL_RESPONSE);
         xmlFreeDoc(doc);
@@ -1071,9 +1081,9 @@
 
     } while (0);
     thread_mutex_unlock (&source->lock);
-    xmlNewChild(node, NULL, "message", 
-            "Mountpoint will not accept this URL update");
-    xmlNewChild(node, NULL, "return", "1");
+    xmlNewChild(node, NULL, XMLSTR("message"), 
+            XMLSTR("Mountpoint will not accept this URL update"));
+    xmlNewChild(node, NULL, XMLSTR("return"), XMLSTR("1"));
     admin_send_response(doc, client, response, 
             ADMIN_XSL_RESPONSE);
     xmlFreeDoc(doc);
@@ -1205,10 +1215,10 @@
     xmlDocPtr doc;
     xmlNodePtr node, srcnode;
 
-    doc = xmlNewDoc("1.0");
-    node = xmlNewDocNode(doc, NULL, "icestats", NULL);
-    srcnode = xmlNewChild(node, NULL, "source", NULL);
-    xmlSetProp(srcnode, "mount", source->mount);
+    doc = xmlNewDoc(XMLSTR("1.0"));
+    node = xmlNewDocNode(doc, NULL, XMLSTR("icestats"), NULL);
+    srcnode = xmlNewChild(node, NULL, XMLSTR("source"), NULL);
+    xmlSetProp(srcnode, XMLSTR("mount"), XMLSTR(source->mount));
     xmlDocSetRootElement(doc, node);
 
     admin_send_response(doc, client, response, 

Modified: icecast/branches/kh/icecast/src/admin.h
===================================================================
--- icecast/branches/kh/icecast/src/admin.h	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/admin.h	2006-02-12 21:50:10 UTC (rev 10807)
@@ -13,10 +13,10 @@
 #ifndef __ADMIN_H__
 #define __ADMIN_H__
 
-#include "refbuf.h"
 #include "client.h"
 
-void admin_handle_request(client_t *client, char *uri);
+int  admin_handle_request (client_t *client, const char *uri);
+void admin_mount_request (client_t *client, const char *uri);
 void admin_source_listeners (source_t *source, xmlNodePtr node);
 
 #endif  /* __ADMIN_H__ */

Modified: icecast/branches/kh/icecast/src/auth.c
===================================================================
--- icecast/branches/kh/icecast/src/auth.c	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/auth.c	2006-02-12 21:50:10 UTC (rev 10807)
@@ -33,6 +33,7 @@
 #include "stats.h"
 #include "httpp/httpp.h"
 #include "fserve.h"
+#include "admin.h"
 
 #include "logging.h"
 #define CATMODULE "auth"
@@ -45,15 +46,22 @@
 static thread_type *auth_thread;
 
 
-static void auth_client_setup (mount_proxy *mountinfo, client_t *client)
+static auth_client *auth_client_setup (const char *mount, mount_proxy *mountinfo, client_t *client)
 {
+    ice_config_t *config = config_get_config_unlocked();
+    auth_client *auth_user = calloc (1, sizeof(auth_client));
+
     /* This will look something like "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" */
-    char *header = httpp_getvar(client->parser, "authorization");
+    char *header;
     char *userpass, *tmp;
     char *username, *password;
 
     do
     {
+        if (client == NULL)
+            break;
+
+        header = httpp_getvar(client->parser, "authorization");
         if (header == NULL)
             break;
 
@@ -82,14 +90,20 @@
             free (userpass);
             break;
         }
-        INFO1 ("unhandled authorization header: %s", header);
+        WARN1 ("unhandled authorization header: %s", header);
 
     } while (0);
 
     thread_mutex_lock (&mountinfo->auth->lock);
-    client->auth = mountinfo->auth;
-    client->auth->refcount++;
+    if (client)
+        client->auth = mountinfo->auth;
+    mountinfo->auth->refcount++;
     thread_mutex_unlock (&mountinfo->auth->lock);
+    auth_user->mount = strdup (mount);
+    auth_user->hostname = strdup (config->hostname);
+    auth_user->port = config->port;
+    auth_user->client = client;
+    return auth_user;
 }
 
 
@@ -143,6 +157,7 @@
             client_send_401 (client);
         auth_user->client = NULL;
     }
+    free (auth_user->hostname);
     free (auth_user->mount);
     free (auth_user);
 }
@@ -160,13 +175,12 @@
         if (client->auth->authenticate (auth_user) != AUTH_OK)
             return;
     }
-    if (auth_postprocess_client (auth_user) < 0)
+    if (auth_postprocess_listener (auth_user) < 0)
         INFO1 ("client %lu failed", client->con->id);
 }
 
 
-/* wrapper function are auth thread to authenticate new listener
- * connections
+/* wrapper function for auth thread to drop listener connections
  */
 static void auth_remove_listener (auth_client *auth_user)
 {
@@ -179,6 +193,61 @@
 }
 
 
+/* Called from auth thread to process any request for source client
+ * authentication. Only applies to source clients, not relays.
+ */
+static void stream_auth_callback (auth_client *auth_user)
+{
+    client_t *client = auth_user->client;
+
+    if (client->auth->stream_auth)
+        client->auth->stream_auth (auth_user);
+    if (client->authenticated)
+    {
+        auth_release (client->auth);
+        client->auth = NULL;
+        auth_postprocess_source (auth_user);
+        DEBUG0 ("started");
+    }
+    else
+        WARN1 ("Failed auth for source \"%s\"", auth_user->mount);
+}
+
+
+/* Callback from auth thread to handle a stream start event, this applies
+ * to both source clients and relays.
+ */
+static void stream_start_callback (auth_client *auth_user)
+{
+    ice_config_t *config = config_get_config ();
+    mount_proxy *mountinfo = config_find_mount (config, auth_user->mount);
+    auth_t *auth = mountinfo->auth;
+
+    config_release_config();
+
+    if (auth->stream_start)
+        auth->stream_start (auth_user, auth);
+    auth_release (auth);
+}
+
+
+/* Callback from auth thread to handle a stream start event, this applies
+ * to both source clients and relays.
+ */
+static void stream_end_callback (auth_client *auth_user)
+{
+    ice_config_t *config = config_get_config ();
+    mount_proxy *mountinfo = config_find_mount (config, auth_user->mount);
+    auth_t *auth = mountinfo->auth;
+
+    config_release_config();
+
+    if (auth->stream_end)
+        auth->stream_end (auth_user, auth);
+    auth_release (auth);
+}
+
+
 /* The auth thread main loop. */
 static void *auth_run_thread (void *arg)
 {
@@ -304,7 +373,6 @@
         /* enable on-demand relay to start, wake up the slave thread */
         DEBUG0("kicking off on-demand relay");
         source->on_demand_req = 1;
-        slave_rescan ();
     }
     DEBUG1 ("Added client to %s", source->mount);
     return 0;
@@ -314,7 +382,7 @@
 /* Add listener to the pending lists of either the  source or fserve thread.
  * This can be run from the connection or auth thread context
  */
-static int add_authenticated_client (const char *mount, mount_proxy *mountinfo, client_t *client)
+static int add_authenticated_listener (const char *mount, mount_proxy *mountinfo, client_t *client)
 {
     int ret = 0;
     source_t *source = NULL;
@@ -355,7 +423,7 @@
 }
 
 
-int auth_postprocess_client (auth_client *auth_user)
+int auth_postprocess_listener (auth_client *auth_user)
 {
     int ret;
     ice_config_t *config = config_get_config();
@@ -363,7 +431,7 @@
     mount_proxy *mountinfo = config_find_mount (config, auth_user->mount);
     auth_user->client->authenticated = 1;
 
-    ret = add_authenticated_client (auth_user->mount, mountinfo, auth_user->client);
+    ret = add_authenticated_listener (auth_user->mount, mountinfo, auth_user->client);
     config_release_config();
 
     if (ret < 0)
@@ -374,6 +442,23 @@
 }
 
 
+/* Decide whether we need to start a source or just process a source
+ * admin request.
+ */
+void auth_postprocess_source (auth_client *auth_user)
+{
+    client_t *client = auth_user->client;
+    const char *uri = auth_user->mount;
+
+    DEBUG1 ("checking reference (%s)", uri);
+    auth_user->client = NULL;
+    if (strcmp (uri, "/admin.cgi") != 0 && strncmp("/admin/", uri, 7) != 0)
+        source_startup (client, uri, 0);
+    else
+        admin_mount_request (client, uri);
+}
+
+
 /* Add a listener. Check for any mount information that states any
  * authentication to be used.
  */
@@ -409,31 +494,17 @@
             client_send_403 (client, "busy, please try again later");
             return;
         }
-        auth_client_setup (mountinfo, client);
+        auth_user = auth_client_setup (mount, mountinfo, client);
         config_release_config ();
 
-        if (client->auth == NULL)
-        {
-            client_send_401 (client);
-            return;
-        }
-        auth_user = calloc (1, sizeof (auth_client));
-        if (auth_user == NULL)
-        {
-            ERROR0 ("memory exhausted");
-            abort ();
-            return;
-        }
-        auth_user->mount = strdup (mount);
         auth_user->process = auth_new_listener;
-        auth_user->client = client;
 
         INFO0 ("adding client for authentication");
         queue_auth_client (auth_user);
     }
     else
     {
-        int ret = add_authenticated_client (mount, mountinfo, client);
+        int ret = add_authenticated_listener (mount, mountinfo, client);
         config_release_config ();
         if (ret < 0)
             client_send_404 (client, "max listeners reached");
@@ -561,47 +632,62 @@
 }
 
 
+/* Called when a source client connects and requires authentication via the
+ * authenticator. This is called for both source clients and admin requests
+ * that work on a specified mountpoint.
+ */
+int auth_stream_authenticate (client_t *client, const char *mount, mount_proxy *mountinfo)
+{
+    if (mountinfo && mountinfo->auth && mountinfo->auth->stream_auth)
+    {
+        auth_client *auth_user = auth_client_setup (mount, mountinfo, client);
+
+        auth_user->process = stream_auth_callback;
+        INFO1 ("request source auth for \"%s\"", mount);
+        queue_auth_client (auth_user);
+        return 1;
+    }
+    return 0;
+}
+
 /* called when the stream starts, so that authentication engine can do any
  * cleanup/initialisation.
  */
-void auth_stream_start (mount_proxy *mountinfo, const char *mount)
+void auth_stream_start (mount_proxy *mountinfo, source_t *source)
 {
     if (mountinfo && mountinfo->auth && mountinfo->auth->stream_start)
     {
-        auth_client *auth_user = calloc (1, sizeof (auth_client));
-        if (auth_user)
-        {
-            auth_user->mount = strdup (mount);
-            auth_user->process = mountinfo->auth->stream_start;
+        auth_client *auth_user = auth_client_setup (source->mount,
+                mountinfo, NULL);
+        auth_user->process = stream_start_callback;
+        INFO1 ("request source start for \"%s\"", source->mount);
 
-            queue_auth_client (auth_user);
-        }
+        queue_auth_client (auth_user);
     }
 }
 
 
+
 /* Called when the stream ends so that the authentication engine can do
  * any authentication cleanup
  */
-void auth_stream_end (mount_proxy *mountinfo, const char *mount)
+void auth_stream_end (mount_proxy *mountinfo, source_t *source)
 {
     if (mountinfo && mountinfo->auth && mountinfo->auth->stream_end)
     {
-        auth_client *auth_user = calloc (1, sizeof (auth_client));
-        if (auth_user)
-        {
-            auth_user->mount = strdup (mount);
-            auth_user->process = mountinfo->auth->stream_end;
+        auth_client *auth_user = auth_client_setup (source->mount,
+                mountinfo, NULL);
+        auth_user->process = stream_end_callback;
+        INFO1 ("request source end for \"%s\"", source->mount);
 
-            queue_auth_client (auth_user);
-        }
+        queue_auth_client (auth_user);
     }
 }
 
 
 /* these are called at server start and termination */
 
-void auth_initialise ()
+void auth_initialise (void)
 {
     clients_to_auth = NULL;
     auth_pending_count = 0;
@@ -610,7 +696,7 @@
     auth_thread = thread_create ("auth thread", auth_run_thread, NULL, THREAD_ATTACHED);
 }
 
-void auth_shutdown ()
+void auth_shutdown (void)
 {
     if (auth_thread)
     {

Modified: icecast/branches/kh/icecast/src/auth.h
===================================================================
--- icecast/branches/kh/icecast/src/auth.h	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/auth.h	2006-02-12 21:50:10 UTC (rev 10807)
@@ -34,12 +34,14 @@
     AUTH_FAILED,
     AUTH_USERADDED,
     AUTH_USEREXISTS,
-    AUTH_USERDELETED,
+    AUTH_USERDELETED
 } auth_result;
 
 typedef struct auth_client_tag
 {
     char        *mount;
+    char        *hostname;
+    int         port;
     client_t    *client;
     void        (*process)(struct auth_client_tag *auth_user);
     struct auth_client_tag *next;
@@ -54,12 +56,15 @@
     auth_result (*authenticate)(auth_client *aclient);
     auth_result (*release_client)(auth_client *auth_user);
 
-    /* callbacks to specific auth for notifying auth server on source
-     * startup or shutdown
-     */
-    void (*stream_start)(auth_client *auth_user);
-    void (*stream_end)(auth_client *auth_user);
+    /* auth handler for authenicating a connecting source client */
+    void (*stream_auth)(auth_client *auth_user);
 
+    /* auth handler for source startup, no client passed as it may disappear */
+    void (*stream_start)(auth_client *auth_user, struct auth_tag *auth);
+
+    /* auth handler for source exit, no client passed as it may disappear */
+    void (*stream_end)(auth_client *auth_user, struct auth_tag *auth);
+
     void (*free)(struct auth_tag *self);
     auth_result (*adduser)(struct auth_tag *auth, const char *username, const char *password);
     auth_result (*deleteuser)(struct auth_tag *auth, const char *username);
@@ -78,22 +83,29 @@
 void add_client (const char *mount, client_t *client);
 int  release_client (client_t *client);
 
-void auth_initialise ();
-void auth_shutdown ();
+void auth_initialise (void);
+void auth_shutdown (void);
 
 auth_t  *auth_get_authenticator (xmlNodePtr node);
 void    auth_release (auth_t *authenticator);
 
 /* call to send a url request when source starts */
-void auth_stream_start (struct _mount_proxy *mountinfo, const char *mount);
+void auth_stream_start (struct _mount_proxy *mountinfo, struct source_tag *source);
 
 /* call to send a url request when source ends */
-void auth_stream_end (struct _mount_proxy *mountinfo, const char *mount);
+void auth_stream_end (struct _mount_proxy *mountinfo, struct source_tag *source);
 
+/* */
+int auth_stream_authenticate (client_t *client, const char *mount,
+        struct _mount_proxy *mountinfo);
+
 /* called from auth thread, after the client has successfully authenticated
  * and requires adding to source or fserve. */
-int auth_postprocess_client (auth_client *auth_user);
+int auth_postprocess_listener (auth_client *auth_user);
 
+/* called from auth thread */
+void auth_postprocess_source (auth_client *auth_user);
+
 #endif
 
 

Modified: icecast/branches/kh/icecast/src/auth_htpasswd.c
===================================================================
--- icecast/branches/kh/icecast/src/auth_htpasswd.c	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/auth_htpasswd.c	2006-02-12 21:50:10 UTC (rev 10807)
@@ -66,10 +66,10 @@
     free(state);
 }
 
-static int get_line(FILE *file, char *buf, int len)
+static int get_line(FILE *file, char *buf, size_t siz)
 {
-    if(fgets(buf, len, file)) {
-        int len = strlen(buf);
+    if(fgets(buf, (int)siz, file)) {
+        size_t len = strlen(buf);
         if(len > 0 && buf[len-1] == '\n') {
             buf[--len] = 0;
             if(len > 0 && buf[len-1] == '\r')
@@ -81,7 +81,7 @@
 }
 
 /* md5 hash */
-static char *get_hash(const char *data, int len)
+static char *get_hash(const char *data, size_t len)
 {
     struct MD5Context context;
     unsigned char digest[16];
@@ -406,9 +406,9 @@
     while (node)
     {
         htpasswd_user *user = (htpasswd_user *)node->key;
-        newnode = xmlNewChild (srcnode, NULL, "User", NULL);
-        xmlNewChild(newnode, NULL, "username", user->name);
-        xmlNewChild(newnode, NULL, "password", user->pass);
+        newnode = xmlNewChild (srcnode, NULL, XMLSTR("User"), NULL);
+        xmlNewChild(newnode, NULL, XMLSTR("username"), XMLSTR(user->name));
+        xmlNewChild(newnode, NULL, XMLSTR("password"), XMLSTR(user->pass));
         node = avl_get_next (node);
     }
     thread_rwlock_unlock (&state->file_rwlock);

Modified: icecast/branches/kh/icecast/src/auth_url.c
===================================================================
--- icecast/branches/kh/icecast/src/auth_url.c	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/auth_url.c	2006-02-12 21:50:10 UTC (rev 10807)
@@ -80,6 +80,7 @@
     char *removeurl;
     char *stream_start;
     char *stream_end;
+    char *stream_auth;
     char *username;
     char *password;
     char *auth_header;
@@ -105,6 +106,7 @@
     free (url->addurl);
     free (url->stream_start);
     free (url->stream_end);
+    free (url->stream_auth);
     free (url->auth_header);
     free (url->timelimit_header);
     free (url->userpwd);
@@ -338,33 +340,17 @@
 /* called by auth thread when a source starts, there is no client_t in
  * this case
  */
-static void url_stream_start (auth_client *auth_user)
+static void url_stream_start (auth_client *auth_user, auth_t *auth)
 {
     char *mount, *server;
-    ice_config_t *config = config_get_config ();
-    mount_proxy *mountinfo = config_find_mount (config, auth_user->mount);
-    auth_t *auth = mountinfo->auth;
     auth_url *url = auth->state;
-    char *stream_start_url;
-    int port;
     char post [4096];
 
-    if (url->stream_start == NULL)
-    {
-        config_release_config ();
-        return;
-    }
-    server = util_url_escape (config->hostname);
-    port = config->port;
-    stream_start_url = strdup (url->stream_start);
-    /* we don't want this auth disappearing from under us while
-     * the connection is in progress */
-    mountinfo->auth->refcount++;
-    config_release_config ();
+    server = util_url_escape (auth_user->hostname);
     mount = util_url_escape (auth_user->mount);
 
     snprintf (post, sizeof (post),
-            "action=mount_add&mount=%s&server=%s&port=%d", mount, server, port);
+            "action=mount_add&mount=%s&server=%s&port=%d", mount, server, auth_user->port);
     free (server);
     free (mount);
 
@@ -377,46 +363,26 @@
     }
     else
         curl_easy_setopt (url->handle, CURLOPT_USERPWD, "");
-    curl_easy_setopt (url->handle, CURLOPT_URL, stream_start_url);
+    curl_easy_setopt (url->handle, CURLOPT_URL, url->stream_start);
     curl_easy_setopt (url->handle, CURLOPT_POSTFIELDS, post);
     curl_easy_setopt (url->handle, CURLOPT_WRITEHEADER, auth_user);
 
     if (curl_easy_perform (url->handle))
-        WARN2 ("auth to server %s failed with %s", stream_start_url, url->errormsg);
-
-    auth_release (auth);
-    free (stream_start_url);
-    return;
+        WARN2 ("auth to server %s failed with %s", url->stream_start, url->errormsg);
 }
 
 
-static void url_stream_end (auth_client *auth_user)
+static void url_stream_end (auth_client *auth_user, auth_t *auth)
 {
     char *mount, *server;
-    ice_config_t *config = config_get_config ();
-    mount_proxy *mountinfo = config_find_mount (config, auth_user->mount);
-    auth_t *auth = mountinfo->auth;
     auth_url *url = auth->state;
-    char *stream_end_url;
-    int port;
     char post [4096];
 
-    if (url->stream_end == NULL)
-    {
-        config_release_config ();
-        return;
-    }
-    server = util_url_escape (config->hostname);
-    port = config->port;
-    stream_end_url = strdup (url->stream_end);
-    /* we don't want this auth disappearing from under us while
-     * the connection is in progress */
-    mountinfo->auth->refcount++;
-    config_release_config ();
+    server = util_url_escape (auth_user->hostname);
     mount = util_url_escape (auth_user->mount);
 
     snprintf (post, sizeof (post),
-            "action=mount_remove&mount=%s&server=%s&port=%d", mount, server, port);
+            "action=mount_remove&mount=%s&server=%s&port=%d", mount, server, auth_user->port);
     free (server);
     free (mount);
 
@@ -434,11 +400,53 @@
     curl_easy_setopt (url->handle, CURLOPT_WRITEHEADER, auth_user);
 
     if (curl_easy_perform (url->handle))
-        WARN2 ("auth to server %s failed with %s", stream_end_url, url->errormsg);
+        WARN2 ("auth to server %s failed with %s", url->stream_end, url->errormsg);
+}
 
-    auth_release (auth);
-    free (stream_end_url);
-    return;
+
+static void url_stream_auth (auth_client *auth_user)
+{
+    client_t *client = auth_user->client;
+    auth_url *url = client->auth->state;
+    char *mount, *host, *user, *pass, *ipaddr, *metadata="";
+    char post [4096];
+
+    if (strchr (url->stream_auth, '@') == NULL)
+    {
+        if (url->userpwd)
+            curl_easy_setopt (url->handle, CURLOPT_USERPWD, url->userpwd);
+        else
+            curl_easy_setopt (url->handle, CURLOPT_USERPWD, "");
+    }
+    else
+        curl_easy_setopt (url->handle, CURLOPT_USERPWD, "");
+    curl_easy_setopt (url->handle, CURLOPT_URL, url->stream_auth);
+    curl_easy_setopt (url->handle, CURLOPT_POSTFIELDS, post);
+    curl_easy_setopt (url->handle, CURLOPT_WRITEHEADER, auth_user);
+    if (strncmp (auth_user->mount, "/admin/", 7) == 0)
+    {
+        mount = util_url_escape (httpp_get_query_param (client->parser, "mount"));
+        metadata = "&metadata=1";
+    }
+    else
+        mount = util_url_escape (auth_user->mount);
+    host = util_url_escape (auth_user->hostname);
+    user = util_url_escape (client->username);
+    pass = util_url_escape (client->password);
+    ipaddr = util_url_escape (client->con->ip);
+
+    snprintf (post, sizeof (post),
+            "action=stream_auth&mount=%sip=%s&server=%s&port=%d&user=%s&pass=%s%s",
+            mount, ipaddr, host, auth_user->port, user, pass, metadata);
+    free (ipaddr);
+    free (user);
+    free (pass);
+    free (mount);
+    free (host);
+
+    client->authenticated = 0;
+    if (curl_easy_perform (url->handle))
+        WARN2 ("auth to server %s failed with %s", url->stream_auth, url->errormsg);
 }
 
 
@@ -472,6 +480,8 @@
     authenticator->stream_start = url_stream_start;
     authenticator->stream_end = url_stream_end;
 
+    authenticator->stream_auth = url_stream_auth;
+
     url_info = calloc(1, sizeof(auth_url));
     url_info->auth_header = strdup ("icecast-auth-user: 1\r\n");
     url_info->timelimit_header = strdup ("icecast-auth-timelimit:");
@@ -489,6 +499,8 @@
             url_info->stream_start = strdup (options->value);
         if(!strcmp(options->name, "mount_remove"))
             url_info->stream_end = strdup (options->value);
+        if(!strcmp(options->name, "stream_auth"))
+            url_info->stream_auth = strdup (options->value);
         if(!strcmp(options->name, "auth_header"))
         {
             free (url_info->auth_header);
@@ -512,7 +524,8 @@
     if (url_info->timelimit_header)
         url_info->timelimit_header_len = strlen (url_info->timelimit_header);
 
-    curl_easy_setopt (url_info->handle, CURLOPT_USERAGENT, ICECAST_VERSION_STRING);
+    curl_easy_setopt (url_info->handle, CURLOPT_USERAGENT,
+            config_get_config_unlocked()->server_id);
     curl_easy_setopt (url_info->handle, CURLOPT_HEADERFUNCTION, handle_returned_header);
     curl_easy_setopt (url_info->handle, CURLOPT_WRITEFUNCTION, handle_returned_data);
     curl_easy_setopt (url_info->handle, CURLOPT_WRITEDATA, url_info->handle);

Modified: icecast/branches/kh/icecast/src/cfgfile.c
===================================================================
--- icecast/branches/kh/icecast/src/cfgfile.c	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/cfgfile.c	2006-02-12 21:50:10 UTC (rev 10807)
@@ -86,12 +86,12 @@
         ice_config_t *c);
 static void _add_server(xmlDocPtr doc, xmlNodePtr node, ice_config_t *c);
 
-static void create_locks() {
+static void create_locks(void) {
     thread_mutex_create("relay lock", &_locks.relay_lock);
     thread_rwlock_create(&_locks.config_lock);
 }
 
-static void release_locks() {
+static void release_locks(void) {
     thread_mutex_destroy(&_locks.relay_lock);
     thread_rwlock_destroy(&_locks.config_lock);
 }
@@ -167,6 +167,7 @@
     if (c->config_filename)
         free(c->config_filename);
 
+    xmlFree (c->server_id);
     if (c->location && c->location != CONFIG_DEFAULT_LOCATION) 
         xmlFree(c->location);
     if (c->admin && c->admin != CONFIG_DEFAULT_ADMIN) 
@@ -282,7 +283,7 @@
         return CONFIG_ENOROOT;
     }
 
-    if (strcmp(node->name, "icecast") != 0) {
+    if (xmlStrcmp(node->name, XMLSTR("icecast")) != 0) {
         xmlFreeDoc(doc);
         xmlCleanupParser();
         return CONFIG_EBADROOT;
@@ -339,6 +340,7 @@
 static void _set_defaults(ice_config_t *configuration)
 {
     configuration->location = CONFIG_DEFAULT_LOCATION;
+    configuration->server_id = (char *)xmlCharStrdup (ICECAST_VERSION_STRING);
     configuration->admin = CONFIG_DEFAULT_ADMIN;
     configuration->client_limit = CONFIG_DEFAULT_CLIENT_LIMIT;
     configuration->source_limit = CONFIG_DEFAULT_SOURCE_LIMIT;
@@ -362,7 +364,7 @@
     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_username = (char*)xmlCharStrdup (CONFIG_DEFAULT_MASTER_USERNAME);
     configuration->master_password = NULL;
     configuration->master_relay_auth = 0;
     configuration->master_redirect_port = 0;
@@ -380,7 +382,7 @@
     configuration->group = CONFIG_DEFAULT_GROUP;
     configuration->num_yp_directories = 0;
     configuration->slaves_count = 0;
-    configuration->relay_username = xmlStrdup (CONFIG_DEFAULT_MASTER_USERNAME);
+    configuration->relay_username = (char *)xmlCharStrdup (CONFIG_DEFAULT_MASTER_USERNAME);
     configuration->relay_password = NULL;
     /* default to a typical prebuffer size used by clients */
     configuration->burst_size = CONFIG_DEFAULT_BURST_SIZE;
@@ -395,18 +397,21 @@
         if (node == NULL) break;
         if (xmlIsBlankNode(node)) continue;
 
-        if (strcmp(node->name, "location") == 0) {
+        if (xmlStrcmp(node->name, XMLSTR ("location")) == 0) {
             if (configuration->location && configuration->location != CONFIG_DEFAULT_LOCATION) xmlFree(configuration->location);
             configuration->location = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
-        } else if (strcmp(node->name, "admin") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("admin")) == 0) {
             if (configuration->admin && configuration->admin != CONFIG_DEFAULT_ADMIN) xmlFree(configuration->admin);
             configuration->admin = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
-        } else if(strcmp(node->name, "authentication") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("server_id")) == 0) {
+            xmlFree (configuration->server_id);
+            configuration->server_id = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
+        } else if(xmlStrcmp(node->name, XMLSTR ("authentication")) == 0) {
             _parse_authentication(doc, node->xmlChildrenNode, configuration);
-        } else if (strcmp(node->name, "source-password") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("source-password")) == 0) {
             /* TODO: This is the backwards-compatibility location */
             char *mount, *pass;
-            if ((mount = (char *)xmlGetProp(node, "mount")) != NULL) {
+            if ((mount = (char *)xmlGetProp(node, XMLSTR ("mount"))) != NULL) {
                 pass = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
                 /* FIXME: This is a placeholder for per-mount passwords */
             }
@@ -414,79 +419,79 @@
                 if (configuration->source_password && configuration->source_password != CONFIG_DEFAULT_SOURCE_PASSWORD) xmlFree(configuration->source_password);
                 configuration->source_password = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             }
-        } else if (strcmp(node->name, "icelogin") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("icelogin")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             configuration->ice_login = atoi(tmp);
             if (tmp) xmlFree(tmp);
-        } else if (strcmp(node->name, "fileserve") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("fileserve")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             configuration->fileserve = atoi(tmp);
             if (tmp) xmlFree(tmp);
-        } else if (strcmp(node->name, "relays-on-demand") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("relays-on-demand")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             configuration->on_demand = atoi(tmp);
             if (tmp) xmlFree(tmp);
-        } else if (strcmp(node->name, "hostname") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("hostname")) == 0) {
             if (configuration->hostname && configuration->hostname != CONFIG_DEFAULT_HOSTNAME) xmlFree(configuration->hostname);
             configuration->hostname = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
-        } else if (strcmp(node->name, "listen-socket") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("listen-socket")) == 0) {
             _parse_listen_socket(doc, node->xmlChildrenNode, configuration);
-        } else if (strcmp(node->name, "port") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("port")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             configuration->port = atoi(tmp);
             configuration->listeners[0].port = atoi(tmp);
             if (tmp) xmlFree(tmp);
-        } else if (strcmp(node->name, "bind-address") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("bind-address")) == 0) {
             if (configuration->listeners[0].bind_address) 
                 xmlFree(configuration->listeners[0].bind_address);
             configuration->listeners[0].bind_address = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
-        } else if (strcmp(node->name, "master-server") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("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) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("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) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("master-password")) == 0) {
             if (configuration->master_password) xmlFree(configuration->master_password);
             configuration->master_password = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
-        } else if (strcmp(node->name, "master-server-port") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("master-server-port")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             configuration->master_server_port = atoi(tmp);
             xmlFree (tmp);
-        } else if (strcmp(node->name, "master-redirect-port") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("master-redirect-port")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             configuration->master_redirect_port = atoi(tmp);
             xmlFree (tmp);
-        } else if (strcmp(node->name, "master-update-interval") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("master-update-interval")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             configuration->master_update_interval = atoi(tmp);
             xmlFree (tmp);
-        } else if (strcmp(node->name, "master-relay-auth") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("master-relay-auth")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             configuration->master_relay_auth = atoi(tmp);
             xmlFree (tmp);
-        } else if (strcmp(node->name, "master-ssl-port") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("master-ssl-port")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             configuration->master_ssl_port = atoi(tmp);
             xmlFree (tmp);
-        } else if (strcmp(node->name, "shoutcast-mount") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("shoutcast-mount")) == 0) {
             if (configuration->shoutcast_mount &&
                     configuration->shoutcast_mount != CONFIG_DEFAULT_SHOUTCAST_MOUNT)
                 xmlFree(configuration->shoutcast_mount);
             configuration->shoutcast_mount = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
-        } else if (strcmp(node->name, "limits") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("limits")) == 0) {
             _parse_limits(doc, node->xmlChildrenNode, configuration);
-        } else if (strcmp(node->name, "relay") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("relay")) == 0) {
             _parse_relay(doc, node->xmlChildrenNode, configuration);
-        } else if (strcmp(node->name, "mount") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("mount")) == 0) {
             _parse_mount(doc, node->xmlChildrenNode, configuration);
-        } else if (strcmp(node->name, "directory") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("directory")) == 0) {
             _parse_directory(doc, node->xmlChildrenNode, configuration);
-        } else if (strcmp(node->name, "paths") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("paths")) == 0) {
             _parse_paths(doc, node->xmlChildrenNode, configuration);
-        } else if (strcmp(node->name, "logging") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("logging")) == 0) {
             _parse_logging(doc, node->xmlChildrenNode, configuration);
-        } else if (strcmp(node->name, "security") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("security")) == 0) {
             _parse_security(doc, node->xmlChildrenNode, configuration);
         }
     } while ((node = node->next));
@@ -501,38 +506,38 @@
         if (node == NULL) break;
         if (xmlIsBlankNode(node)) continue;
 
-        if (strcmp(node->name, "clients") == 0) {
+        if (xmlStrcmp(node->name, XMLSTR ("clients")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             configuration->client_limit = atoi(tmp);
             if (tmp) xmlFree(tmp);
-        } else if (strcmp(node->name, "sources") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("sources")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             configuration->source_limit = atoi(tmp);
             if (tmp) xmlFree(tmp);
-        } else if (strcmp(node->name, "queue-size") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("queue-size")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             configuration->queue_size_limit = atoi(tmp);
             if (tmp) xmlFree(tmp);
-        } else if (strcmp(node->name, "client-timeout") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("client-timeout")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             configuration->client_timeout = atoi(tmp);
             if (tmp) xmlFree(tmp);
-        } else if (strcmp(node->name, "header-timeout") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("header-timeout")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             configuration->header_timeout = atoi(tmp);
             if (configuration->header_timeout < 0 || configuration->header_timeout > 60)
                 configuration->header_timeout = CONFIG_DEFAULT_HEADER_TIMEOUT;
             if (tmp) xmlFree(tmp);
-        } else if (strcmp(node->name, "source-timeout") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR("source-timeout")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             configuration->source_timeout = atoi(tmp);
             if (tmp) xmlFree(tmp);
-        } else if (strcmp(node->name, "burst-on-connect") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR("burst-on-connect")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             if (atoi(tmp) == 0)
                 configuration->burst_size = 0;
             if (tmp) xmlFree(tmp);
-        } else if (strcmp(node->name, "burst-size") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR("burst-size")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             configuration->burst_size = atoi(tmp);
             if (tmp) xmlFree(tmp);
@@ -559,123 +564,123 @@
         if (node == NULL) break;
         if (xmlIsBlankNode(node)) continue;
 
-        if (strcmp(node->name, "mount-name") == 0) {
+        if (xmlStrcmp(node->name, XMLSTR ("mount-name")) == 0) {
             mount->mountname = (char *)xmlNodeListGetString(
                     doc, node->xmlChildrenNode, 1);
         }
-        else if (strcmp(node->name, "username") == 0) {
+        else if (xmlStrcmp(node->name, XMLSTR ("username")) == 0) {
             mount->username = (char *)xmlNodeListGetString(
                     doc, node->xmlChildrenNode, 1);
         }
-        else if (strcmp(node->name, "password") == 0) {
+        else if (xmlStrcmp(node->name, XMLSTR ("password")) == 0) {
             mount->password = (char *)xmlNodeListGetString(
                     doc, node->xmlChildrenNode, 1);
         }
-        else if (strcmp(node->name, "dump-file") == 0) {
+        else if (xmlStrcmp(node->name, XMLSTR ("dump-file")) == 0) {
             mount->dumpfile = (char *)xmlNodeListGetString(
                     doc, node->xmlChildrenNode, 1);
         }
-        else if (strcmp(node->name, "intro") == 0) {
+        else if (xmlStrcmp(node->name, XMLSTR ("intro")) == 0) {
             mount->intro_filename = (char *)xmlNodeListGetString(
                     doc, node->xmlChildrenNode, 1);
         }
-        else if (strcmp(node->name, "fallback-mount") == 0) {
+        else if (xmlStrcmp(node->name, XMLSTR ("fallback-mount")) == 0) {
             mount->fallback_mount = (char *)xmlNodeListGetString(
                     doc, node->xmlChildrenNode, 1);
         }
-        else if (strcmp(node->name, "fallback-when-full") == 0) {
+        else if (xmlStrcmp(node->name, XMLSTR ("fallback-when-full")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             mount->fallback_when_full = atoi(tmp);
             if(tmp) xmlFree(tmp);
         }
-        else if (strcmp(node->name, "max-listeners") == 0) {
+        else if (xmlStrcmp(node->name, XMLSTR ("max-listeners")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             mount->max_listeners = atoi(tmp);
             if(tmp) xmlFree(tmp);
         }
-        else if (strcmp(node->name, "mp3-metadata-interval") == 0) {
+        else if (xmlStrcmp(node->name, XMLSTR ("mp3-metadata-interval")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             mount->mp3_meta_interval = atoi(tmp);
             if(tmp) xmlFree(tmp);
         }
-        else if (strcmp(node->name, "fallback-override") == 0) {
+        else if (xmlStrcmp(node->name, XMLSTR ("fallback-override")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             mount->fallback_override = atoi(tmp);
             if(tmp) xmlFree(tmp);
         }
-        else if (strcmp(node->name, "no-mount") == 0) {
+        else if (xmlStrcmp(node->name, XMLSTR ("no-mount")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             mount->no_mount = atoi(tmp);
             if(tmp) xmlFree(tmp);
         }
-        else if (strcmp(node->name, "no-yp") == 0) {
+        else if (xmlStrcmp(node->name, XMLSTR ("no-yp")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             mount->yp_public = atoi(tmp)==0 ? -1 : 0;
             if(tmp) xmlFree(tmp);
         }
-        else if (strcmp(node->name, "hidden") == 0) {
+        else if (xmlStrcmp(node->name, XMLSTR ("hidden")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             mount->hidden = atoi(tmp);
             if(tmp) xmlFree(tmp);
         }
-        else if (strcmp(node->name, "authentication") == 0) {
+        else if (xmlStrcmp(node->name, XMLSTR ("authentication")) == 0) {
             mount->auth = auth_get_authenticator (node);
         }
-        else if (strcmp(node->name, "on-connect") == 0) {
+        else if (xmlStrcmp(node->name, XMLSTR ("on-connect")) == 0) {
             mount->on_connect = (char *)xmlNodeListGetString(
                     doc, node->xmlChildrenNode, 1);
         }
-        else if (strcmp(node->name, "on-disconnect") == 0) {
+        else if (xmlStrcmp(node->name, XMLSTR ("on-disconnect")) == 0) {
             mount->on_disconnect = (char *)xmlNodeListGetString(
                     doc, node->xmlChildrenNode, 1);
         }
-        else if (strcmp(node->name, "max-listener-duration") == 0) {
+        else if (xmlStrcmp(node->name, XMLSTR ("max-listener-duration")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             mount->max_listener_duration = atoi(tmp);
             if(tmp) xmlFree(tmp);
         }
-        else if (strcmp(node->name, "queue-size") == 0) {
+        else if (xmlStrcmp(node->name, XMLSTR ("queue-size")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             mount->queue_size_limit = atoi (tmp);
             if(tmp) xmlFree(tmp);
         }
-        else if (strcmp(node->name, "source-timeout") == 0) {
+        else if (xmlStrcmp(node->name, XMLSTR ("source-timeout")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             if (tmp)
             {
                 mount->source_timeout = atoi (tmp);
                 xmlFree(tmp);
             }
-        } else if (strcmp(node->name, "burst-size") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("burst-size")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             mount->burst_size = atoi(tmp);
             if (tmp) xmlFree(tmp);
-        } else if (strcmp(node->name, "cluster-password") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("cluster-password")) == 0) {
             mount->cluster_password = (char *)xmlNodeListGetString(
                     doc, node->xmlChildrenNode, 1);
-        } else if (strcmp(node->name, "stream-name") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("stream-name")) == 0) {
             mount->stream_name = (char *)xmlNodeListGetString(
                     doc, node->xmlChildrenNode, 1);
-        } else if (strcmp(node->name, "stream-description") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("stream-description")) == 0) {
             mount->stream_description = (char *)xmlNodeListGetString(
                     doc, node->xmlChildrenNode, 1);
-        } else if (strcmp(node->name, "stream-url") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("stream-url")) == 0) {
             mount->stream_url = (char *)xmlNodeListGetString(
                     doc, node->xmlChildrenNode, 1);
-        } else if (strcmp(node->name, "genre") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("genre")) == 0) {
             mount->stream_genre = (char *)xmlNodeListGetString(
                     doc, node->xmlChildrenNode, 1);
-        } else if (strcmp(node->name, "bitrate") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("bitrate")) == 0) {
             mount->bitrate = (char *)xmlNodeListGetString(
                     doc, node->xmlChildrenNode, 1);
-        } else if (strcmp(node->name, "public") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("public")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             mount->yp_public = atoi (tmp);
             if(tmp) xmlFree(tmp);
-        } else if (strcmp(node->name, "type") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("type")) == 0) {
             mount->type = (char *)xmlNodeListGetString(
                     doc, node->xmlChildrenNode, 1);
-        } else if (strcmp(node->name, "subtype") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("subtype")) == 0) {
             mount->subtype = (char *)xmlNodeListGetString(
                     doc, node->xmlChildrenNode, 1);
         }
@@ -714,42 +719,42 @@
         if (node == NULL) break;
         if (xmlIsBlankNode(node)) continue;
 
-        if (strcmp(node->name, "server") == 0) {
+        if (xmlStrcmp(node->name, XMLSTR ("server")) == 0) {
             relay->server = (char *)xmlNodeListGetString(
                     doc, node->xmlChildrenNode, 1);
         }
-        else if (strcmp(node->name, "port") == 0) {
+        else if (xmlStrcmp(node->name, XMLSTR ("port")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             relay->port = atoi(tmp);
             if(tmp) xmlFree(tmp);
         }
-        else if (strcmp(node->name, "mount") == 0) {
+        else if (xmlStrcmp(node->name, XMLSTR ("mount")) == 0) {
             relay->mount = (char *)xmlNodeListGetString(
                     doc, node->xmlChildrenNode, 1);
         }
-        else if (strcmp(node->name, "local-mount") == 0) {
+        else if (xmlStrcmp(node->name, XMLSTR ("local-mount")) == 0) {
             relay->localmount = (char *)xmlNodeListGetString(
                     doc, node->xmlChildrenNode, 1);
         }
-        else if (strcmp(node->name, "relay-shoutcast-metadata") == 0) {
+        else if (xmlStrcmp(node->name, XMLSTR ("relay-shoutcast-metadata")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             relay->mp3metadata = atoi(tmp);
             if(tmp) xmlFree(tmp);
         }
-        else if (strcmp(node->name, "username") == 0) {
+        else if (xmlStrcmp(node->name, XMLSTR ("username")) == 0) {
             relay->username = (char *)xmlNodeListGetString(doc,
                     node->xmlChildrenNode, 1);
         }
-        else if (strcmp(node->name, "password") == 0) {
+        else if (xmlStrcmp(node->name, XMLSTR ("password")) == 0) {
             relay->password = (char *)xmlNodeListGetString(doc,
                     node->xmlChildrenNode, 1);
         }
-        else if (strcmp(node->name, "on-demand") == 0) {
+        else if (xmlStrcmp(node->name, XMLSTR ("on-demand")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             relay->on_demand = atoi(tmp);
             if (tmp) xmlFree(tmp);
         }
-        else if (strcmp(node->name, "enable") == 0) {
+        else if (xmlStrcmp(node->name, XMLSTR ("enable")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             relay->enable = atoi(tmp);
             if (tmp) xmlFree(tmp);
@@ -762,10 +767,10 @@
         return;
     }
     if (relay->mount == NULL)
-        relay->mount = xmlStrdup ("/");
+        relay->mount = (char*)xmlCharStrdup ("/");
 
     if (relay->localmount == NULL)
-        relay->localmount = xmlStrdup (relay->mount);
+        relay->localmount = (char*)xmlCharStrdup (relay->mount);
 
     relay->next = configuration->relay;
     configuration->relay = relay;
@@ -791,24 +796,24 @@
         if (node == NULL) break;
         if (xmlIsBlankNode(node)) continue;
 
-        if (strcmp(node->name, "port") == 0) {
+        if (xmlStrcmp(node->name, XMLSTR ("port")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             if(configuration->port == 0)
                 configuration->port = atoi(tmp);
             listener->port = atoi(tmp);
             if(tmp) xmlFree(tmp);
         }
-        else if (strcmp(node->name, "shoutcast-compat") == 0) {
+        else if (xmlStrcmp(node->name, XMLSTR ("shoutcast-compat")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             listener->shoutcast_compat = atoi(tmp);
             if(tmp) xmlFree(tmp);
         }
-        else if (strcmp(node->name, "ssl") == 0) {
+        else if (xmlStrcmp(node->name, XMLSTR ("ssl")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             listener->ssl = atoi(tmp);
             if(tmp) xmlFree(tmp);
         }
-        else if (strcmp(node->name, "bind-address") == 0) {
+        else if (xmlStrcmp(node->name, XMLSTR ("bind-address")) == 0) {
             listener->bind_address = (char *)xmlNodeListGetString(doc, 
                     node->xmlChildrenNode, 1);
         }
@@ -822,9 +827,9 @@
         if (node == NULL) break;
         if (xmlIsBlankNode(node)) continue;
 
-        if (strcmp(node->name, "source-password") == 0) {
+        if (xmlStrcmp(node->name, XMLSTR ("source-password")) == 0) {
             char *mount, *pass;
-            if ((mount = (char *)xmlGetProp(node, "mount")) != NULL) {
+            if ((mount = (char *)xmlGetProp(node, XMLSTR ("mount"))) != NULL) {
                 pass = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
                 /* FIXME: This is a placeholder for per-mount passwords */
             }
@@ -836,22 +841,22 @@
                 configuration->source_password = 
                     (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             }
-        } else if (strcmp(node->name, "admin-password") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("admin-password")) == 0) {
             if(configuration->admin_password)
                 xmlFree(configuration->admin_password);
             configuration->admin_password =
                 (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
-        } else if (strcmp(node->name, "admin-user") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("admin-user")) == 0) {
             if(configuration->admin_username)
                 xmlFree(configuration->admin_username);
             configuration->admin_username =
                 (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
-        } else if (strcmp(node->name, "relay-password") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("relay-password")) == 0) {
             if(configuration->relay_password)
                 xmlFree(configuration->relay_password);
             configuration->relay_password =
                 (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
-        } else if (strcmp(node->name, "relay-user") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("relay-user")) == 0) {
             if(configuration->relay_username)
                 xmlFree(configuration->relay_username);
             configuration->relay_username =
@@ -873,19 +878,19 @@
         if (node == NULL) break;
         if (xmlIsBlankNode(node)) continue;
 
-        if (strcmp(node->name, "yp-url") == 0) {
+        if (xmlStrcmp(node->name, XMLSTR ("yp-url")) == 0) {
             if (configuration->yp_url[configuration->num_yp_directories]) 
                 xmlFree(configuration->yp_url[configuration->num_yp_directories]);
             configuration->yp_url[configuration->num_yp_directories] = 
                 (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
-        } else if (strcmp(node->name, "yp-url-timeout") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("yp-url-timeout")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             configuration->yp_url_timeout[configuration->num_yp_directories] = 
                 atoi(tmp);
             if (tmp) xmlFree(tmp);
-        } else if (strcmp(node->name, "server") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("server")) == 0) {
             _add_server(doc, node->xmlChildrenNode, configuration);
-        } else if (strcmp(node->name, "touch-interval") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("touch-interval")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             configuration->yp_touch_interval[configuration->num_yp_directories] =
                 atoi(tmp);
@@ -905,52 +910,51 @@
         if (node == NULL) break;
         if (xmlIsBlankNode(node)) continue;
 
-        if (strcmp(node->name, "basedir") == 0) {
+        if (xmlStrcmp(node->name, XMLSTR ("basedir")) == 0) {
             if (configuration->base_dir && configuration->base_dir != CONFIG_DEFAULT_BASE_DIR) xmlFree(configuration->base_dir);
             configuration->base_dir = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
-        } else if (strcmp(node->name, "logdir") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("logdir")) == 0) {
             if (configuration->log_dir && configuration->log_dir != CONFIG_DEFAULT_LOG_DIR) xmlFree(configuration->log_dir);
             configuration->log_dir = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
-        } else if (strcmp(node->name, "pidfile") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("pidfile")) == 0) {
             if (configuration->pidfile) xmlFree(configuration->pidfile);
             configuration->pidfile = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
-        } else if (strcmp(node->name, "ssl_certificate") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("ssl_certificate")) == 0) {
             if (configuration->cert_file) xmlFree(configuration->cert_file);
             configuration->cert_file = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
-        } else if (strcmp(node->name, "webroot") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("webroot")) == 0) {
             if (configuration->webroot_dir && configuration->webroot_dir != CONFIG_DEFAULT_WEBROOT_DIR) xmlFree(configuration->webroot_dir);
             configuration->webroot_dir = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             if(configuration->webroot_dir[strlen(configuration->webroot_dir)-1] == '/')
                 configuration->webroot_dir[strlen(configuration->webroot_dir)-1] = 0;
-        } else if (strcmp(node->name, "adminroot") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("adminroot")) == 0) {
             if (configuration->adminroot_dir && configuration->adminroot_dir != CONFIG_DEFAULT_ADMINROOT_DIR) 
                 xmlFree(configuration->adminroot_dir);
             configuration->adminroot_dir = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             if(configuration->adminroot_dir[strlen(configuration->adminroot_dir)-1] == '/')
                 configuration->adminroot_dir[strlen(configuration->adminroot_dir)-1] = 0;
-        } else if (strcmp(node->name, "alias") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("alias")) == 0) {
             alias = malloc(sizeof(aliases));
             alias->next = NULL;
-            alias->source = xmlGetProp(node, "source");
+            alias->source = (char*)xmlGetProp(node, XMLSTR ("source"));
             if(alias->source == NULL) {
                 free(alias);
                 continue;
             }
-            alias->destination = xmlGetProp(node, "dest");
+            alias->destination = (char*)xmlGetProp(node, XMLSTR ("dest"));
             if(alias->destination == NULL) {
                 xmlFree(alias->source);
                 free(alias);
                 continue;
             }
-            temp = NULL;
-            temp = xmlGetProp(node, "port");
+            temp = (char *)xmlGetProp(node, XMLSTR("port"));
             if(temp != NULL) {
                 alias->port = atoi(temp);
                 xmlFree(temp);
             }
             else
                 alias->port = -1;
-            alias->bind_address = xmlGetProp(node, "bind-address");
+            alias->bind_address = (char*)xmlGetProp(node, XMLSTR("bind-address"));
             current = configuration->aliases;
             last = NULL;
             while(current) {
@@ -972,24 +976,24 @@
         if (node == NULL) break;
         if (xmlIsBlankNode(node)) continue;
 
-        if (strcmp(node->name, "accesslog") == 0) {
+        if (xmlStrcmp(node->name, XMLSTR ("accesslog")) == 0) {
             if (configuration->access_log && configuration->access_log != CONFIG_DEFAULT_ACCESS_LOG) xmlFree(configuration->access_log);
             configuration->access_log = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
-        } else if (strcmp(node->name, "errorlog") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("errorlog")) == 0) {
             if (configuration->error_log && configuration->error_log != CONFIG_DEFAULT_ERROR_LOG) xmlFree(configuration->error_log);
             configuration->error_log = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
-        } else if (strcmp(node->name, "playlistlog") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("playlistlog")) == 0) {
             if (configuration->playlist_log && configuration->playlist_log != CONFIG_DEFAULT_PLAYLIST_LOG) xmlFree(configuration->playlist_log);
             configuration->playlist_log = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
-        } else if (strcmp(node->name, "logsize") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("logsize")) == 0) {
            char *tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
            configuration->logsize = atoi(tmp);
            if (tmp) xmlFree(tmp);
-        } else if (strcmp(node->name, "loglevel") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("loglevel")) == 0) {
            char *tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
            configuration->loglevel = atoi(tmp);
            if (tmp) xmlFree(tmp);
-        } else if (strcmp(node->name, "logarchive") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("logarchive")) == 0) {
             char *tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             configuration->logarchive = atoi(tmp);
             if (tmp) xmlFree(tmp);
@@ -1007,21 +1011,21 @@
        if (node == NULL) break;
        if (xmlIsBlankNode(node)) continue;
 
-       if (strcmp(node->name, "chroot") == 0) {
+       if (xmlStrcmp(node->name, XMLSTR ("chroot")) == 0) {
            tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
            configuration->chroot = atoi(tmp);
            if (tmp) xmlFree(tmp);
-       } else if (strcmp(node->name, "changeowner") == 0) {
+       } else if (xmlStrcmp(node->name, XMLSTR ("changeowner")) == 0) {
            configuration->chuid = 1;
            oldnode = node;
            node = node->xmlChildrenNode;
            do {
                if(node == NULL) break;
                if(xmlIsBlankNode(node)) continue;
-               if(strcmp(node->name, "user") == 0) {
+               if(xmlStrcmp(node->name, XMLSTR ("user")) == 0) {
                    if(configuration->user) xmlFree(configuration->user);
                    configuration->user = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
-               } else if(strcmp(node->name, "group") == 0) {
+               } else if(xmlStrcmp(node->name, XMLSTR ("group")) == 0) {
                    if(configuration->group) xmlFree(configuration->group);
                    configuration->group = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
                }
@@ -1047,11 +1051,11 @@
         if (node == NULL) break;
         if (xmlIsBlankNode(node)) continue;
 
-        if (strcmp(node->name, "host") == 0) {
+        if (xmlStrcmp(node->name, XMLSTR ("host")) == 0) {
             server->host = (char *)xmlNodeListGetString(doc, 
                     node->xmlChildrenNode, 1);
             addnode = 1;
-        } else if (strcmp(node->name, "touch-interval") == 0) {
+        } else if (xmlStrcmp(node->name, XMLSTR ("touch-interval")) == 0) {
             tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
             server->touch_interval = atoi(tmp);
             if (tmp) xmlFree(tmp);
@@ -1085,9 +1089,9 @@
         return NULL;
     while (mountinfo)
     {
-        if (strcmp (mountinfo->mountname, "all") == 0)
+        if (xmlStrcmp (XMLSTR(mountinfo->mountname), XMLSTR ("all")) == 0)
             global = mountinfo;
-        if (strcmp (mountinfo->mountname, mount) == 0)
+        if (xmlStrcmp (XMLSTR(mountinfo->mountname), XMLSTR(mount)) == 0)
             break;
         mountinfo = mountinfo->next;
     }

Modified: icecast/branches/kh/icecast/src/cfgfile.h
===================================================================
--- icecast/branches/kh/icecast/src/cfgfile.h	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/cfgfile.h	2006-02-12 21:50:10 UTC (rev 10807)
@@ -20,6 +20,8 @@
 
 #define MAX_YP_DIRECTORIES 25
 
+#define XMLSTR		(xmlChar *)
+
 struct _mount_proxy;
 
 #include "thread/thread.h"
@@ -147,6 +149,7 @@
 
     mount_proxy *mounts;
 
+    char *server_id;
     char *base_dir;
     char *log_dir;
     char *pidfile;

Modified: icecast/branches/kh/icecast/src/client.c
===================================================================
--- icecast/branches/kh/icecast/src/client.c	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/client.c	2006-02-12 21:50:10 UTC (rev 10807)
@@ -55,23 +55,27 @@
  */
 int client_create (client_t **c_ptr, connection_t *con, http_parser_t *parser)
 {
-    ice_config_t *config;
     client_t *client = (client_t *)calloc(1, sizeof(client_t));
-    int ret = -1;
+    int ret = 0;
 
     if (client == NULL)
         abort();
 
-    config = config_get_config ();
-
     global.clients++;
-    if (config->client_limit < global.clients)
-        WARN2 ("server client limit reached (%d/%d)", config->client_limit, global.clients);
-    else
-        ret = 0;
 
-    config_release_config ();
+    /* don't do client limit check if on an SSL socket, as that will be an admin request */
+    if (not_ssl_connection (con))
+    {
+        ice_config_t *config = config_get_config ();
 
+        if (config->client_limit < global.clients)
+        {
+            WARN2 ("server client limit reached (%d/%d)", config->client_limit, global.clients);
+            ret = -1;
+        }
+        config_release_config ();
+    }
+
     stats_event_args (NULL, "clients", "%d", global.clients);
     client->con = con;
     client->parser = parser;
@@ -160,7 +164,7 @@
     }
     bytes = client->con->read (client->con, buf, len);
 
-    if (client->con->error)
+    if (bytes == -1 && client->con->error)
         WARN0 ("reading from connection has failed");
 
     return bytes;
@@ -214,14 +218,19 @@
 
 void client_send_401 (client_t *client)
 {
-    const char *send_realm = ICECAST_VERSION_STRING;
+    ice_config_t *config = config_get_config ();
+    const char *send_realm;
     if (client->auth && client->auth->realm)
         send_realm = client->auth->realm;
+    else
+        send_realm = config->server_id;
+
     snprintf (client->refbuf->data, PER_CLIENT_REFBUF_SIZE,
             "HTTP/1.0 401 Authentication Required\r\n"
             "WWW-Authenticate: Basic realm=\"%s\"\r\n"
             "\r\n"
             "You need to authenticate\r\n", send_realm);
+    config_release_config();
     client->respcode = 401;
     auth_release (client->auth);
     client->auth = NULL;

Modified: icecast/branches/kh/icecast/src/client.h
===================================================================
--- icecast/branches/kh/icecast/src/client.h	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/client.h	2006-02-12 21:50:10 UTC (rev 10807)
@@ -22,13 +22,14 @@
 #include <aio.h>
 #endif
 
+struct source_tag;
+typedef struct _client_tag client_t;
+
 #include "connection.h"
 #include "refbuf.h"
 #include "httpp/httpp.h"
 
-struct source_tag;
-
-typedef struct _client_tag
+struct _client_tag
 {
     /* the client's connection */
     connection_t *con;
@@ -81,7 +82,7 @@
     int (*check_buffer)(struct source_tag *source, struct _client_tag *client);
 
     struct _client_tag *next;
-} client_t;
+};
 
 int client_create (client_t **c_ptr, connection_t *con, http_parser_t *parser);
 void client_destroy(client_t *client);

Modified: icecast/branches/kh/icecast/src/compat.h
===================================================================
--- icecast/branches/kh/icecast/src/compat.h	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/compat.h	2006-02-12 21:50:10 UTC (rev 10807)
@@ -20,12 +20,34 @@
  * Solaris.
  */
 
+#ifdef _WIN32
+#include <windows.h>
+#include <time.h>
+#else
+#include <unistd.h>
+# ifdef TIME_WITH_SYS_TIME
+#  include <sys/time.h>
+#  include <time.h>
+# else
+#  ifdef HAVE_SYS_TIME_H
+#   include <sys/time.h>
+#  else
+#   include <time.h>
+#  endif
+# endif
+#endif
+
+
 /* Make sure we define 64 bit types */
 #ifdef _WIN32
+#  define PATH_SEPARATOR "\\"
+#  define size_t unsigned int
+#  define ssize_t int
 #  define int64_t __int64
 #  define uint64_t unsigned __int64
 #  define uint32_t unsigned int
 #else
+#  define PATH_SEPARATOR "/"
 #  if defined(HAVE_STDINT_H)
 #    include <stdint.h>
 #  elif defined(HAVE_INTTYPES_H)

Modified: icecast/branches/kh/icecast/src/connection.c
===================================================================
--- icecast/branches/kh/icecast/src/connection.c	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/connection.c	2006-02-12 21:50:10 UTC (rev 10807)
@@ -15,16 +15,16 @@
 #include <config.h>
 #endif
 
+#include "compat.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <time.h>
 #ifdef HAVE_POLL
 #include <sys/poll.h>
 #endif
 
 #ifndef _WIN32
-#include <sys/time.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #else
@@ -33,12 +33,7 @@
 #define strcasecmp stricmp
 #define strncasecmp strnicmp
 #endif
-#ifdef HAVE_OPENSSL
-#include <openssl/ssl.h>
-#endif
 
-#include "os.h"
-
 #include "thread/thread.h"
 #include "avl/avl.h"
 #include "net/sock.h"
@@ -113,6 +108,7 @@
 rwlock_t _source_shutdown_rwlock;
 
 static void *_handle_connection(void *arg);
+static int check_pass(http_parser_t *parser, const char *user, const char *pass);
 
 void connection_initialize(void)
 {
@@ -131,11 +127,13 @@
 
 static void get_ssl_certificate ()
 {
-    ssl_ok = 0;
 #ifdef HAVE_OPENSSL
     SSL_METHOD *method;
     ice_config_t *config;
+#endif
+    ssl_ok = 0;
 
+#ifdef HAVE_OPENSSL
     SSL_load_error_strings();                /* readable error messages */
     SSL_library_init();                      /* initialize library */
 
@@ -203,7 +201,7 @@
 
 
 #ifdef HAVE_OPENSSL
-static int connection_read_ssl (connection_t *con, char *buf, unsigned len)
+static int connection_read_ssl (connection_t *con, void *buf, size_t len)
 {
     int bytes = SSL_read (con->ssl, buf, len);
 
@@ -221,7 +219,7 @@
 }
 
 
-static int connection_send_ssl (connection_t *con, const char *buf, unsigned len)
+static int connection_send_ssl (connection_t *con, const void *buf, size_t len)
 {
     int bytes = SSL_write (con->ssl, buf, len);
 
@@ -241,7 +239,7 @@
 }
 #endif
 
-static int connection_read (connection_t *con, char *buf, unsigned len)
+static int connection_read (connection_t *con, void *buf, size_t len)
 {
     int bytes = sock_read_bytes (con->sock, buf, len);
     if (bytes == 0)
@@ -251,7 +249,7 @@
     return bytes;
 }
 
-static int connection_send (connection_t *con, const char *buf, unsigned len)
+static int connection_send (connection_t *con, const void *buf, size_t len)
 {
     int bytes = sock_write_bytes (con->sock, buf, len);
     if (bytes < 0)
@@ -448,7 +446,7 @@
 
 
 /* run along queue checking for any data that has come in or a timeout */
-static void process_request_queue ()
+static void process_request_queue (void)
 {
     client_queue_t **node_ref = (client_queue_t **)&_req_queue;
     ice_config_t *config = config_get_config ();
@@ -715,7 +713,7 @@
 
 
 static int _check_pass_http(http_parser_t *parser, 
-        char *correctuser, char *correctpass)
+        const char *correctuser, const char *correctpass)
 {
     /* This will look something like "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" */
     char *header = httpp_getvar(parser, "authorization");
@@ -753,7 +751,7 @@
     return 1;
 }
 
-static int _check_pass_icy(http_parser_t *parser, char *correctpass)
+static int _check_pass_icy(http_parser_t *parser, const char *correctpass)
 {
     char *password;
 
@@ -767,7 +765,7 @@
         return 1;
 }
 
-static int _check_pass_ice(http_parser_t *parser, char *correctpass)
+static int _check_pass_ice(http_parser_t *parser, const char *correctpass)
 {
     char *password;
 
@@ -820,29 +818,53 @@
     return ret;
 }
 
-int connection_check_source_pass(http_parser_t *parser, const char *mount)
+/* return -1 for failed, 0 for authenticated, 1 for pending
+ */
+int connection_check_source_pass (client_t *client, const char *mount)
 {
     ice_config_t *config = config_get_config();
+    mount_proxy *mountinfo;
     char *pass = config->source_password;
     char *user = "source";
-    int ret;
-    int ice_login = config->ice_login;
-    char *protocol;
+    int ret = -1;
 
-    mount_proxy *mountinfo = config_find_mount (config, mount);
-
-    if (mountinfo)
+    if (strncmp (mount, "/admin/", 7) == 0)
     {
-        if (mountinfo->password)
-            pass = mountinfo->password;
-        if (mountinfo->username)
-            user = mountinfo->username;
+        mountinfo = config_find_mount (config, 
+                httpp_get_query_param (client->parser, "mount"));
     }
+    else
+        mountinfo = config_find_mount (config, mount);
+    do
+    {
+        if (mountinfo)
+        {
+            ret = 1;
+            if (auth_stream_authenticate (client, mount, mountinfo) > 0)
+                break;
+            ret = -1;
+            if (mountinfo->password)
+                pass = mountinfo->password;
+            if (mountinfo->username)
+                user = mountinfo->username;
+        }
+        if (check_pass (client->parser, user, pass) > 0)
+            ret = 0;
+    } while (0);
+    config_release_config();
+    return ret;
+}
 
+/* return 0 for failed, 1 for ok
+ */
+static int check_pass (http_parser_t *parser, const char *user, const char *pass)
+{
+    int ret;
+    char *protocol;
+
     if(!pass) {
         WARN0("No source password set, rejecting source");
-        config_release_config();
-        return 0;
+        return -1;
     }
 
     protocol = httpp_getvar(parser, HTTPP_VAR_PROTOCOL);
@@ -851,22 +873,23 @@
     }
     else {
         ret = _check_pass_http(parser, user, pass);
-        if(!ret && ice_login)
+        if (!ret)
         {
-            ret = _check_pass_ice(parser, pass);
-            if(ret)
-                WARN0("Source is using deprecated icecast login");
+            ice_config_t *config = config_get_config_unlocked();
+            if (config->ice_login)
+            {
+                ret = _check_pass_ice(parser, pass);
+                if(ret)
+                    WARN0("Source is using deprecated icecast login");
+            }
         }
     }
-    config_release_config();
     return ret;
 }
 
 
-static void _handle_source_request (client_t *client, char *uri, int auth_style)
+static void _handle_source_request (client_t *client, const char *uri)
 {
-    source_t *source;
-
     INFO1("Source logging in at mountpoint \"%s\"", uri);
 
     if (uri[0] != '/')
@@ -875,35 +898,50 @@
         client_send_401 (client);
         return;
     }
-    if (auth_style == ICECAST_SOURCE_AUTH) {
-        if (connection_check_source_pass (client->parser, uri) == 0)
-        {
+    switch (connection_check_source_pass (client, uri))
+    {
+        case 0: /* authenticated from config file */
+            source_startup (client, uri, ICECAST_SOURCE_AUTH);
+            break;
+
+        case 1: /* auth pending */
+            break;
+
+        default: /* failed */
             /* We commonly get this if the source client is using the wrong
              * protocol: attempt to diagnose this and return an error
              */
             /* TODO: Do what the above comment says */
             INFO1("Source (%s) attempted to login with invalid or missing password", uri);
             client_send_401(client);
-            return;
-        }
+            break;
     }
+}
+
+void source_startup (client_t *client, const char *uri, int auth_style)
+{
+    source_t *source;
     source = source_reserve (uri);
+    
     if (source)
     {
-        if (auth_style == SHOUTCAST_SOURCE_AUTH) {
-            source->shoutcast_compat = 1;
-        }
         source->client = client;
         source->parser = client->parser;
         if (connection_complete_source (source, 1) < 0)
         {
             source_clear_source (source);
             source_free_source (source);
+            return;
         }
+        client->respcode = 200;
+        if (auth_style == SHOUTCAST_SOURCE_AUTH)
+        {
+            source->shoutcast_compat = 1;
+            source_client_callback (client, source);
+        }
         else
         {
             refbuf_t *ok = refbuf_new (PER_CLIENT_REFBUF_SIZE);
-            client->respcode = 200;
             snprintf (ok->data, PER_CLIENT_REFBUF_SIZE,
                     "HTTP/1.0 200 OK\r\n\r\n");
             ok->len = strlen (ok->data);
@@ -912,12 +950,10 @@
             client->refbuf = ok;
             fserve_add_client_callback (client, source_client_callback, source);
         }
+        return;
     }
-    else
-    {
-        client_send_403 (client, "Mountpoint in use");
-        WARN1 ("Mountpoint %s in use", uri);
-    }
+    client_send_403 (client, "Mountpoint in use");
+    WARN1 ("Mountpoint %s in use", uri);
 }
 
 
@@ -987,9 +1023,8 @@
     stats_event_inc(NULL, "client_connections");
 
     /* Dispatch all admin requests */
-    if ((strcmp(uri, "/admin.cgi") == 0) ||
-            (strncmp(uri, "/admin/", 7) == 0)) {
-        admin_handle_request(client, uri);
+    if (admin_handle_request (client, uri) == 0)
+    {
         if (uri != passed_uri) free (uri);
         return;
     }
@@ -1100,7 +1135,7 @@
             memmove (ptr, ptr + node->stream_offset, client->refbuf->len);
         }
         client->parser = parser;
-        _handle_source_request (client, shoutcast_mount, SHOUTCAST_SOURCE_AUTH);
+        source_startup (client, shoutcast_mount, SHOUTCAST_SOURCE_AUTH);
     }
     else
         client_destroy (client);
@@ -1169,7 +1204,7 @@
                 }
 
                 if (parser->req_type == httpp_req_source) {
-                    _handle_source_request (client, uri, ICECAST_SOURCE_AUTH);
+                    _handle_source_request (client, uri);
                 }
                 else if (parser->req_type == httpp_req_stats) {
                     _handle_stats_request (client, uri);

Modified: icecast/branches/kh/icecast/src/connection.h
===================================================================
--- icecast/branches/kh/icecast/src/connection.h	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/connection.h	2006-02-12 21:50:10 UTC (rev 10807)
@@ -17,16 +17,20 @@
 #include <time.h>
 #ifdef HAVE_OPENSSL
 #include <openssl/ssl.h>
+#else
+#define SSL void
 #endif
+
+struct source_tag;
+typedef struct connection_tag connection_t;
+
+#include "client.h"
 #include "compat.h"
 #include "httpp/httpp.h"
 #include "thread/thread.h"
 #include "net/sock.h"
 
-struct _client_tag;
-struct source_tag;
-
-typedef struct connection_tag
+struct connection_tag
 {
     unsigned long id;
 
@@ -39,17 +43,21 @@
     int error;
 
 #ifdef HAVE_OPENSSL
-    /* SSL handler */
-    SSL *ssl;
+    SSL *ssl;   /* SSL handler */
 #endif
-    int (*send)(struct connection_tag *handle, const char *buf, unsigned int len);
-    int (*read)(struct connection_tag *handle, char *buf, unsigned int len);
+    int (*send)(struct connection_tag *handle, const void *buf, size_t len);
+    int (*read)(struct connection_tag *handle, void *buf, size_t len);
 
     char *ip;
     char *host;
 
-} connection_t;
+};
 
+#ifdef HAVE_OPENSSL
+#define not_ssl_connection(x)    ((x)->ssl==NULL)
+#else
+#define not_ssl_connection(x)    (1)
+#endif
 void connection_initialize(void);
 void connection_shutdown(void);
 void connection_accept_loop(void);
@@ -57,7 +65,7 @@
 connection_t *connection_create (sock_t sock, sock_t serversock, char *ip);
 int connection_complete_source (struct source_tag *source, int response);
 
-int connection_check_source_pass(http_parser_t *parser, const char *mount);
+int connection_check_source_pass (client_t *client, const char *mount);
 int connection_check_relay_pass(http_parser_t *parser);
 int connection_check_admin_pass(http_parser_t *parser);
 

Modified: icecast/branches/kh/icecast/src/format.c
===================================================================
--- icecast/branches/kh/icecast/src/format.c	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/format.c	2006-02-12 21:50:10 UTC (rev 10807)
@@ -21,6 +21,7 @@
 #include <config.h>
 #endif
 
+#include <sys/types.h>
 #include <stdlib.h>
 #include <string.h>
 #ifdef HAVE_STRINGS_H
@@ -136,7 +137,7 @@
 static int get_file_data (FILE *intro, client_t *client)
 {
     refbuf_t *refbuf = client->refbuf;
-    int bytes;
+    size_t bytes;
 
     if (intro == NULL || fseek (intro, client->intro_offset, SEEK_SET) < 0)
         return 0;
@@ -277,6 +278,7 @@
     int bytes;
     int bitrate_filtered = 0;
     avl_node *node;
+    ice_config_t *config;
 
     remaining = client->refbuf->len;
     ptr = client->refbuf->data;
@@ -346,7 +348,9 @@
     }
     avl_tree_unlock (source->parser->vars);
 
-    bytes = snprintf (ptr, remaining, "Server: %s\r\n", ICECAST_VERSION_STRING);
+    config = config_get_config();
+    bytes = snprintf (ptr, remaining, "Server: %s\r\n", config->server_id);
+    config_release_config();
     remaining -= bytes;
     ptr += bytes;
 

Modified: icecast/branches/kh/icecast/src/format_flac.c
===================================================================
--- icecast/branches/kh/icecast/src/format_flac.c	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/format_flac.c	2006-02-12 21:50:10 UTC (rev 10807)
@@ -46,14 +46,14 @@
 {
     refbuf_t * refbuf;
 
-    if (ogg_stream_pagein (&codec->os, page) < 0)
-    {
-        ogg_info->error = 1;
-        return NULL;
-    }
     if (codec->headers)
     {
         ogg_packet packet;
+        if (ogg_stream_pagein (&codec->os, page) < 0)
+        {
+            ogg_info->error = 1;
+            return NULL;
+        }
         while (ogg_stream_packetout (&codec->os, &packet))
         {
             int type = packet.packet[0];

Modified: icecast/branches/kh/icecast/src/format_mp3.c
===================================================================
--- icecast/branches/kh/icecast/src/format_mp3.c	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/format_mp3.c	2006-02-12 21:50:10 UTC (rev 10807)
@@ -164,7 +164,7 @@
 }
 
 
-static void filter_shoutcast_metadata (source_t *source, char *metadata, unsigned int meta_len)
+static void filter_shoutcast_metadata (source_t *source, char *metadata, size_t meta_len)
 {
     if (metadata)
     {
@@ -220,7 +220,7 @@
 static void mp3_set_title (source_t *source)
 {
     const char meta[] = "StreamTitle='";
-    int size;
+    size_t size;
     unsigned char len_byte;
     refbuf_t *p;
     unsigned int len = sizeof(meta) + 2; /* the StreamTitle, quotes, ; and null */
@@ -277,7 +277,7 @@
 static int send_mp3_metadata (client_t *client, refbuf_t *associated)
 {
     int ret = 0;
-    unsigned char *metadata;
+    char *metadata;
     int meta_len;
     mp3_client_data *client_mp3 = client->format_data;
 
@@ -332,7 +332,7 @@
     mp3_client_data *client_mp3 = client->format_data;
     refbuf_t *refbuf = client->refbuf;
     char *buf = refbuf->data + client->pos;
-    unsigned int len = refbuf->len - client->pos;
+    size_t len = refbuf->len - client->pos;
 
     do
     {
@@ -349,7 +349,7 @@
         /* see if we need to send the current metadata to the client */
         if (client_mp3->interval)
         {
-            unsigned int remaining = client_mp3->interval -
+            size_t remaining = client_mp3->interval -
                 client_mp3->since_meta_block;
 
             /* sending the metadata block */
@@ -510,7 +510,7 @@
 
     refbuf = source_mp3->read_data;
     source_mp3->read_data = NULL;
-    src = refbuf->data;
+    src = (unsigned char *)refbuf->data;
 
     if (source_mp3->update_metadata)
     {
@@ -620,7 +620,7 @@
     mp3_state *source_mp3 = source->format->_state;
     const char *metadata;
     /* the +-2 is for overwriting the last set of \r\n */
-    unsigned remaining = 4096 - client->refbuf->len + 2;
+    size_t  remaining = 4096 - client->refbuf->len + 2;
     char *ptr = client->refbuf->data + client->refbuf->len - 2;
     int bytes;
 
@@ -679,7 +679,7 @@
 {
     if (refbuf->len == 0)
         return;
-    if (fwrite (refbuf->data, 1, refbuf->len, source->dumpfile) < (size_t)refbuf->len)
+    if (fwrite (refbuf->data, 1, refbuf->len, source->dumpfile) < refbuf->len)
     {
         WARN0 ("Write to dump file failed, disabling");
         fclose (source->dumpfile);

Modified: icecast/branches/kh/icecast/src/format_ogg.c
===================================================================
--- icecast/branches/kh/icecast/src/format_ogg.c	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/format_ogg.c	2006-02-12 21:50:10 UTC (rev 10807)
@@ -181,7 +181,7 @@
 }
 
 
-void format_ogg_free_plugin (format_plugin_t *plugin)
+static void format_ogg_free_plugin (format_plugin_t *plugin)
 {
     ogg_state_t *state = plugin->_state;
 
@@ -306,8 +306,8 @@
     {
         if (codec->name)
         {
-            int len = strlen (codec_names);
-            int remaining = sizeof (codec_names) - len;
+            size_t len = strlen (codec_names);
+            size_t remaining = sizeof (codec_names) - len;
             char *where = codec_names + len;
             char *separator = "/";
             if (len == 0)

Modified: icecast/branches/kh/icecast/src/format_vorbis.c
===================================================================
--- icecast/branches/kh/icecast/src/format_vorbis.c	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/format_vorbis.c	2006-02-12 21:50:10 UTC (rev 10807)
@@ -331,7 +331,7 @@
             vorbis_comment_add_tag (&vc, "artist", ogg_info->artist);
         if (ogg_info->title)
             vorbis_comment_add_tag (&vc, "title", ogg_info->title);
-        vorbis_comment_add (&vc, "server=" ICECAST_VERSION_STRING);
+        vorbis_comment_add_tag (&vc, "server", ICECAST_VERSION_STRING);
         vorbis_commentheader_out (&vc, &header);
 
         ogg_stream_packetin (&source_vorbis->new_os, &header);

Modified: icecast/branches/kh/icecast/src/fserve.c
===================================================================
--- icecast/branches/kh/icecast/src/fserve.c	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/fserve.c	2006-02-12 21:50:10 UTC (rev 10807)
@@ -203,7 +203,7 @@
 }
 #endif
 
-static void wait_for_fds() {
+static void wait_for_fds(void) {
     fserve_t *fclient;
 
     while (run_fserv)
@@ -235,7 +235,7 @@
 static void *fserv_thread_function(void *arg)
 {
     fserve_t *fclient, **trail;
-    int bytes;
+    size_t bytes;
 
     INFO0("file serving thread started");
     while (run_fserv)

Modified: icecast/branches/kh/icecast/src/logging.c
===================================================================
--- icecast/branches/kh/icecast/src/logging.c	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/logging.c	2006-02-12 21:50:10 UTC (rev 10807)
@@ -25,7 +25,7 @@
 #include "refbuf.h"
 #include "client.h"
 
-#include "os.h"
+#include "compat.h"
 #include "cfgfile.h"
 #include "logging.h"
 #include "util.h"

Modified: icecast/branches/kh/icecast/src/logging.h
===================================================================
--- icecast/branches/kh/icecast/src/logging.h	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/logging.h	2006-02-12 21:50:10 UTC (rev 10807)
@@ -29,35 +29,27 @@
 ** feel free to add more here if needed. 
 */
 
-#ifdef _WIN32
-#define __FUNCTION__ strrchr (__FILE__, '\\') ? strrchr (__FILE__, '\\') + 1 : __FILE__
-#endif
+#define ERROR0(y) log_write(errorlog, 1, CATMODULE "/", __func__, y)
+#define ERROR1(y, a) log_write(errorlog, 1, CATMODULE "/", __func__, y, a)
+#define ERROR2(y, a, b) log_write(errorlog, 1, CATMODULE "/", __func__, y, a, b)
+#define ERROR3(y, a, b, c) log_write(errorlog, 1, CATMODULE "/", __func__, y, a, b, c)
 
-#ifdef __SUNPRO_C
-#define __FUNCTION__ __func__
-#endif
+#define WARN0(y) log_write(errorlog, 2, CATMODULE "/", __func__, y)
+#define WARN1(y, a) log_write(errorlog, 2, CATMODULE "/", __func__, y, a)
+#define WARN2(y, a, b) log_write(errorlog, 2, CATMODULE "/", __func__, y, a, b)
+#define WARN3(y, a, b, c) log_write(errorlog, 2, CATMODULE "/", __func__, y, a, b, c)
 
-#define ERROR0(y) log_write(errorlog, 1, CATMODULE "/", __FUNCTION__, y)
-#define ERROR1(y, a) log_write(errorlog, 1, CATMODULE "/", __FUNCTION__, y, a)
-#define ERROR2(y, a, b) log_write(errorlog, 1, CATMODULE "/", __FUNCTION__, y, a, b)
-#define ERROR3(y, a, b, c) log_write(errorlog, 1, CATMODULE "/", __FUNCTION__, y, a, b, c)
+#define INFO0(y) log_write(errorlog, 3, CATMODULE "/", __func__, y)
+#define INFO1(y, a) log_write(errorlog, 3, CATMODULE "/", __func__, y, a)
+#define INFO2(y, a, b) log_write(errorlog, 3, CATMODULE "/", __func__, y, a, b)
+#define INFO3(y, a, b, c) log_write(errorlog, 3, CATMODULE "/", __func__, y, a, b, c)
 
-#define WARN0(y) log_write(errorlog, 2, CATMODULE "/", __FUNCTION__, y)
-#define WARN1(y, a) log_write(errorlog, 2, CATMODULE "/", __FUNCTION__, y, a)
-#define WARN2(y, a, b) log_write(errorlog, 2, CATMODULE "/", __FUNCTION__, y, a, b)
-#define WARN3(y, a, b, c) log_write(errorlog, 2, CATMODULE "/", __FUNCTION__, y, a, b, c)
+#define DEBUG0(y) log_write(errorlog, 4, CATMODULE "/", __func__, y)
+#define DEBUG1(y, a) log_write(errorlog, 4, CATMODULE "/", __func__, y, a)
+#define DEBUG2(y, a, b) log_write(errorlog, 4, CATMODULE "/", __func__, y, a, b)
+#define DEBUG3(y, a, b, c) log_write(errorlog, 4, CATMODULE "/", __func__, y, a, b, c)
+#define DEBUG4(y, a, b, c, d) log_write(errorlog, 4, CATMODULE "/", __func__, y, a, b, c, d)
 
-#define INFO0(y) log_write(errorlog, 3, CATMODULE "/", __FUNCTION__, y)
-#define INFO1(y, a) log_write(errorlog, 3, CATMODULE "/", __FUNCTION__, y, a)
-#define INFO2(y, a, b) log_write(errorlog, 3, CATMODULE "/", __FUNCTION__, y, a, b)
-#define INFO3(y, a, b, c) log_write(errorlog, 3, CATMODULE "/", __FUNCTION__, y, a, b, c)
-
-#define DEBUG0(y) log_write(errorlog, 4, CATMODULE "/", __FUNCTION__, y)
-#define DEBUG1(y, a) log_write(errorlog, 4, CATMODULE "/", __FUNCTION__, y, a)
-#define DEBUG2(y, a, b) log_write(errorlog, 4, CATMODULE "/", __FUNCTION__, y, a, b)
-#define DEBUG3(y, a, b, c) log_write(errorlog, 4, CATMODULE "/", __FUNCTION__, y, a, b, c)
-#define DEBUG4(y, a, b, c, d) log_write(errorlog, 4, CATMODULE "/", __FUNCTION__, y, a, b, c, d)
-
 /* CATMODULE is the category or module that logging messages come from.
 ** we set one here in cause someone forgets in the .c file.
 */

Modified: icecast/branches/kh/icecast/src/main.c
===================================================================
--- icecast/branches/kh/icecast/src/main.c	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/main.c	2006-02-12 21:50:10 UTC (rev 10807)
@@ -39,7 +39,7 @@
 #include "sighandler.h"
 
 #include "global.h"
-#include "os.h"
+#include "compat.h"
 #include "connection.h"
 #include "refbuf.h"
 #include "client.h"
@@ -75,9 +75,9 @@
 #endif
 }
 
-static void _print_usage()
+static void _print_usage(void)
 {
-    printf(ICECAST_VERSION_STRING "\n\n");
+    printf("%s\n\n", ICECAST_VERSION_STRING);
     printf("usage: icecast [-b -v] -c <file>\n");
     printf("options:\n");
     printf("\t-c <file>\tSpecify configuration file\n");
@@ -514,7 +514,7 @@
         return 1;
     }
 
-    INFO0 (ICECAST_VERSION_STRING " server started");
+    INFO1 ("%s server started", ICECAST_VERSION_STRING);
 
     /* REM 3D Graphics */
 

Modified: icecast/branches/kh/icecast/src/md5.c
===================================================================
--- icecast/branches/kh/icecast/src/md5.c	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/md5.c	2006-02-12 21:50:10 UTC (rev 10807)
@@ -81,7 +81,7 @@
  * of bytes.
  */
 void MD5Update(struct MD5Context *ctx, unsigned char const *buf, 
-        unsigned len)
+        size_t len)
 {
     uint32_t t;
 

Modified: icecast/branches/kh/icecast/src/md5.h
===================================================================
--- icecast/branches/kh/icecast/src/md5.h	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/md5.h	2006-02-12 21:50:10 UTC (rev 10807)
@@ -26,7 +26,7 @@
 
 void MD5Init(struct MD5Context *context);
 void MD5Update(struct MD5Context *context, unsigned char const *buf, 
-        unsigned len);
+        size_t len);
 void MD5Final(unsigned char digest[HASH_LEN], struct MD5Context *context);
 
 

Deleted: icecast/branches/kh/icecast/src/os.h
===================================================================
--- icecast/branches/kh/icecast/src/os.h	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/os.h	2006-02-12 21:50:10 UTC (rev 10807)
@@ -1,30 +0,0 @@
-/* Icecast
- *
- * This program is distributed under the GNU General Public License, version 2.
- * A copy of this license is included with this source.
- *
- * Copyright 2000-2004, Jack Moffitt <jack at xiph.org, 
- *                      Michael Smith <msmith at xiph.org>,
- *                      oddsock <oddsock at xiph.org>,
- *                      Karl Heyes <karl at xiph.org>
- *                      and others (see AUTHORS for details).
- */
-
-#ifndef __OS_H__
-#define __OS_H__
-
-#ifdef _WIN32
-#include <windows.h>
-#else
-#include <unistd.h>
-#endif
-
-#ifdef _WIN32
-#define PATH_SEPARATOR "\\"
-#define size_t int
-#define ssize_t int
-#else
-#define PATH_SEPARATOR "/"
-#endif
-
-#endif  /* __OS_H__ */

Modified: icecast/branches/kh/icecast/src/refbuf.c
===================================================================
--- icecast/branches/kh/icecast/src/refbuf.c	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/refbuf.c	2006-02-12 21:50:10 UTC (rev 10807)
@@ -20,9 +20,11 @@
 #include <config.h>
 #endif
 
+#include <sys/types.h>
 #include <stdlib.h>
 #include <string.h>
 
+#include "compat.h"
 #include "refbuf.h"
 
 void refbuf_initialize(void)
@@ -33,22 +35,19 @@
 {
 }
 
-refbuf_t *refbuf_new(unsigned long size)
+refbuf_t *refbuf_new(size_t size)
 {
     refbuf_t *refbuf;
 
     refbuf = (refbuf_t *)malloc(sizeof(refbuf_t));
     if (refbuf == NULL)
-        return NULL;
+        abort();
     refbuf->data = NULL;
     if (size)
     {
         refbuf->data = malloc (size);
         if (refbuf->data == NULL)
-        {
-            free (refbuf);
-            return NULL;
-        }
+            abort();
     }
     refbuf->len = size;
     refbuf->sync_point = 0;

Modified: icecast/branches/kh/icecast/src/refbuf.h
===================================================================
--- icecast/branches/kh/icecast/src/refbuf.h	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/refbuf.h	2006-02-12 21:50:10 UTC (rev 10807)
@@ -18,10 +18,13 @@
 #ifndef __REFBUF_H__
 #define __REFBUF_H__
 
+#include <sys/types.h>
+#include "compat.h"
+
 typedef struct _refbuf_tag
 {
     char *data;
-    unsigned long len;
+    size_t len;
     int sync_point;
     struct _refbuf_tag *associated;
     struct _refbuf_tag *next;
@@ -32,7 +35,7 @@
 void refbuf_initialize(void);
 void refbuf_shutdown(void);
 
-refbuf_t *refbuf_new(unsigned long size);
+refbuf_t *refbuf_new(size_t size);
 void refbuf_addref(refbuf_t *self);
 void refbuf_release(refbuf_t *self);
 

Modified: icecast/branches/kh/icecast/src/slave.c
===================================================================
--- icecast/branches/kh/icecast/src/slave.c	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/slave.c	2006-02-12 21:50:10 UTC (rev 10807)
@@ -25,11 +25,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <time.h>
 #include <sys/types.h>
 
 #ifndef _WIN32
-#include <sys/time.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #else
@@ -42,7 +40,7 @@
 #include <curl/curl.h>
 #endif
 
-#include "os.h"
+#include "compat.h"
 
 #include "thread/thread.h"
 #include "avl/avl.h"
@@ -71,7 +69,6 @@
 static int slave_running = 0;
 static int update_settings = 0;
 static volatile unsigned int max_interval = 0;
-static volatile int rescan_relays = 0;
 static rwlock_t slaves_lock;
 
 relay_server *relay_free (relay_server *relay)
@@ -98,8 +95,8 @@
 
     if (copy)
     {
-        copy->server = xmlStrdup (r->server);
-        copy->mount = xmlStrdup (r->mount);
+        copy->server = xmlCharStrdup (r->server);
+        copy->mount = xmlCharStrdup (r->mount);
         copy->localmount = xmlStrdup (r->localmount);
         if (r->username)
             copy->username = xmlStrdup (r->username);
@@ -126,22 +123,12 @@
 }
 
 
-/* Request slave thread to rescan the existing relays to see if any need
- * starting up, eg on-demand relays
- */
-void slave_rescan (void)
-{
-    rescan_relays = 1;
-}
-
-
 /* Request slave thread to check the relay list for changes and to
  * update the stats for the current streams.
  */
 void slave_rebuild_mounts (void)
 {
     update_settings = 1;
-    rescan_relays = 1;
 }
 
 
@@ -227,7 +214,8 @@
     do
     {
         char *auth_header;
-        char *redirect_header = NULL;
+        char *redirect_header = NULL, *server_id;
+        ice_config_t *config;
 
         streamsock = sock_connect_wto (relay->server, relay->port, 10);
         if (streamsock == SOCK_ERROR)
@@ -238,11 +226,12 @@
         }
         con = connection_create (streamsock, -1, NULL);
 
+        config = config_get_config ();
+        server_id = strdup (config->server_id);
         if (relay->username && relay->password)
         {
             char *esc_authorisation;
             unsigned len = strlen(relay->username) + strlen(relay->password) + 2;
-            ice_config_t *config;
 
             auth_header = malloc (len);
             snprintf (auth_header, len, "%s:%s", relay->username, relay->password);
@@ -255,7 +244,6 @@
             free(esc_authorisation);
 
             /* header to use for participating in load sharing */
-            config = config_get_config ();
             if (config->master_redirect_port)
             {
                 len = strlen ("ice-redirect:") + strlen (config->hostname) + 10;
@@ -265,14 +253,13 @@
             }
             else
                 redirect_header = strdup ("");
-
-            config_release_config ();
         }
         else
         {
             auth_header = strdup ("");
             redirect_header = strdup ("");
         }
+        config_release_config ();
 
         /* At this point we may not know if we are relaying an mp3 or vorbis
          * stream, but only send the icy-metadata header if the relay details
@@ -280,15 +267,17 @@
          * we don't send in this header then relay will not have mp3 metadata.
          */
         sock_write(streamsock, "GET %s HTTP/1.0\r\n"
-                "User-Agent: " ICECAST_VERSION_STRING "\r\n"
+                "User-Agent: %s\r\n"
                 "%s"
                 "%s"
                 "%s"
                 "\r\n",
                 relay->mount,
+                server_id,
                 relay->mp3metadata?"Icy-MetaData: 1\r\n":"",
                 redirect_header,
                 auth_header);
+        free (server_id);
         free (auth_header);
         free (redirect_header);
         memset (header, 0, sizeof(header));
@@ -340,11 +329,11 @@
             /* only keep refreshing YP entries for inactive on-demand relays */
             yp_remove (relay->localmount);
             relay->source->yp_public = -1;
+            relay->start = global.time + 10; /* prevent busy looping if failing */
         }
 
-        /* initiate an immediate relay cleanup run */
+        /* we've finished, now get cleaned up */
         relay->cleanup = 1;
-        rescan_relays = 1;
 
         return NULL;
     } while (0);
@@ -369,9 +358,9 @@
         httpp_destroy (parser);
     source_clear_source (relay->source);
 
-    /* initiate an immediate relay cleanup run */
+    /* cleanup relay, but prevent this relay from starting up again too soon */
+    relay->start = global.time + max_interval;
     relay->cleanup = 1;
-    rescan_relays = 1;
 
     return NULL;
 }
@@ -398,7 +387,8 @@
     do
     {
         source_t *source = relay->source;
-        if (relay->source == NULL || relay->running)
+        /* skip relay if active, not configured or just not time yet */
+        if (relay->source == NULL || relay->running || relay->start > global.time)
             break;
         if (relay->enable == 0)
         {
@@ -434,6 +424,7 @@
                 break;
         }
 
+        relay->start = global.time + 5;
         relay->thread = thread_create ("Relay Thread", start_relay_stream,
                 relay, THREAD_ATTACHED);
         return;
@@ -550,7 +541,7 @@
 }
 
 
-static void relay_check_streams (relay_server *to_start, relay_server *to_free)
+static void relay_check_streams (relay_server *to_start, relay_server *to_free, int skip_timer)
 {
     relay_server *relay;
 
@@ -575,6 +566,8 @@
     relay = to_start;
     while (relay)
     {
+        if (skip_timer)
+            relay->start = 0;
         check_relay_stream (relay);
         relay = relay->next;
     }
@@ -594,6 +587,7 @@
     char *buffer;
     char *username;
     char *password;
+    char *server_id;
     relay_server *new_relays;
 };
 
@@ -718,7 +712,7 @@
     snprintf (url, sizeof (url), "%s://%s:%d/admin/streamlist.txt",
             protocol, master->server, port);
     handle = curl_easy_init ();
-    curl_easy_setopt (handle, CURLOPT_USERAGENT, ICECAST_VERSION_STRING);
+    curl_easy_setopt (handle, CURLOPT_USERAGENT, master->server_id);
     curl_easy_setopt (handle, CURLOPT_URL, url);
     curl_easy_setopt (handle, CURLOPT_HEADERFUNCTION, streamlist_header);
     curl_easy_setopt (handle, CURLOPT_HEADERDATA, master);
@@ -740,8 +734,8 @@
         thread_mutex_lock (&(config_locks()->relay_lock));
         cleanup_relays = update_relays (&global.master_relays, master->new_relays);
 
-        relay_check_streams (global.master_relays, cleanup_relays);
-        relay_check_streams (NULL, master->new_relays);
+        relay_check_streams (global.master_relays, cleanup_relays, 0);
+        relay_check_streams (NULL, master->new_relays, 0);
 
         thread_mutex_unlock (&(config_locks()->relay_lock));
     }
@@ -751,6 +745,7 @@
     free (master->username);
     free (master->password);
     free (master->buffer);
+    free (master->server_id);
     free (master);
     return NULL;
 }
@@ -773,6 +768,7 @@
     details->password = strdup (config->master_password);
     details->send_auth = config->master_relay_auth;
     details->on_demand = config->on_demand;
+    details->server_id = strdup (config->server_id);
 
     thread_create ("streamlist", streamlist_thread, details, THREAD_DETACHED);
 #else
@@ -807,7 +803,8 @@
 
     while (1)
     {
-        relay_server *cleanup_relays;
+        relay_server *cleanup_relays = NULL;
+        int skip_timer = 0;
 
         /* re-read xml file if requested */
         if (global . schedule_config_reread)
@@ -820,48 +817,41 @@
         if (slave_running == 0)
             break;
         time (&global.time);
-        if (rescan_relays == 0 && max_interval > ++interval)
-            continue;
+        ++interval;
 
+        thread_mutex_lock (&(config_locks()->relay_lock));
+
         /* only update relays lists when required */
         if (max_interval <= interval)
         {
             DEBUG0 ("checking master stream list");
             config = config_get_config();
 
+            if (max_interval == 0)
+                skip_timer = 1;
             interval = 0;
             max_interval = config->master_update_interval;
             update_master_as_slave (config);
 
             update_from_master (config);
 
-            thread_mutex_lock (&(config_locks()->relay_lock));
-
             cleanup_relays = update_relays (&global.relays, config->relay);
 
             config_release_config();
-
-            relay_check_streams (global.relays, cleanup_relays);
-            thread_mutex_unlock (&(config_locks()->relay_lock));
         }
-        else
-        {
-            DEBUG0 ("rescanning relay lists");
-            thread_mutex_lock (&(config_locks()->relay_lock));
-            relay_check_streams (global.master_relays, NULL);
-            relay_check_streams (global.relays, NULL);
-            thread_mutex_unlock (&(config_locks()->relay_lock));
-        }
-        rescan_relays = 0;
+        relay_check_streams (global.master_relays, NULL, skip_timer);
+        relay_check_streams (global.relays, cleanup_relays, skip_timer);
+        thread_mutex_unlock (&(config_locks()->relay_lock));
+
         if (update_settings)
         {
             update_settings = 0;
             source_recheck_mounts();
         }
     }
-    DEBUG0 ("shutting down current relays");
-    relay_check_streams (NULL, global.relays);
-    relay_check_streams (NULL, global.master_relays);
+    INFO0 ("shutting down current relays");
+    relay_check_streams (NULL, global.relays, 0);
+    relay_check_streams (NULL, global.master_relays, 0);
 
     INFO0 ("Slave thread shutdown complete");
 

Modified: icecast/branches/kh/icecast/src/slave.h
===================================================================
--- icecast/branches/kh/icecast/src/slave.h	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/slave.h	2006-02-12 21:50:10 UTC (rev 10807)
@@ -30,6 +30,7 @@
     int running;
     int cleanup;
     int enable;
+    time_t start;
     thread_type *thread;
     struct _relay_server *next;
 } relay_server;
@@ -46,7 +47,6 @@
 void slave_shutdown(void);
 void slave_recheck_mounts (void);
 void slave_rebuild_mounts (void);
-void slave_rescan (void);
 relay_server *slave_find_relay (relay_server *relays, const char *mount);
 int slave_redirect (const char *mountpoint, struct _client_tag *client);
 void slave_host_add (struct _client_tag *client, const char *header);

Modified: icecast/branches/kh/icecast/src/source.c
===================================================================
--- icecast/branches/kh/icecast/src/source.c	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/source.c	2006-02-12 21:50:10 UTC (rev 10807)
@@ -50,7 +50,7 @@
 #include "format.h"
 #include "fserve.h"
 #include "auth.h"
-#include "os.h"
+#include "compat.h"
 
 #undef CATMODULE
 #define CATMODULE "source"
@@ -192,6 +192,10 @@
     int i;
 
     DEBUG1 ("clearing source \"%s\"", source->mount);
+
+    /* log bytes read in access log */
+    if (source->client && source->format)
+        source->client->con->sent_bytes = source->format->read_bytes;
     client_destroy(source->client);
     source->client = NULL;
     source->parser = NULL;
@@ -710,7 +714,7 @@
     {
         if (mountinfo->on_connect)
             source_run_script (mountinfo->on_connect, source->mount);
-        auth_stream_start (mountinfo, source->mount);
+        auth_stream_start (mountinfo, source);
     }
     config_release_config();
 
@@ -799,7 +803,7 @@
     {
         if (mountinfo->on_disconnect)
             source_run_script (mountinfo->on_disconnect, source->mount);
-        auth_stream_end (mountinfo, source->mount);
+        auth_stream_end (mountinfo, source);
     }
     config_release_config();
 

Modified: icecast/branches/kh/icecast/src/source.h
===================================================================
--- icecast/branches/kh/icecast/src/source.h	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/source.h	2006-02-12 21:50:10 UTC (rev 10807)
@@ -82,6 +82,7 @@
 
 source_t *source_reserve (const char *mount);
 void *source_client_thread (void *arg);
+void source_startup (client_t *client, const char *uri, int auth_style);
 void source_client_callback (client_t *client, void *source);
 void source_update_settings (ice_config_t *config, source_t *source, mount_proxy *mountinfo);
 void source_clear_source (source_t *source);

Modified: icecast/branches/kh/icecast/src/stats.c
===================================================================
--- icecast/branches/kh/icecast/src/stats.c	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/stats.c	2006-02-12 21:50:10 UTC (rev 10807)
@@ -121,7 +121,7 @@
     thread_mutex_unlock(&_global_event_mutex);
 }
 
-void stats_initialize()
+void stats_initialize(void)
 {
     _event_listeners = NULL;
 
@@ -141,7 +141,7 @@
     _stats_thread_id = thread_create("Stats Thread", _stats_thread, NULL, THREAD_ATTACHED);
 }
 
-void stats_shutdown()
+void stats_shutdown(void)
 {
     int n;
 
@@ -184,7 +184,7 @@
     }
 }
 
-stats_t *stats_get_stats()
+stats_t *stats_get_stats(void)
 {
     /* lock global stats
     
@@ -549,8 +549,10 @@
     stats_event_t *event;
     stats_event_t *copy;
     event_listener_t *listener;
+    ice_config_t *config = config_get_config ();
 
-    stats_event (NULL, "server", ICECAST_VERSION_STRING);
+    stats_event (NULL, "server", config->server_id);
+    config_release_config();
     stats_event_time (NULL, "server_start");
 
     /* global currently active stats */

Modified: icecast/branches/kh/icecast/src/stats.h
===================================================================
--- icecast/branches/kh/icecast/src/stats.h	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/stats.h	2006-02-12 21:50:10 UTC (rev 10807)
@@ -70,10 +70,10 @@
 
 } stats_t;
 
-void stats_initialize();
-void stats_shutdown();
+void stats_initialize(void);
+void stats_shutdown(void);
 
-stats_t *stats_get_stats();
+stats_t *stats_get_stats(void);
 
 void stats_event(const char *source, const char *name, const char *value);
 void stats_event_args(const char *source, char *name, char *format, ...);

Modified: icecast/branches/kh/icecast/src/util.c
===================================================================
--- icecast/branches/kh/icecast/src/util.c	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/util.c	2006-02-12 21:50:10 UTC (rev 10807)
@@ -15,7 +15,6 @@
 #endif
 
 #include <sys/types.h>
-#include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 
@@ -40,7 +39,7 @@
 
 #include "cfgfile.h"
 #include "util.h"
-#include "os.h"
+#include "compat.h"
 #include "refbuf.h"
 #include "connection.h"
 #include "client.h"
@@ -278,7 +277,7 @@
       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
 };
 
-char *util_url_escape(char *src)
+char *util_url_escape(void *src)
 {
     int len = strlen(src);
     /* Efficiency not a big concern here, keep the code simple/conservative */
@@ -305,7 +304,7 @@
 char *util_url_unescape(char *src)
 {
     int len = strlen(src);
-    unsigned char *decoded;
+    void *decoded;
     int i;
     char *dst;
     int done = 0;
@@ -420,8 +419,9 @@
 }
 
 /* This isn't efficient, but it doesn't need to be */
-char *util_base64_encode(char *data)
+char *util_base64_encode(void *ptr)
 {
+    char *data = ptr;
     int len = strlen(data);
     char *out = malloc(len*4/3 + 4);
     char *result = out;
@@ -453,9 +453,10 @@
     return result;
 }
 
-char *util_base64_decode(unsigned char *input)
+char *util_base64_decode(void *ptr)
 {
-    int len = strlen(input);
+    unsigned char *input = ptr;
+    int len = strlen(ptr);
     char *out = malloc(len*3/4 + 5);
     char *result = out;
     signed char vals[4];

Modified: icecast/branches/kh/icecast/src/util.h
===================================================================
--- icecast/branches/kh/icecast/src/util.h	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/util.h	2006-02-12 21:50:10 UTC (rev 10807)
@@ -13,6 +13,8 @@
 #ifndef __UTIL_H__
 #define __UTIL_H__
 
+#include "compat.h"
+
 #define XSLT_CONTENT 1
 #define HTML_CONTENT 2
 
@@ -26,12 +28,12 @@
 char *util_get_path_from_uri(char *uri);
 char *util_get_path_from_normalised_uri(const char *uri);
 char *util_normalise_uri(char *uri);
-char *util_base64_encode(char *data);
-char *util_base64_decode(unsigned char *input);
+char *util_base64_encode(void *data);
+char *util_base64_decode(void *input);
 char *util_bin_to_hex(unsigned char *data, int len);
 
 char *util_url_unescape(char *src);
-char *util_url_escape(char *src);
+char *util_url_escape(void *src);
 
 /* String dictionary type, without support for NULL keys, or multiple
  * instances of the same key */

Modified: icecast/branches/kh/icecast/src/xslt.c
===================================================================
--- icecast/branches/kh/icecast/src/xslt.c	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/xslt.c	2006-02-12 21:50:10 UTC (rev 10807)
@@ -94,7 +94,7 @@
 static stylesheet_cache_t cache[CACHESIZE];
 static mutex_t xsltlock;
 
-void xslt_initialize()
+void xslt_initialize(void)
 {
     xmlSubstituteEntitiesDefault(1);
     xmlLoadExtDtdDefaultValue = 1;
@@ -105,7 +105,7 @@
     xmlLoadExtDtdDefaultValue = 1;
 }
 
-void xslt_shutdown() {
+void xslt_shutdown(void) {
     int i;
 
     for(i=0; i < CACHESIZE; i++) {
@@ -119,7 +119,7 @@
     xsltCleanupGlobals();
 }
 
-static int evict_cache_entry() {
+static int evict_cache_entry(void) {
     int i, age=0, oldest=0;
 
     for(i=0; i < CACHESIZE; i++) {
@@ -160,7 +160,7 @@
                     xsltFreeStylesheet(cache[i].stylesheet);
 
                     cache[i].last_modified = file.st_mtime;
-                    cache[i].stylesheet = xsltParseStylesheetFile(fn);
+                    cache[i].stylesheet = xsltParseStylesheetFile(XMLSTR(fn));
                     cache[i].cache_age = time(NULL);
                 }
                 DEBUG1("Using cached sheet %i", i);
@@ -178,7 +178,7 @@
 
     cache[i].last_modified = file.st_mtime;
     cache[i].filename = strdup(fn);
-    cache[i].stylesheet = xsltParseStylesheetFile(fn);
+    cache[i].stylesheet = xsltParseStylesheetFile(XMLSTR(fn));
     cache[i].cache_age = time(NULL);
     return cache[i].stylesheet;
 }
@@ -212,10 +212,10 @@
     if (problem == 0)
     {
         const char *http = "HTTP/1.0 200 OK\r\nContent-Type: text/html\r\nContent-Length: ";
-        int buf_len = strlen (http) + 20 + len;
+        size_t buf_len = strlen (http) + 20 + len;
 
         if (string == NULL)
-            string = xmlStrdup ("");
+            string = xmlCharStrdup ("");
         client->respcode = 200;
         client_set_queue (client, NULL);
         client->refbuf = refbuf_new (buf_len);

Modified: icecast/branches/kh/icecast/src/xslt.h
===================================================================
--- icecast/branches/kh/icecast/src/xslt.h	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/xslt.h	2006-02-12 21:50:10 UTC (rev 10807)
@@ -35,6 +35,6 @@
 
 
 void xslt_transform(xmlDocPtr doc, const char *xslfilename, client_t *client);
-void xslt_initialize();
-void xslt_shutdown();
+void xslt_initialize(void);
+void xslt_shutdown(void);
 

Modified: icecast/branches/kh/icecast/src/yp.c
===================================================================
--- icecast/branches/kh/icecast/src/yp.c	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/yp.c	2006-02-12 21:50:10 UTC (rev 10807)
@@ -265,7 +265,7 @@
 }
 
 
-void yp_initialize()
+void yp_initialize(void)
 {
     ice_config_t *config = config_get_config();
     thread_rwlock_create (&yp_lock);
@@ -562,7 +562,7 @@
 
 
 /* Check for changes in the YP servers configured */
-static void check_servers ()
+static void check_servers (void)
 {
     struct yp_server *server = (struct yp_server *)active_yps,
                      **server_p = (struct yp_server **)&active_yps;
@@ -918,7 +918,7 @@
 }
 
 
-void yp_shutdown ()
+void yp_shutdown (void)
 {
     yp_running = 0;
     yp_update = 1;

Modified: icecast/branches/kh/icecast/src/yp.h
===================================================================
--- icecast/branches/kh/icecast/src/yp.h	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/src/yp.h	2006-02-12 21:50:10 UTC (rev 10807)
@@ -32,8 +32,8 @@
 void yp_remove (const char *mount);
 void yp_touch (const char *mount);
 void yp_recheck_config (ice_config_t *config);
-void yp_initialize();
-void yp_shutdown();
+void yp_initialize(void);
+void yp_shutdown(void);
 
 #else
 

Modified: icecast/branches/kh/icecast/win32/Icecast2win.clw
===================================================================
--- icecast/branches/kh/icecast/win32/Icecast2win.clw	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/win32/Icecast2win.clw	2006-02-12 21:50:10 UTC (rev 10807)
@@ -2,7 +2,7 @@
 
 [General Info]
 Version=1
-LastClass=CStatus
+LastClass=CIcecast2winDlg
 LastTemplate=CDialog
 NewFileInclude1=#include "stdafx.h"
 NewFileInclude2=#include "Icecast2win.h"
@@ -13,19 +13,19 @@
 Class3=CAboutDlg
 
 ResourceCount=10
-Resource1=IDD_SSTATUS
+Resource1=IDR_MENU2
 Resource2=IDR_MAINFRAME
-Resource3=IDD_STATSDIALOG
-Resource4=IDR_MENU2
+Resource3=IDR_TRAY
+Resource4=IDD_ICECAST2WIN_DIALOG
 Class4=CStatus
-Resource5=IDR_TRAY
+Resource5=IDD_SSTATUS
 Class5=CConfigTab
 Class6=CStatsTab
-Resource6=IDR_MENU4
-Resource7=IDD_ICECAST2WIN_DIALOG
-Resource8=IDD_CONFIGDIALOG
-Resource9=IDR_MENU3
-Resource10=IDD_ABOUTBOX
+Resource6=IDD_CONFIGDIALOG
+Resource7=IDD_STATSDIALOG
+Resource8=IDR_MENU3
+Resource9=IDD_ABOUTBOX
+Resource10=IDR_MENU4
 
 [CLS:CIcecast2winApp]
 Type=0
@@ -34,13 +34,13 @@
 Filter=N
 
 [CLS:CIcecast2winDlg]
-Type=0
-HeaderFile=Icecast2winDlg.h
-ImplementationFile=Icecast2winDlg.cpp
-Filter=C
-LastObject=ID_ABOUT_HELP
-BaseClass=CResizableDialog
-VirtualFilter=dWC
+Type=0
+HeaderFile=Icecast2winDlg.h
+ImplementationFile=Icecast2winDlg.cpp
+Filter=C
+LastObject=ID_ABOUT_CREDITS
+BaseClass=CDialog
+VirtualFilter=dWC
 
 [CLS:CAboutDlg]
 Type=0
@@ -51,23 +51,21 @@
 [DLG:IDD_ABOUTBOX]
 Type=1
 Class=CAboutDlg
-ControlCount=3
-Control1=IDC_STATIC,static,1342177283
-Control2=IDC_STATIC,static,1342308480
-Control3=IDOK,button,1342373889
+ControlCount=2
+Control1=IDOK,button,1342373889
+Control2=IDC_STATIC,static,1350572046
 
 [DLG:IDD_ICECAST2WIN_DIALOG]
 Type=1
 Class=CIcecast2winDlg
-ControlCount=8
+ControlCount=7
 Control1=IDC_MAINTAB,SysTabControl32,1342177280
 Control2=IDC_START,button,1342242816
 Control3=IDC_AUTOSTART,button,1342251011
 Control4=IDC_STATIC,static,1342177294
 Control5=IDC_SERVERSTATUS,static,1342177294
 Control6=IDC_STATIC_SS,static,1342308865
-Control7=IDC_STATICBLACK,static,1342177294
-Control8=IDC_HIDESYSTRAY,button,1342242816
+Control7=IDC_HIDESYSTRAY,button,1342242816
 
 [DLG:IDD_SSTATUS]
 Type=1

Modified: icecast/branches/kh/icecast/win32/Icecast2win.cpp
===================================================================
--- icecast/branches/kh/icecast/win32/Icecast2win.cpp	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/win32/Icecast2win.cpp	2006-02-12 21:50:10 UTC (rev 10807)
@@ -10,10 +10,6 @@
 #undef THIS_FILE
 static char THIS_FILE[] = __FILE__;
 #endif
-
-/* Hack Hack...Cough Cough */
-extern "C" long _ftol( double ); //defined by VC6 C libs
-extern "C" long _ftol2( double dblSource ) { return _ftol( dblSource ); }
 
 /////////////////////////////////////////////////////////////////////////////
 // CIcecast2winApp

Modified: icecast/branches/kh/icecast/win32/Icecast2win.dsp
===================================================================
--- icecast/branches/kh/icecast/win32/Icecast2win.dsp	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/win32/Icecast2win.dsp	2006-02-12 21:50:10 UTC (rev 10807)
@@ -43,7 +43,7 @@
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "../src" /I "../src/httpp" /I "../src/thread" /I "../src/log" /I "../src/avl" /I "../src/net" /I "src/timings" /I "../" /I "../../libxslt-1.1.12/include" /I "../../iconv/include" /I "../../libxml2-2.6.17.win32/include" /I "../../pthreads" /I "../../oggvorbis-win32sdk-1.0.1/include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I "../src" /I "../src/httpp" /I "../src/thread" /I "../src/log" /I "../src/avl" /I "../src/net" /I "src/timings" /I "../" /I "../../libxslt/include" /I "../../iconv/include" /I "../../libxml2/include" /I "../../pthreads" /I "../../oggvorbis-win32sdk-1.0.1/include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c
 # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
 # ADD BASE RSC /l 0x409 /d "NDEBUG"
@@ -53,7 +53,7 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
-# ADD LINK32 Releaseicecast\icecast.lib ..\..\curl\lib\Release\libcurl.lib ..\..\oggvorbis-win32sdk-1.0.1\lib\ogg_static.lib ..\..\oggvorbis-win32sdk-1.0.1\lib\vorbis_static.lib ..\..\libxml2\lib\libxml2.lib ..\..\libxslt\lib\libxslt.lib ..\..\iconv\lib\iconv.lib ..\..\pthreads\pthreadVSE.lib ws2_32.lib winmm.lib ..\..\speex\win32\libspeex\Release\libspeex.lib ..\..\theora\win32\Static_Release\theora_static.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /out:"Release/Icecast2.exe"
+# ADD LINK32 Releaseicecast\icecast.lib ..\..\curl\lib\Release\libcurl.lib ..\..\oggvorbis-win32sdk-1.0.1\lib\ogg_static.lib ..\..\oggvorbis-win32sdk-1.0.1\lib\vorbis_static.lib ..\..\libxml2\lib\libxml2.lib ..\..\libxslt\lib\libxslt.lib ..\..\iconv\lib\iconv.lib ..\..\pthreads\pthreadVSE.lib ws2_32.lib winmm.lib ../../theora/win32/Static_Release/theora_static.lib ../../speex/win32/libspeex/Release/libspeex.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /out:"Release/Icecast2.exe"
 # SUBTRACT LINK32 /pdb:none
 
 !ELSEIF  "$(CFG)" == "Icecast2win - Win32 Debug"
@@ -80,7 +80,7 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 Debugicecast\icecast.lib ..\..\curl\lib\Debug\libcurl.lib ..\..\oggvorbis-win32sdk-1.0.1\lib\ogg_static_d.lib ..\..\oggvorbis-win32sdk-1.0.1\lib\vorbis_static_d.lib ..\..\libxml2\lib\libxml2.lib ..\..\libxslt\lib\libxslt.lib  ..\..\iconv\lib\iconv.lib ..\..\pthreads\pthreadVSE.lib ws2_32.lib winmm.lib ..\..\speex\win32\libspeex\Release\libspeex.lib ..\..\theora\win32\Static_Release\theora_static.lib /nologo /subsystem:windows /incremental:no /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"LIBCMTD.lib" /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib" /pdbtype:sept
+# ADD LINK32 Debugicecast\icecast.lib ..\..\curl\lib\Debug\libcurl.lib ..\..\oggvorbis-win32sdk-1.0.1\lib\ogg_static_d.lib ..\..\oggvorbis-win32sdk-1.0.1\lib\vorbis_static_d.lib ..\..\libxml2\lib\libxml2.lib ..\..\libxslt\lib\libxslt.lib ..\..\iconv\lib\iconv.lib ..\..\pthreads\pthreadVSE.lib ws2_32.lib winmm.lib ../../theora/win32/Static_Debug/theora_static_d.lib ../../speex/win32/libspeex/Release/libspeex.lib /nologo /subsystem:windows /incremental:no /debug /machine:I386 /nodefaultlib:"libcd.lib" /pdbtype:sept
 # SUBTRACT LINK32 /pdb:none
 
 !ENDIF 
@@ -199,6 +199,10 @@
 # End Source File
 # Begin Source File
 
+SOURCE=.\credits.bmp
+# End Source File
+# Begin Source File
+
 SOURCE=.\cursor1.cur
 # End Source File
 # Begin Source File
@@ -227,6 +231,10 @@
 # End Source File
 # Begin Source File
 
+SOURCE=.\icecast2title.bmp
+# End Source File
+# Begin Source File
+
 SOURCE=.\res\Icecast2win.ico
 # End Source File
 # Begin Source File

Modified: icecast/branches/kh/icecast/win32/Icecast2win.dsw
===================================================================
--- icecast/branches/kh/icecast/win32/Icecast2win.dsw	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/win32/Icecast2win.dsw	2006-02-12 21:50:10 UTC (rev 10807)
@@ -3,7 +3,7 @@
 
 ###############################################################################
 
-Project: "Icecast2win"=".\Icecast2win.dsp" - Package Owner=<4>
+Project: "Icecast2win"=.\Icecast2win.dsp - Package Owner=<4>
 
 Package=<5>
 {{{
@@ -17,11 +17,17 @@
     Begin Project Dependency
     Project_Dep_Name icecast
     End Project Dependency
+    Begin Project Dependency
+    Project_Dep_Name icecastService
+    End Project Dependency
+    Begin Project Dependency
+    Project_Dep_Name icecast2 console
+    End Project Dependency
 }}}
 
 ###############################################################################
 
-Project: "icecast"=".\icecast.dsp" - Package Owner=<4>
+Project: "icecast"=.\icecast.dsp - Package Owner=<4>
 
 Package=<5>
 {{{
@@ -33,6 +39,36 @@
 
 ###############################################################################
 
+Project: "icecast2 console"=.\icecast2_console.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+    Begin Project Dependency
+    Project_Dep_Name icecast
+    End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "icecastService"=.\icecastService.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+    Begin Project Dependency
+    Project_Dep_Name icecast
+    End Project Dependency
+}}}
+
+###############################################################################
+
 Global:
 
 Package=<5>

Modified: icecast/branches/kh/icecast/win32/Icecast2win.rc
===================================================================
--- icecast/branches/kh/icecast/win32/Icecast2win.rc	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/win32/Icecast2win.rc	2006-02-12 21:50:10 UTC (rev 10807)
@@ -64,14 +64,14 @@
 // Dialog
 //
 
-IDD_ABOUTBOX DIALOG DISCARDABLE  0, 0, 235, 55
+IDD_ABOUTBOX DIALOG DISCARDABLE  0, 0, 375, 163
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "About Icecast2win"
+CAPTION "Icecast Credits"
 FONT 8, "MS Sans Serif"
 BEGIN
-    ICON            IDR_MAINFRAME,IDC_STATIC,11,17,20,20
-    LTEXT           "Icecast 2 Win32",IDC_STATIC,40,10,119,8,SS_NOPREFIX
-    DEFPUSHBUTTON   "OK",IDOK,178,7,50,14,WS_GROUP
+    DEFPUSHBUTTON   "OK",IDOK,157,141,50,14,WS_GROUP
+    CONTROL         163,IDC_STATIC,"Static",SS_BITMAP | SS_REALSIZEIMAGE | 
+                    SS_SUNKEN | WS_BORDER,7,7,361,145
 END
 
 IDD_ICECAST2WIN_DIALOG DIALOGEX 0, 0, 326, 259
@@ -86,12 +86,11 @@
     CONTROL         "Start Server on Application Startup",IDC_AUTOSTART,
                     "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,76,
                     29,81,17
-    CONTROL         159,IDC_STATIC,"Static",SS_BITMAP,0,0,117,20
+    CONTROL         164,IDC_STATIC,"Static",SS_BITMAP,0,0,117,20
     CONTROL         151,IDC_SERVERSTATUS,"Static",SS_BITMAP,173,32,65,18,
                     WS_EX_CLIENTEDGE
     CTEXT           "Server Status",IDC_STATIC_SS,172,23,65,10,
                     SS_CENTERIMAGE
-    CONTROL         150,IDC_STATICBLACK,"Static",SS_BITMAP,116,0,214,20
     PUSHBUTTON      "Hide To Systray",IDC_HIDESYSTRAY,262,22,58,12
 END
 
@@ -183,9 +182,9 @@
     IDD_ABOUTBOX, DIALOG
     BEGIN
         LEFTMARGIN, 7
-        RIGHTMARGIN, 228
+        RIGHTMARGIN, 368
         TOPMARGIN, 7
-        BOTTOMMARGIN, 48
+        BOTTOMMARGIN, 155
     END
 END
 #endif    // APSTUDIO_INVOKED
@@ -200,6 +199,8 @@
 IDB_BITMAP5             BITMAP  DISCARDABLE     "stopped.bmp"
 IDB_BITMAP6             BITMAP  DISCARDABLE     "running.bmp"
 IDB_BITMAP7             BITMAP  DISCARDABLE     "icecast2logo2.bmp"
+IDB_BITMAP8             BITMAP  DISCARDABLE     "credits.bmp"
+IDB_BITMAP9             BITMAP  DISCARDABLE     "icecast2title.bmp"
 
 /////////////////////////////////////////////////////////////////////////////
 //

Modified: icecast/branches/kh/icecast/win32/Icecast2winDlg.cpp
===================================================================
--- icecast/branches/kh/icecast/win32/Icecast2winDlg.cpp	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/win32/Icecast2winDlg.cpp	2006-02-12 21:50:10 UTC (rev 10807)
@@ -241,24 +241,25 @@
 
 BEGIN_MESSAGE_MAP(CIcecast2winDlg, CDialog)
 	//{{AFX_MSG_MAP(CIcecast2winDlg)
-	ON_WM_SYSCOMMAND()
-	ON_WM_PAINT()
-	ON_WM_QUERYDRAGICON()
-	ON_NOTIFY(TCN_SELCHANGE, IDC_MAINTAB, OnSelchangeMaintab)
-	ON_COMMAND(ID_FILE_EXIT, OnFileExit)
-	ON_WM_TIMER()
-	ON_COMMAND(ID_FILE_STARTSERVER, OnFileStartserver)
-	ON_COMMAND(ID_FILE_STOPSERVER, OnFileStopserver)
-	ON_BN_CLICKED(IDC_START, OnStart)
-	ON_WM_CLOSE()
-	ON_WM_SIZE()
-	ON_BN_CLICKED(IDC_HIDESYSTRAY, OnHidesystray)
-	ON_COMMAND(ID_BLANK_RESTORE, OnBlankRestore)
-	ON_MESSAGE(WM_TRAY_NOTIFY, OnTrayNotify)
-	ON_WM_DESTROY()
-	ON_COMMAND(ID_FILE_EDITCONFIGURATION, OnFileEditconfiguration)
-	ON_COMMAND(ID_ABOUT_HELP, OnAboutHelp)
-	//}}AFX_MSG_MAP
+	ON_WM_SYSCOMMAND()
+	ON_WM_PAINT()
+	ON_WM_QUERYDRAGICON()
+	ON_NOTIFY(TCN_SELCHANGE, IDC_MAINTAB, OnSelchangeMaintab)
+	ON_COMMAND(ID_FILE_EXIT, OnFileExit)
+	ON_WM_TIMER()
+	ON_COMMAND(ID_FILE_STARTSERVER, OnFileStartserver)
+	ON_COMMAND(ID_FILE_STOPSERVER, OnFileStopserver)
+	ON_BN_CLICKED(IDC_START, OnStart)
+	ON_WM_CLOSE()
+	ON_WM_SIZE()
+	ON_BN_CLICKED(IDC_HIDESYSTRAY, OnHidesystray)
+	ON_COMMAND(ID_BLANK_RESTORE, OnBlankRestore)
+	ON_MESSAGE(WM_TRAY_NOTIFY, OnTrayNotify)
+	ON_WM_DESTROY()
+	ON_COMMAND(ID_FILE_EDITCONFIGURATION, OnFileEditconfiguration)
+	ON_COMMAND(ID_ABOUT_HELP, OnAboutHelp)
+	ON_COMMAND(ID_ABOUT_CREDITS, OnAboutCredits)
+	//}}AFX_MSG_MAP
 END_MESSAGE_MAP()
 
 /////////////////////////////////////////////////////////////////////////////
@@ -1190,3 +1191,10 @@
 	// TODO: Add your command handler code here
 	ShellExecute(NULL, "open", "doc\\icecast2.chm", NULL, NULL, SW_SHOWNORMAL);	
 }
+
+void CIcecast2winDlg::OnAboutCredits() 
+{
+	// TODO: Add your command handler code here
+	CAboutDlg	about;
+	about.DoModal();
+}

Modified: icecast/branches/kh/icecast/win32/Icecast2winDlg.h
===================================================================
--- icecast/branches/kh/icecast/win32/Icecast2winDlg.h	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/win32/Icecast2winDlg.h	2006-02-12 21:50:10 UTC (rev 10807)
@@ -94,26 +94,27 @@
 
 	// Generated message map functions
 	//{{AFX_MSG(CIcecast2winDlg)
-	virtual BOOL OnInitDialog();
-	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
-	afx_msg void OnPaint();
-	afx_msg HCURSOR OnQueryDragIcon();
-	afx_msg void OnSelchangeMaintab(NMHDR* pNMHDR, LRESULT* pResult);
-	afx_msg void OnFileExit();
-	afx_msg void OnTimer(UINT nIDEvent);
-	afx_msg void OnFileStartserver();
-	afx_msg void OnFileStopserver();
-	afx_msg void OnStart();
-	afx_msg void OnClose();
-	afx_msg void OnSize(UINT nType, int cx, int cy);
-	afx_msg void OnHidesystray();
-	afx_msg void OnHide();
-	afx_msg void OnBlankRestore();
-	afx_msg LONG OnTrayNotify ( WPARAM wParam, LPARAM lParam );
-	afx_msg void OnDestroy();
-	afx_msg void OnFileEditconfiguration();
-	afx_msg void OnAboutHelp();
-	//}}AFX_MSG
+	virtual BOOL OnInitDialog();
+	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
+	afx_msg void OnPaint();
+	afx_msg HCURSOR OnQueryDragIcon();
+	afx_msg void OnSelchangeMaintab(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnFileExit();
+	afx_msg void OnTimer(UINT nIDEvent);
+	afx_msg void OnFileStartserver();
+	afx_msg void OnFileStopserver();
+	afx_msg void OnStart();
+	afx_msg void OnClose();
+	afx_msg void OnSize(UINT nType, int cx, int cy);
+	afx_msg void OnHidesystray();
+	afx_msg void OnHide();
+	afx_msg void OnBlankRestore();
+	afx_msg LONG OnTrayNotify ( WPARAM wParam, LPARAM lParam );
+	afx_msg void OnDestroy();
+	afx_msg void OnFileEditconfiguration();
+	afx_msg void OnAboutHelp();
+	afx_msg void OnAboutCredits();
+	//}}AFX_MSG
 	DECLARE_MESSAGE_MAP()
 };
 

Modified: icecast/branches/kh/icecast/win32/Makefile.am
===================================================================
--- icecast/branches/kh/icecast/win32/Makefile.am	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/win32/Makefile.am	2006-02-12 21:50:10 UTC (rev 10807)
@@ -11,5 +11,6 @@
     StdAfx.h TabCtrlSSL.cpp TabCtrlSSL.h TabPageSSL.cpp TabPageSSL.h black.bmp \
     colors.h icecast.dsp icecast.ico icecast2.iss icecast2logo2.bmp\
     resource.h running.bmp stopped.bmp TRAYNOT.h Traynot.cpp \
-    icecast2_console.dsw icecast2_console.dsp
+    icecast2_console.dsw icecast2_console.dsp credits.bmp icecast2title.bmp \
+    icecastService.cpp icecastService.dsp
 

Modified: icecast/branches/kh/icecast/win32/icecast.dsp
===================================================================
--- icecast/branches/kh/icecast/win32/icecast.dsp	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/win32/icecast.dsp	2006-02-12 21:50:10 UTC (rev 10807)
@@ -41,7 +41,7 @@
 # PROP Intermediate_Dir "Releaseicecast"
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../curl/include" /I "..\src" /I "..\src/httpp" /I "..\src/thread" /I "..\src/log" /I "..\src/avl" /I "..\src/net" /I "..\src/timings" /I "../" /I "../../libxslt/include" /I "../../iconv/include" /I "../../libxml2/include" /I "../../pthreads" /I "../../oggvorbis-win32sdk-1.0.1/include" /I "../../speex/include" /I "../../theora/include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_CURL" /D "USE_YP" /D "HAVE_SYS_STAT_H" /D "HAVE_LOCALTIME_R" /D "HAVE_OLD_VSNPRINTF" /D "HAVE_THEORA" /D "HAVE_SPEEX" /D PACKAGE_VERSION=\"icecast_kh_trunk\" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../curl/include" /I "..\src" /I "..\src/httpp" /I "..\src/thread" /I "..\src/log" /I "..\src/avl" /I "..\src/net" /I "..\src/timings" /I "../" /I "../../libxslt/include" /I "../../iconv/include" /I "../../libxml2/include" /I "../../pthreads" /I "../../oggvorbis-win32sdk-1.0.1/include" /I "../../theora/include" /I "../../speex/include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_CURL" /D "USE_YP" /D "HAVE_SYS_STAT_H" /D PACKAGE_VERSION=\"2.3.1\" /D "HAVE_LOCALTIME_R" /D "HAVE_OLD_VSNPRINTF" /D "HAVE_THEORA" /D "HAVE_SPEEX" /D "HAVE_AUTH_URL" /YX /FD /c
 # ADD BASE RSC /l 0x409 /d "NDEBUG"
 # ADD RSC /l 0x409 /d "NDEBUG"
 BSC32=bscmake.exe
@@ -64,7 +64,7 @@
 # PROP Intermediate_Dir "Debugicecast"
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../curl/include" /I "..\src" /I "..\src/httpp" /I "..\src/thread" /I "..\src/log" /I "..\src/avl" /I "..\src/net" /I "..\src/timings" /I "../" /I "../../libxslt/include" /I "../../iconv/include" /I "../../libxml2/include" /I "../../pthreads" /I "../../oggvorbis-win32sdk-1.0.1/include" /I "../../speex/include" /I "../../theora/include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "_WIN32" /D "HAVE_CURL" /D "USE_YP" /D "HAVE_SYS_STAT_H" /D "HAVE_LOCALTIME_R" /D "HAVE_OLD_VSNPRINTF" /D "HAVE_THEORA" /D "HAVE_SPEEX" /D PACKAGE_VERSION=\"icecast_kh_trunk\" /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../curl/include" /I "..\src" /I "..\src/httpp" /I "..\src/thread" /I "..\src/log" /I "..\src/avl" /I "..\src/net" /I "..\src/timings" /I "../" /I "../../libxslt/include" /I "../../iconv/include" /I "../../libxml2/include" /I "../../pthreads" /I "../../oggvorbis-win32sdk-1.0.1/include" /I "../../theora/include" /I "../../speex/include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "_WIN32" /D "HAVE_CURL" /D "USE_YP" /D "HAVE_SYS_STAT_H" /D PACKAGE_VERSION=\"2.3.1\" /D "HAVE_LOCALTIME_R" /D "HAVE_OLD_VSNPRINTF" /D "HAVE_THEORA" /D "HAVE_SPEEX" /D "HAVE_AUTH_URL" /FD /D /GZ /c
 # ADD BASE RSC /l 0x409 /d "_DEBUG"
 # ADD RSC /l 0x409 /d "_DEBUG"
 BSC32=bscmake.exe
@@ -105,10 +105,18 @@
 # End Source File
 # Begin Source File
 
+SOURCE=..\src\auth_htpasswd.h
+# End Source File
+# Begin Source File
+
 SOURCE=..\src\auth_url.c
 # End Source File
 # Begin Source File
 
+SOURCE=..\src\auth_url.h
+# End Source File
+# Begin Source File
+
 SOURCE=..\src\avl\avl.c
 # End Source File
 # Begin Source File
@@ -361,18 +369,6 @@
 # PROP Default_Filter "h;hpp;hxx;hm;inl"
 # Begin Source File
 
-SOURCE=..\src\auth_cmd.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\auth_htpasswd.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\auth_url.h
-# End Source File
-# Begin Source File
-
 SOURCE=..\src\timing\timing.h
 # End Source File
 # Begin Source File

Modified: icecast/branches/kh/icecast/win32/icecast2.iss
===================================================================
--- icecast/branches/kh/icecast/win32/icecast2.iss	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/win32/icecast2.iss	2006-02-12 21:50:10 UTC (rev 10807)
@@ -2,8 +2,8 @@
 ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
 
 [Setup]
-AppName=Icecast2 kh-trunk Win32
-AppVerName=Icecast kh-trunk
+AppName=Icecast2 Win32
+AppVerName=Icecast v2.3.1
 AppPublisherURL=http://www.icecast.org
 AppSupportURL=http://www.icecast.org
 AppUpdatesURL=http://www.icecast.org
@@ -13,7 +13,7 @@
 LicenseFile=..\COPYING
 InfoAfterFile=..\README
 OutputDir=.
-OutputBaseFilename=icecast2_win32_kh_trunk_07132005_setup
+OutputBaseFilename=icecast2_win32_v2.3.1_setup
 WizardImageFile=icecast2logo2.bmp
 WizardImageStretch=no
 ; uncomment the following line if you want your installation to run on NT 3.51 too.
@@ -27,36 +27,25 @@
 Name: "{app}\admin"
 Name: "{app}\doc"
 Name: "{app}\logs"
+Name: "{app}\examples"
 
 
 [Files]
 Source: "Release\Icecast2.exe"; DestDir: "{app}"; Flags: ignoreversion
 Source: "Release\icecast2console.exe"; DestDir: "{app}"; Flags: ignoreversion
+Source: "Release\icecastService.exe"; DestDir: "{app}"; Flags: ignoreversion
+Source: "..\examples\*"; DestDir: "{app}\examples"; Flags: ignoreversion
 Source: "..\doc\icecast2.chm"; DestDir: "{app}\doc"; Flags: ignoreversion
-Source: "..\web\corner_bottomleft.jpg"; DestDir: "{app}\web"; Flags: ignoreversion
-Source: "..\web\corner_bottomright.jpg"; DestDir: "{app}\web"; Flags: ignoreversion
-Source: "..\web\corner_topleft.jpg"; DestDir: "{app}\web"; Flags: ignoreversion
-Source: "..\web\corner_topright.jpg"; DestDir: "{app}\web"; Flags: ignoreversion
-Source: "..\web\icecast.png"; DestDir: "{app}\web"; Flags: ignoreversion
-Source: "..\web\key.gif"; DestDir: "{app}\web"; Flags: ignoreversion
-Source: "..\web\status2.xsl"; DestDir: "{app}\web"; Flags: ignoreversion
-Source: "..\web\status.xsl"; DestDir: "{app}\web"; Flags: ignoreversion
-Source: "..\web\style.css"; DestDir: "{app}\web"; Flags: ignoreversion
-
-Source: "..\admin\listclients.xsl"; DestDir: "{app}\admin"; Flags: ignoreversion
-Source: "..\admin\listmounts.xsl"; DestDir: "{app}\admin"; Flags: ignoreversion
-Source: "..\admin\moveclients.xsl"; DestDir: "{app}\admin"; Flags: ignoreversion
-Source: "..\admin\response.xsl"; DestDir: "{app}\admin"; Flags: ignoreversion
-Source: "..\admin\stats.xsl"; DestDir: "{app}\admin"; Flags: ignoreversion
-Source: "..\admin\manageauth.xsl"; DestDir: "{app}\admin"; Flags: ignoreversion
-Source: "..\admin\managerelays.xsl"; DestDir: "{app}\admin"; Flags: ignoreversion
-Source: "..\admin\updatemetadata.xsl"; DestDir: "{app}\admin"; Flags: ignoreversion
+Source: "..\web\*.xsl"; DestDir: "{app}\web"; Flags: ignoreversion
+Source: "..\web\*.png"; DestDir: "{app}\web"; Flags: ignoreversion
+Source: "..\web\*.jpg"; DestDir: "{app}\web"; Flags: ignoreversion
+Source: "..\web\*.css"; DestDir: "{app}\web"; Flags: ignoreversion
+Source: "..\admin\*.xsl"; DestDir: "{app}\admin"; Flags: ignoreversion
 Source: "..\..\pthreads\pthreadVSE.dll"; DestDir: "{app}"; Flags: ignoreversion
-Source: "..\conf\icecast.xml"; DestDir: "{app}"; Flags: ignoreversion
+Source: "..\conf\*.xml"; DestDir: "{app}"; Flags: ignoreversion
 Source: "..\..\iconv\lib\iconv.dll"; DestDir: "{app}"; Flags: ignoreversion
 Source: "..\..\libxslt\lib\libxslt.dll"; DestDir: "{app}"; Flags: ignoreversion
 Source: "..\..\libxml2\lib\libxml2.dll"; DestDir: "{app}"; Flags: ignoreversion
-Source: "..\..\zlib\bin\zlib1.dll"; DestDir: "{app}"; Flags: ignoreversion
 Source: "..\..\curl\lib\Release\libcurl.dll"; DestDir: "{app}"; Flags: ignoreversion
 
 [Icons]
@@ -65,4 +54,8 @@
 Name: "{userdesktop}\Icecast2 Win32"; Filename: "{app}\Icecast2.exe"; MinVersion: 4,4; Tasks: desktopicon;WorkingDir: "{app}";
 
 [Run]
+Filename: "{app}\icecastService.exe"; Parameters: "install ""{app}""";Description: "Install Icecast as a windows service.";Flags: postinstall
 
+[UninstallRun]
+Filename: "{app}\icecastService.exe"; Parameters: "remove"
+

Modified: icecast/branches/kh/icecast/win32/icecast2_console.dsp
===================================================================
--- icecast/branches/kh/icecast/win32/icecast2_console.dsp	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/win32/icecast2_console.dsp	2006-02-12 21:50:10 UTC (rev 10807)
@@ -42,7 +42,7 @@
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "../" /I "../../libxslt/include" /I "../../curl/include" /I "../../iconv/include" /I "../../libxml2/include" /I "..\src" /I "..\src/httpp" /I "..\src/thread" /I "..\src/log" /I "..\src/avl" /I "..\src/net" /I "..\src/timings" /I "../../pthreads" /I "../../oggvorbis-win32sdk-1.0.1/include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CURL" /D "USE_YP" /D "HAVE_SYS_STAT_H" /D PACKAGE_VERSION=\"2.0.0\" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I "../" /I "../../libxslt/include" /I "../../curl/include" /I "../../iconv/include" /I "../../libxml2/include" /I "..\src" /I "..\src/httpp" /I "..\src/thread" /I "..\src/log" /I "..\src/avl" /I "..\src/net" /I "..\src/timings" /I "../../pthreads" /I "../../oggvorbis-win32sdk-1.0.1/include" /I "../../theora/include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CURL" /D "USE_YP" /D "HAVE_SYS_STAT_H" /D PACKAGE_VERSION=\"2.3.1\" /D "HAVE_THEORA" /YX /FD /c
 # ADD BASE RSC /l 0x409 /d "NDEBUG"
 # ADD RSC /l 0x409 /d "NDEBUG"
 BSC32=bscmake.exe
@@ -50,8 +50,7 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Releaseicecast\icecast.lib ..\..\curl\lib\Release\libcurl.lib ..\..\oggvorbis-win32sdk-1.0.1\lib\ogg_static.lib ..\..\oggvorbis-win32sdk-1.0.1\lib\vorbis_static.lib ..\..\libxml2\lib\libxml2.lib ..\..\libxslt\lib\libxslt.lib ..\..\iconv\lib\iconv.lib ..\..\pthreads\pthreadVSE.lib ws2_32.lib ..\..\speex\win32\libspeex\Release\libspeex.lib ..\..\theora\win32\Static_Release\theora_static.lib /nologo /subsystem:console /machine:I386 /nodefaultlib:"libc" /out:"Release/icecast2console.exe"
-# SUBTRACT LINK32 /pdb:none
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Releaseicecast\icecast.lib ..\..\curl\lib\Release\libcurl.lib ..\..\oggvorbis-win32sdk-1.0.1\lib\ogg_static.lib ..\..\oggvorbis-win32sdk-1.0.1\lib\vorbis_static.lib ..\..\libxml2\lib\libxml2.lib ..\..\libxslt\lib\libxslt.lib ..\..\iconv\lib\iconv.lib ..\..\pthreads\pthreadVSE.lib ws2_32.lib ..\..\theora\win32\Static_Release\theora_static.lib ../../speex/win32/libspeex/Release/libspeex.lib /nologo /subsystem:console /machine:I386 /nodefaultlib:"libc.lib" /out:"Release/icecast2console.exe"
 
 !ELSEIF  "$(CFG)" == "icecast2 console - Win32 Debug"
 
@@ -67,7 +66,7 @@
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../" /I "../../libxslt/include" /I "../../curl/include" /I "../../iconv/include" /I "../../libxml2/include" /I "..\src" /I "..\src/httpp" /I "..\src/thread" /I "..\src/log" /I "..\src/avl" /I "..\src/net" /I "..\src/timings" /I "../../pthreads" /I "../../oggvorbis-win32sdk-1.0.1/include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CURL" /D "USE_YP" /D "HAVE_SYS_STAT_H" /D PACKAGE_VERSION=\"2.0.0\" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../" /I "../../libxslt/include" /I "../../curl/include" /I "../../iconv/include" /I "../../libxml2/include" /I "..\src" /I "..\src/httpp" /I "..\src/thread" /I "..\src/log" /I "..\src/avl" /I "..\src/net" /I "..\src/timings" /I "../../pthreads" /I "../../oggvorbis-win32sdk-1.0.1/include" /I "../../theora/include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CURL" /D "USE_YP" /D "HAVE_SYS_STAT_H" /D PACKAGE_VERSION=\"2.3.1\" /D "HAVE_THEORA" /YX /FD /GZ /c
 # ADD BASE RSC /l 0x409 /d "_DEBUG"
 # ADD RSC /l 0x409 /d "_DEBUG"
 BSC32=bscmake.exe
@@ -75,7 +74,7 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Debugicecast\icecast.lib ..\..\curl\lib\Release\libcurl.lib ..\..\oggvorbis-win32sdk-1.0.1\lib\ogg_static.lib ..\..\oggvorbis-win32sdk-1.0.1\lib\vorbis_static.lib ..\..\libxml2\lib\libxml2.lib ..\..\libxslt\lib\libxslt.lib ..\..\iconv\lib\iconv.lib ..\..\pthreads\pthreadVSE.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"Debug/icecast2console.exe" /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Debugicecast\icecast.lib ..\..\curl\lib\Release\libcurl.lib ..\..\oggvorbis-win32sdk-1.0.1\lib\ogg_static.lib ..\..\oggvorbis-win32sdk-1.0.1\lib\vorbis_static.lib ..\..\libxml2\lib\libxml2.lib ..\..\libxslt\lib\libxslt.lib ..\..\iconv\lib\iconv.lib ..\..\pthreads\pthreadVSE.lib ws2_32.lib ..\..\theora\win32\Static_Debug\theora_static_d.lib ../../speex/win32/libspeex/Release/libspeex.lib /nologo /subsystem:console /debug /machine:I386 /out:"Debug/icecast2console.exe" /pdbtype:sept
 
 !ENDIF 
 

Modified: icecast/branches/kh/icecast/win32/resource.h
===================================================================
--- icecast/branches/kh/icecast/win32/resource.h	2006-02-12 13:03:59 UTC (rev 10806)
+++ icecast/branches/kh/icecast/win32/resource.h	2006-02-12 21:50:10 UTC (rev 10807)
@@ -1,76 +1,78 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by Icecast2win.rc
-//
-#define IDM_ABOUTBOX                    0x0010
-#define IDD_ABOUTBOX                    100
-#define IDS_ABOUTBOX                    101
-#define IDD_ICECAST2WIN_DIALOG          102
-#define IDR_MAINFRAME                   128
-#define IDR_MENU1                       132
-#define IDB_BITMAP1                     134
-#define IDB_BITMAP2                     135
-#define IDI_R                           141
-#define IDI_G                           142
-#define IDI_ICON1                       142
-#define IDD_SERVERSTATUS                144
-#define IDD_SSTATUS                     145
-#define IDD_CONFIGDIALOG                146
-#define IDD_STATSDIALOG                 147
-#define IDB_BITMAP3                     149
-#define IDB_BITMAP4                     150
-#define IDB_BITMAP5                     151
-#define IDB_BITMAP6                     152
-#define IDR_MENU2                       153
-#define IDR_MENU3                       154
-#define IDC_CURSOR1                     155
-#define IDC_CURSOR2                     156
-#define IDB_BITMAP7                     159
-#define IDR_TRAY                        160
-#define IDR_MENU4                       161
-#define IDC_MAINTAB                     1000
-#define IDC_ERROR_EDIT                  1003
-#define IDC_ACCESS_EDIT                 1004
-#define IDC_CONFIG_EDIT                 1006
-#define IDC_SERVERSTATUS                1008
-#define IDC_SOURCES_CONNECTED           1009
-#define IDC_NUMBER_CLIENTS              1010
-#define IDC_GROUP1                      1011
-#define IDC_STATS_EDIT                  1012
-#define IDC_CONFIG                      1020
-#define IDC_STATSLIST                   1021
-#define IDC_SOURCELIST                  1022
-#define IDC_START                       1023
-#define IDC_AUTOSTART                   1024
-#define IDC_FILLER1                     1025
-#define IDC_FILLER2                     1026
-#define IDC_STATIC_SS                   1029
-#define IDC_GLOBALSTAT_LIST             1030
-#define IDC_STATIC_GS                   1031
-#define IDC_STATIC_SLS                  1032
-#define IDC_RUNNINGFOR                  1033
-#define IDC_STATIC_RUN                  1034
-#define IDC_STATICBLACK                 1035
-#define IDC_HIDESYSTRAY                 1036
-#define ID_FILE_STARTSERVER             32771
-#define ID_FILE_EXIT                    32772
-#define ID_FILE_STOPSERVER              32774
-#define ID_FILE                         32775
-#define ID_POPUP_ADDTOGLOBALSTATLIST    32776
-#define ID__DELETEFROMGLOBALSTATS       32777
-#define ID__MAKETHISSTATTHEWINDOWTITLE  32779
-#define ID_BLANK_RESTORE                32780
-#define ID_ABOUT_HELP                   32781
-#define ID_FILE_EDITCONFIGURATION       32782
-#define ID_ABOUT_CREDITS                32784
-
-// Next default values for new objects
-// 
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        162
-#define _APS_NEXT_COMMAND_VALUE         32785
-#define _APS_NEXT_CONTROL_VALUE         1037
-#define _APS_NEXT_SYMED_VALUE           101
-#endif
-#endif
+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by Icecast2win.rc
+//
+#define IDM_ABOUTBOX                    0x0010
+#define IDD_ABOUTBOX                    100
+#define IDS_ABOUTBOX                    101
+#define IDD_ICECAST2WIN_DIALOG          102
+#define IDR_MAINFRAME                   128
+#define IDR_MENU1                       132
+#define IDB_BITMAP1                     134
+#define IDB_BITMAP2                     135
+#define IDI_R                           141
+#define IDI_G                           142
+#define IDI_ICON1                       142
+#define IDD_SERVERSTATUS                144
+#define IDD_SSTATUS                     145
+#define IDD_CONFIGDIALOG                146
+#define IDD_STATSDIALOG                 147
+#define IDB_BITMAP3                     149
+#define IDB_BITMAP4                     150
+#define IDB_BITMAP5                     151
+#define IDB_BITMAP6                     152
+#define IDR_MENU2                       153
+#define IDR_MENU3                       154
+#define IDC_CURSOR1                     155
+#define IDC_CURSOR2                     156
+#define IDB_BITMAP7                     159
+#define IDR_TRAY                        160
+#define IDR_MENU4                       161
+#define IDB_BITMAP8                     163
+#define IDB_BITMAP9                     164
+#define IDC_MAINTAB                     1000
+#define IDC_ERROR_EDIT                  1003
+#define IDC_ACCESS_EDIT                 1004
+#define IDC_CONFIG_EDIT                 1006
+#define IDC_SERVERSTATUS                1008
+#define IDC_SOURCES_CONNECTED           1009
+#define IDC_NUMBER_CLIENTS              1010
+#define IDC_GROUP1                      1011
+#define IDC_STATS_EDIT                  1012
+#define IDC_CONFIG                      1020
+#define IDC_STATSLIST                   1021
+#define IDC_SOURCELIST                  1022
+#define IDC_START                       1023
+#define IDC_AUTOSTART                   1024
+#define IDC_FILLER1                     1025
+#define IDC_FILLER2                     1026
+#define IDC_STATIC_SS                   1029
+#define IDC_GLOBALSTAT_LIST             1030
+#define IDC_STATIC_GS                   1031
+#define IDC_STATIC_SLS                  1032
+#define IDC_RUNNINGFOR                  1033
+#define IDC_STATIC_RUN                  1034
+#define IDC_STATICBLACK                 1035
+#define IDC_HIDESYSTRAY                 1036
+#define ID_FILE_STARTSERVER             32771
+#define ID_FILE_EXIT                    32772
+#define ID_FILE_STOPSERVER              32774
+#define ID_FILE                         32775
+#define ID_POPUP_ADDTOGLOBALSTATLIST    32776
+#define ID__DELETEFROMGLOBALSTATS       32777
+#define ID__MAKETHISSTATTHEWINDOWTITLE  32779
+#define ID_BLANK_RESTORE                32780
+#define ID_ABOUT_HELP                   32781
+#define ID_FILE_EDITCONFIGURATION       32782
+#define ID_ABOUT_CREDITS                32784
+
+// Next default values for new objects
+// 
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE        165
+#define _APS_NEXT_COMMAND_VALUE         32785
+#define _APS_NEXT_CONTROL_VALUE         1037
+#define _APS_NEXT_SYMED_VALUE           101
+#endif
+#endif



More information about the commits mailing list