[xiph-commits] r10139 - in icecast/branches/kh/icecast: admin src web

karl at svn.xiph.org karl at svn.xiph.org
Thu Oct 6 19:55:01 PDT 2005


Author: karl
Date: 2005-10-06 19:54:54 -0700 (Thu, 06 Oct 2005)
New Revision: 10139

Modified:
   icecast/branches/kh/icecast/admin/manageauth.xsl
   icecast/branches/kh/icecast/admin/stats.xsl
   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/connection.c
   icecast/branches/kh/icecast/src/logging.c
   icecast/branches/kh/icecast/src/main.c
   icecast/branches/kh/icecast/web/status.xsl
Log:
apply changes done post 2.3 release (2 segv cases), add log size tag


Modified: icecast/branches/kh/icecast/admin/manageauth.xsl
===================================================================
--- icecast/branches/kh/icecast/admin/manageauth.xsl	2005-10-07 01:12:04 UTC (rev 10138)
+++ icecast/branches/kh/icecast/admin/manageauth.xsl	2005-10-07 02:54:54 UTC (rev 10139)
@@ -20,7 +20,6 @@
 	        <a class="nav" href="stats.xsl">Admin Home</a> |
 		    <a class="nav" href="listmounts.xsl">List Mountpoints</a> | 
         	<a class="nav" href="moveclients.xsl">Move Listeners</a> | 
-            <a class="nav" href="managerelays.xsl">Manage Relays</a> |
         	<a class="nav" href="/status.xsl">Index</a>
 	    </td></tr>
 	</table>
@@ -58,19 +57,24 @@
 <table cellpadding="2" cellspacing="4" border="0" >
 		<tr>
 				<td ><b>User Id</b></td>
-				<td ><b>Password</b></td>
 				<td ></td>
 		</tr>
 <xsl:variable name = "themount" ><xsl:value-of select="@mount" /></xsl:variable>
 <xsl:for-each select="User">
 		<tr>
 				<td><xsl:value-of select="username" /></td>
-				<td><xsl:value-of select="password" /></td>
 				<td><a class="nav2" href="manageauth.xsl?mount={$themount}&amp;username={username}&amp;action=delete">delete</a></td>
 		</tr>
 </xsl:for-each>
+</table>
+<br/>
+<table cellpadding="2" cellspacing="4" border="0" >
 		<tr>
+				<td ><b>User Id</b></td>
 				<td ><input type="text" name="username" /></td>
+		</tr>
+		<tr>
+				<td ><b>Password</b></td>
 				<td ><input type="text" name="password" /></td>
 		</tr>
 		<tr>

Modified: icecast/branches/kh/icecast/admin/stats.xsl
===================================================================
--- icecast/branches/kh/icecast/admin/stats.xsl	2005-10-07 01:12:04 UTC (rev 10138)
+++ icecast/branches/kh/icecast/admin/stats.xsl	2005-10-07 02:54:54 UTC (rev 10139)
@@ -71,16 +71,13 @@
 <h3>
 <xsl:choose>
 <xsl:when test="authenticator">
-<a href="auth.xsl"><img border="0" src="/images/key.png"/></a> Authentication Required
+<a href="/auth.xsl"><img border="0" src="/images/key.png"/></a> Authentication Required
 </xsl:when>
 <xsl:otherwise>
-<a href="{@mount}.m3u"><img border="0" src="/images/tunein.png"/></a> Mount Point
+<a href="{@mount}.m3u"><img border="0" src="/tunein.png"/></a>
 </xsl:otherwise>
 </xsl:choose>
-
-(<xsl:value-of select="@mount" />)
-<xsl:if test="authenticator"><a href="manageauth.xsl?mount={@mount}"><img border="0" src="/images/key.gif"/></a> </xsl:if>
-
+Mount Point : (<xsl:value-of select="@mount" />)
 </h3>
 	<table border="0" cellpadding="1" cellspacing="5" bgcolor="444444">
 	<tr>        
@@ -95,10 +92,15 @@
 <br />
 <table cellpadding="5" cellspacing="0" border="0">
 	<xsl:for-each select="*">
+    <xsl:choose>
+    <xsl:when test="name()='listener'"></xsl:when>
+    <xsl:otherwise>
 	<tr>
 		<td width="130"><xsl:value-of select="name()" /></td>
 		<td class="streamdata"><xsl:value-of select="." /></td>
 	</tr>
+    </xsl:otherwise>
+    </xsl:choose>
 	</xsl:for-each>
 </table>
 </div>

Modified: icecast/branches/kh/icecast/src/auth_url.c
===================================================================
--- icecast/branches/kh/icecast/src/auth_url.c	2005-10-07 01:12:04 UTC (rev 10138)
+++ icecast/branches/kh/icecast/src/auth_url.c	2005-10-07 02:54:54 UTC (rev 10139)
@@ -161,6 +161,8 @@
     int port;
     char post [4096];
 
+    if (url->removeurl == NULL)
+        return AUTH_OK;
     config = config_get_config ();
     server = util_url_escape (config->hostname);
     port = config->port;

Modified: icecast/branches/kh/icecast/src/cfgfile.c
===================================================================
--- icecast/branches/kh/icecast/src/cfgfile.c	2005-10-07 01:12:04 UTC (rev 10138)
+++ icecast/branches/kh/icecast/src/cfgfile.c	2005-10-07 02:54:54 UTC (rev 10139)
@@ -983,6 +983,10 @@
         } else if (strcmp(node->name, "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) {
+           char *tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
+           configuration->logsize = atoi(tmp);
+           if (tmp) xmlFree(tmp);
         } else if (strcmp(node->name, "loglevel") == 0) {
            char *tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
            configuration->loglevel = atoi(tmp);

Modified: icecast/branches/kh/icecast/src/cfgfile.h
===================================================================
--- icecast/branches/kh/icecast/src/cfgfile.h	2005-10-07 01:12:04 UTC (rev 10138)
+++ icecast/branches/kh/icecast/src/cfgfile.h	2005-10-07 02:54:54 UTC (rev 10139)
@@ -161,6 +161,7 @@
     char *error_log;
     char *playlist_log;
     int loglevel;
+    int logsize;
 
     int chroot;
     int chuid;

Modified: icecast/branches/kh/icecast/src/client.c
===================================================================
--- icecast/branches/kh/icecast/src/client.c	2005-10-07 01:12:04 UTC (rev 10138)
+++ icecast/branches/kh/icecast/src/client.c	2005-10-07 02:54:54 UTC (rev 10139)
@@ -89,6 +89,14 @@
     if (client == NULL)
         return;
 
+    /* release the buffer now, as the buffer could be on the source queue
+     * and may of disappeared after auth completes */
+    if (client->refbuf)
+    {
+        refbuf_release (client->refbuf);
+        client->refbuf = NULL;
+    }
+
     if (release_client (client))
         return;
 
@@ -120,10 +128,6 @@
     stats_event_args (NULL, "clients", "%d", global.clients);
     global_unlock ();
 
-    /* drop ref counts if need be */
-    if (client->refbuf)
-        refbuf_release (client->refbuf);
-
     /* we need to free client specific format data (if any) */
     if (client->free_client_data)
         client->free_client_data (client);
@@ -247,10 +251,9 @@
 #else
     int ret = client->con->send (client->con, buf, len);
 
-    if (ret < 0)
+    if (client->con->error)
         DEBUG0 ("Client connection died");
-    else
-        client->con->sent_bytes += ret;
+
     return ret;
 #endif
 }

Modified: icecast/branches/kh/icecast/src/connection.c
===================================================================
--- icecast/branches/kh/icecast/src/connection.c	2005-10-07 01:12:04 UTC (rev 10138)
+++ icecast/branches/kh/icecast/src/connection.c	2005-10-07 02:54:54 UTC (rev 10139)
@@ -235,6 +235,8 @@
         }
         con->error = 1;
     }
+    else
+        con->sent_bytes += bytes;
     return bytes;
 }
 #endif
@@ -252,8 +254,13 @@
 static int connection_send (connection_t *con, const char *buf, unsigned len)
 {
     int bytes = sock_write_bytes (con->sock, buf, len);
-    if (bytes == -1 && !sock_recoverable (sock_error()))
-        con->error = 1;
+    if (bytes < 0)
+    {
+        if (!sock_recoverable (sock_error()))
+            con->error = 1;
+    }
+    else
+        con->sent_bytes += bytes;
     return bytes;
 }
 
@@ -468,6 +475,8 @@
             int pass_it = 1;
             char *ptr;
 
+            /* handle \n, \r\n and nsvcap which for some strange reason has
+             * EOL as \r\r\n */
             node->offset += len;
             client->refbuf->data [node->offset] = '\000';
             do
@@ -475,6 +484,8 @@
                 if (node->shoutcast == 1)
                 {
                     /* password line */
+                    if (strstr (client->refbuf->data, "\r\r\n") != NULL)
+                        break;
                     if (strstr (client->refbuf->data, "\r\n") != NULL)
                         break;
                     if (strstr (client->refbuf->data, "\n") != NULL)
@@ -482,6 +493,12 @@
                 }
                 /* stream_offset refers to the start of any data sent after the
                  * http style headers, we don't want to lose those */
+                ptr = strstr (client->refbuf->data, "\r\r\n\r\r\n");
+                if (ptr)
+                {
+                    node->stream_offset = (ptr+6) - client->refbuf->data;
+                    break;
+                }
                 ptr = strstr (client->refbuf->data, "\r\n\r\n");
                 if (ptr)
                 {
@@ -1005,7 +1022,7 @@
 
     if (node->shoutcast == 1)
     {
-        char *source_password, *ptr;
+        char *source_password, *ptr, *headers;
         mount_proxy *mountinfo = config_find_mount (config, config->shoutcast_mount);
 
         if (mountinfo && mountinfo->password)
@@ -1013,11 +1030,23 @@
         else
             source_password = strdup (config->source_password);
         config_release_config();
-        
+
         /* Get rid of trailing \r\n or \n after password */
-        ptr = strstr (client->refbuf->data, "\r\n");
-        if (ptr == NULL)
-            ptr = strstr (client->refbuf->data, "\n");
+        ptr = strstr (client->refbuf->data, "\r\r\n");
+        if (ptr)
+            headers = ptr+3;
+        else
+        {
+            ptr = strstr (client->refbuf->data, "\r\n");
+            if (ptr)
+                headers = ptr+2;
+            else
+            {
+                ptr = strstr (client->refbuf->data, "\n");
+                if (ptr)
+                    headers = ptr+1;
+            }
+        }
 
         if (ptr == NULL)
         {
@@ -1034,14 +1063,16 @@
             /* send this non-blocking but if there is only a partial write
              * then leave to header timeout */
             sock_write (client->con->sock, "OK2\r\n");
-            memset (client->refbuf->data, 0, client->refbuf->len);
+            node->offset -= (headers - client->refbuf->data);
+            memmove (client->refbuf->data, headers, node->offset+1);
             node->shoutcast = 2;
-            node->offset = 0;
             /* we've checked the password, now send it back for reading headers */
             _add_request_queue (node);
             free (source_password);
             return;
         }
+        else
+            INFO1 ("password does not match \"%s\"", client->refbuf->data);
         client_destroy (client);
         free (node);
         return;

Modified: icecast/branches/kh/icecast/src/logging.c
===================================================================
--- icecast/branches/kh/icecast/src/logging.c	2005-10-07 01:12:04 UTC (rev 10138)
+++ icecast/branches/kh/icecast/src/logging.c	2005-10-07 02:54:54 UTC (rev 10139)
@@ -221,6 +221,7 @@
         snprintf (fn_error, FILENAME_MAX, "%s%s%s", config->log_dir, PATH_SEPARATOR, config->error_log);
         log_set_filename (errorlog, fn_error);
         log_set_level (errorlog, config->loglevel);
+        log_set_trigger (errorlog, config->logsize);
         log_reopen (errorlog);
     }
 
@@ -229,6 +230,7 @@
         char fn_error[FILENAME_MAX];
         snprintf (fn_error, FILENAME_MAX, "%s%s%s", config->log_dir, PATH_SEPARATOR, config->access_log);
         log_set_filename (accesslog, fn_error);
+        log_set_trigger (accesslog, config->logsize);
         log_reopen (accesslog);
     }
 
@@ -237,6 +239,7 @@
         char fn_error[FILENAME_MAX];
         snprintf (fn_error, FILENAME_MAX, "%s%s%s", config->log_dir, PATH_SEPARATOR, config->playlist_log);
         log_set_filename (playlistlog, fn_error);
+        log_set_trigger (playlistlog, config->logsize);
         log_reopen (playlistlog);
     }
 }

Modified: icecast/branches/kh/icecast/src/main.c
===================================================================
--- icecast/branches/kh/icecast/src/main.c	2005-10-07 01:12:04 UTC (rev 10138)
+++ icecast/branches/kh/icecast/src/main.c	2005-10-07 02:54:54 UTC (rev 10139)
@@ -194,6 +194,8 @@
         snprintf(fn_error, FILENAME_MAX, "%s%s%s", config->log_dir, PATH_SEPARATOR, config->error_log);
         errorlog = log_open(fn_error);
         log_to_stderr = 0;
+        if (config->logsize)
+            log_set_trigger (errorlog, config->logsize);
     } else {
         errorlog = log_open_file(stderr);
         log_to_stderr = 1;
@@ -213,6 +215,8 @@
         snprintf(fn_access, FILENAME_MAX, "%s%s%s", config->log_dir, PATH_SEPARATOR, config->access_log);
         accesslog = log_open(fn_access);
         log_to_stderr = 0;
+        if (config->logsize)
+            log_set_trigger (accesslog, config->logsize);
     } else {
         accesslog = log_open_file(stderr);
         log_to_stderr = 1;
@@ -239,6 +243,8 @@
             _fatal_error(buf);
         }
         log_to_stderr = 0;
+        if (config->logsize)
+            log_set_trigger (playlistlog, config->logsize);
     } else {
         playlistlog = -1;
     }

Modified: icecast/branches/kh/icecast/web/status.xsl
===================================================================
--- icecast/branches/kh/icecast/web/status.xsl	2005-10-07 01:12:04 UTC (rev 10138)
+++ icecast/branches/kh/icecast/web/status.xsl	2005-10-07 02:54:54 UTC (rev 10139)
@@ -32,8 +32,6 @@
 <!--end index header menu -->
 <!--mount point stats-->
 <xsl:for-each select="source">
-<xsl:choose>
-<xsl:when test="listeners">
 <div class="roundcont">
 <div class="roundtop">
 <img src="/images/corner_topleft.jpg" class="corner" style="display: none" />
@@ -42,22 +40,21 @@
 <h3>
 <xsl:choose>
 <xsl:when test="authenticator">
-<a href="auth.xsl"><img border="0" src="/images/key.png"/></a> Authentication Required
+<a href="/auth.xsl"><img border="0" src="/images/key.png"/></a>
 </xsl:when>
 <xsl:otherwise>
-<a href="{@mount}.m3u"><img border="0" src="/images/tunein.png"/></a> Mount Point
+<a href="{@mount}.m3u"><img border="0" src="/images/tunein.png"/></a>
 </xsl:otherwise>
 </xsl:choose>
-(<xsl:value-of select="@mount" />)
-<xsl:if test="authenticator"> <a href="/auth.xsl"><img border="0" src="/images/key.png"/></a> </xsl:if>
-<xsl:if test="artwork">
-  <img border="0" alt="" width="100" height="100">
-  <xsl:attribute name="src">
-     <xsl:value-of select="artwork"/>
-  </xsl:attribute>
- </img>
-</xsl:if>
-
+Mount Point : (<xsl:value-of select="@mount" />) :
+<xsl:choose>
+<xsl:when test="authenticator">
+<a href="/auth.xsl">Click to Listen</a>
+</xsl:when>
+<xsl:otherwise>
+<a href="{@mount}.m3u">Click to Listen</a>
+</xsl:otherwise>
+</xsl:choose>
 </h3>
 
 <table border="0" cellpadding="4">
@@ -106,11 +103,6 @@
 </div>
 <br />
 <br />
-</xsl:when>
-<xsl:otherwise>
-<h3><xsl:value-of select="@mount" /> - Not Connected</h3>
-</xsl:otherwise>
-</xsl:choose>
 
 </xsl:for-each>
 <xsl:text disable-output-escaping="yes">&amp;</xsl:text>nbsp;



More information about the commits mailing list