diff --git a/NEWS b/NEWS index d165734..29d7322 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,9 @@ Changes in 0.5.5, released on XXXX-XX-XX: * various: - [MISC] Further improvements and minor fixes in the build system. + - [NEW] New optional configuration option, to change the + username used in authentication with Icecast. Suggested by + Akos Veres. diff --git a/doc/ezstream.1.in b/doc/ezstream.1.in index 9b469f1..5625704 100644 --- a/doc/ezstream.1.in +++ b/doc/ezstream.1.in @@ -130,6 +130,15 @@ The content must be of the form For example: .Pp .Dl \&http://example.com:8000/stream.ogg\& +.It Sy \& +.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 \& .Pq Mandatory. Sets the source password for authentication with the Icecast server. diff --git a/examples/ezstream_mp3.xml b/examples/ezstream_mp3.xml index 681ae15..2308512 100644 --- a/examples/ezstream_mp3.xml +++ b/examples/ezstream_mp3.xml @@ -8,6 +8,11 @@ --> http://localhost:8000/stream + + hackme MP3 playlist.m3u diff --git a/examples/ezstream_vorbis.xml b/examples/ezstream_vorbis.xml index 35c3a2b..70d6ffe 100644 --- a/examples/ezstream_vorbis.xml +++ b/examples/ezstream_vorbis.xml @@ -8,6 +8,11 @@ --> http://localhost:8000/vorbis.ogg + + hackme VORBIS playlist.m3u diff --git a/src/configfile.c b/src/configfile.c index ec3f86c..6072fc9 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -128,6 +128,19 @@ parseConfig(const char *fileName) xmlFree(ls_xmlContentPtr); } } + if (!xmlStrcmp(cur->name, (const xmlChar *)"sourceuser")) { + if (ezConfig.username != NULL) { + printf("%s[%ld]: Error: Cannot have multiple 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 elements\n", diff --git a/src/configfile.h b/src/configfile.h index c1cfb2e..a2d5649 100644 --- a/src/configfile.h +++ b/src/configfile.h @@ -44,6 +44,7 @@ typedef struct tag_FORMAT_ENCDEC { typedef struct tag_EZCONFIG { char *URL; + char *username; char *password; char *format; char *fileName; diff --git a/src/util.c b/src/util.c index dec3c3d..da3b8b2 100644 --- a/src/util.c +++ b/src/util.c @@ -151,6 +151,13 @@ stream_setup(const char *host, unsigned short port, const char *mount) 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",