[xiph-commits] r16319 - in trunk/ezstream: . doc examples src

moritz at svn.xiph.org moritz at svn.xiph.org
Wed Jul 22 13:19:38 PDT 2009


Author: moritz
Date: 2009-07-22 13:19:38 -0700 (Wed, 22 Jul 2009)
New Revision: 16319

Modified:
   trunk/ezstream/NEWS
   trunk/ezstream/doc/ezstream.1.in
   trunk/ezstream/examples/ezstream_mp3.xml
   trunk/ezstream/examples/ezstream_vorbis.xml
   trunk/ezstream/src/configfile.c
   trunk/ezstream/src/configfile.h
   trunk/ezstream/src/util.c
Log:
Akos Veres suggested that ezstream should be able to set the login username,
and I concur.


Modified: trunk/ezstream/NEWS
===================================================================
--- trunk/ezstream/NEWS	2009-07-22 11:37:05 UTC (rev 16318)
+++ trunk/ezstream/NEWS	2009-07-22 20:19:38 UTC (rev 16319)
@@ -6,6 +6,9 @@
 
  * various:
    - [MISC]  Further improvements and minor fixes in the build system.
+   - [NEW]   New optional <sourceuser/> configuration option, to change the
+             username used in authentication with Icecast. Suggested by
+             Akos Veres.
 
 
 

Modified: trunk/ezstream/doc/ezstream.1.in
===================================================================
--- trunk/ezstream/doc/ezstream.1.in	2009-07-22 11:37:05 UTC (rev 16318)
+++ trunk/ezstream/doc/ezstream.1.in	2009-07-22 20:19:38 UTC (rev 16319)
@@ -130,6 +130,15 @@
 For example:
 .Pp
 .Dl \&<url\&>http://example.com:8000/stream.ogg\&</url\&>
+.It Sy \&<sourceuser\ /\&>
+.Pq Optional.
+Sets the source username for authentication with the Icecast server.
+The default user
+.Po
+usually
+.Dq Li source
+.Pc
+is used if this element is not provided.
 .It Sy \&<sourcepassword\ /\&>
 .Pq Mandatory.
 Sets the source password for authentication with the Icecast server.

Modified: trunk/ezstream/examples/ezstream_mp3.xml
===================================================================
--- trunk/ezstream/examples/ezstream_mp3.xml	2009-07-22 11:37:05 UTC (rev 16318)
+++ trunk/ezstream/examples/ezstream_mp3.xml	2009-07-22 20:19:38 UTC (rev 16319)
@@ -8,6 +8,11 @@
  -->
 <ezstream>
     <url>http://localhost:8000/stream</url>
+    <!--
+      If a different user name than "source" should be used, set it in
+      <sourceuser/>:
+     -->
+    <!-- <sourceuser>mr_stream</sourceuser> -->
     <sourcepassword>hackme</sourcepassword>
     <format>MP3</format>
     <filename>playlist.m3u</filename>

Modified: trunk/ezstream/examples/ezstream_vorbis.xml
===================================================================
--- trunk/ezstream/examples/ezstream_vorbis.xml	2009-07-22 11:37:05 UTC (rev 16318)
+++ trunk/ezstream/examples/ezstream_vorbis.xml	2009-07-22 20:19:38 UTC (rev 16319)
@@ -8,6 +8,11 @@
  -->
 <ezstream>
     <url>http://localhost:8000/vorbis.ogg</url>
+    <!--
+      If a different user name than "source" should be used, set it in
+      <sourceuser/>:
+     -->
+    <!-- <sourceuser>mr_stream</sourceuser> -->
     <sourcepassword>hackme</sourcepassword>
     <format>VORBIS</format>
     <filename>playlist.m3u</filename>

Modified: trunk/ezstream/src/configfile.c
===================================================================
--- trunk/ezstream/src/configfile.c	2009-07-22 11:37:05 UTC (rev 16318)
+++ trunk/ezstream/src/configfile.c	2009-07-22 20:19:38 UTC (rev 16319)
@@ -128,6 +128,19 @@
 				xmlFree(ls_xmlContentPtr);
 			}
 		}
+		if (!xmlStrcmp(cur->name, (const xmlChar *)"sourceuser")) {
+			if (ezConfig.username != NULL) {
+				printf("%s[%ld]: Error: Cannot have multiple <sourceuser> elements\n",
+				       fileName, xmlGetLineNo(cur));
+				config_error++;
+				continue;
+			}
+			if (cur->xmlChildrenNode != NULL) {
+				ls_xmlContentPtr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+				ezConfig.username = xstrdup(ls_xmlContentPtr);
+				xmlFree(ls_xmlContentPtr);
+			}
+		}
 		if (!xmlStrcmp(cur->name, (const xmlChar *)"sourcepassword")) {
 			if (ezConfig.password != NULL) {
 				printf("%s[%ld]: Error: Cannot have multiple <sourcepassword> elements\n",

Modified: trunk/ezstream/src/configfile.h
===================================================================
--- trunk/ezstream/src/configfile.h	2009-07-22 11:37:05 UTC (rev 16318)
+++ trunk/ezstream/src/configfile.h	2009-07-22 20:19:38 UTC (rev 16319)
@@ -44,6 +44,7 @@
 
 typedef struct tag_EZCONFIG {
 	char		*URL;
+	char		*username;
 	char		*password;
 	char		*format;
 	char		*fileName;

Modified: trunk/ezstream/src/util.c
===================================================================
--- trunk/ezstream/src/util.c	2009-07-22 11:37:05 UTC (rev 16318)
+++ trunk/ezstream/src/util.c	2009-07-22 20:19:38 UTC (rev 16319)
@@ -151,6 +151,13 @@
 		return (NULL);
 	}
 
+	if (pezConfig->username &&
+	    shout_set_user(shout, pezConfig->username) != SHOUTERR_SUCCESS) {
+		printf("%s: shout_set_user(): %s\n",
+		       __progname, shout_get_error(shout));
+		shout_free(shout);
+		return (NULL);
+	}
 	if (pezConfig->serverName &&
 	    shout_set_name(shout, pezConfig->serverName) != SHOUTERR_SUCCESS) {
 		printf("%s: shout_set_name(): %s\n",



More information about the commits mailing list