1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-06-16 06:15:24 +00:00

Fix: Updated default config and parsing to reflect existance of <yp-directory>

This commit is contained in:
Philipp Schafft 2022-03-12 13:09:50 +00:00
parent d1ea95f0e5
commit 9e49f088a7
4 changed files with 13 additions and 12 deletions

View File

@ -59,10 +59,9 @@
very carefully, as it is not enough to just uncomment this. very carefully, as it is not enough to just uncomment this.
--> -->
<!-- <!--
<directory> <yp-directory url="https://dir.xiph.org/cgi-bin/yp-cgi">
<yp-url-timeout>15</yp-url-timeout> <option name="timeout" value="15" />
<yp-url>http://dir.xiph.org/cgi-bin/yp-cgi</yp-url> </yp-directory>
</directory>
--> -->
<!-- You may have multiple <listen-socket> elements --> <!-- You may have multiple <listen-socket> elements -->

View File

@ -14,10 +14,9 @@
<admin-user>admin</admin-user> <admin-user>admin</admin-user>
<admin-password>hackme</admin-password> <admin-password>hackme</admin-password>
</authentication> </authentication>
<directory> <yp-directory url="https://dir.xiph.org/cgi-bin/yp-cgi">
<yp-url-timeout>15</yp-url-timeout> <option name="timeout" value="15" />
<yp-url>http://dir.xiph.org/cgi-bin/yp-cgi</yp-url> </yp-directory>
</directory>
<hostname>localhost</hostname> <hostname>localhost</hostname>
<listen-socket> <listen-socket>
<port>8000</port> <port>8000</port>

View File

@ -16,10 +16,9 @@
<admin-user>admin</admin-user> <admin-user>admin</admin-user>
<admin-password>hackme</admin-password> <admin-password>hackme</admin-password>
</authentication> </authentication>
<directory> <yp-directory url="https://dir.xiph.org/cgi-bin/yp-cgi">
<yp-url-timeout>15</yp-url-timeout> <option name="timeout" value="15" />
<yp-url>http://dir.xiph.org/cgi-bin/yp-cgi</yp-url> </yp-directory>
</directory>
<!-- This is the hostname other people will use to connect to your server. <!-- This is the hostname other people will use to connect to your server.
It affects mainly the urls generated by Icecast for playlists and yp It affects mainly the urls generated by Icecast for playlists and yp
listings. listings.

View File

@ -1338,6 +1338,7 @@ static void _parse_root(xmlDocPtr doc,
} else if (xmlStrcmp(node->name, XMLSTR("mount")) == 0) { } else if (xmlStrcmp(node->name, XMLSTR("mount")) == 0) {
_parse_mount(doc, node, configuration); _parse_mount(doc, node, configuration);
} else if (xmlStrcmp(node->name, XMLSTR("directory")) == 0) { } else if (xmlStrcmp(node->name, XMLSTR("directory")) == 0) {
__found_bad_tag(configuration, node, BTR_OBSOLETE, "Use a <yp-directory> block.");
_parse_oldstyle_directory(doc, node->xmlChildrenNode, configuration); _parse_oldstyle_directory(doc, node->xmlChildrenNode, configuration);
} else if (xmlStrcmp(node->name, XMLSTR("yp-directory")) == 0) { } else if (xmlStrcmp(node->name, XMLSTR("yp-directory")) == 0) {
_parse_yp_directory(doc, node, configuration); _parse_yp_directory(doc, node, configuration);
@ -2446,6 +2447,7 @@ static void _parse_yp_directory(xmlDocPtr doc,
url = (char *)xmlGetProp(node, XMLSTR("url")); url = (char *)xmlGetProp(node, XMLSTR("url"));
if (url == NULL) { if (url == NULL) {
__found_bad_tag(configuration, node, BTR_INVALID, NULL);
ICECAST_LOG_ERROR("Missing mandatory attribute 'url' for <yp-directory>."); ICECAST_LOG_ERROR("Missing mandatory attribute 'url' for <yp-directory>.");
return; return;
} }
@ -2461,6 +2463,7 @@ static void _parse_yp_directory(xmlDocPtr doc,
options = config_parse_options(node); options = config_parse_options(node);
for (config_options_t *opt = options; opt; opt = opt->next) { for (config_options_t *opt = options; opt; opt = opt->next) {
if (!opt->name || !opt->value) { if (!opt->name || !opt->value) {
__found_bad_tag(configuration, node, BTR_INVALID, NULL);
ICECAST_LOG_WARN("Invalid <option>, missing 'name' and 'value' attributes."); ICECAST_LOG_WARN("Invalid <option>, missing 'name' and 'value' attributes.");
continue; continue;
} }
@ -2479,6 +2482,7 @@ static void _parse_yp_directory(xmlDocPtr doc,
/* FIXME: Pass the correct node to config_href_to_id(). */ /* FIXME: Pass the correct node to config_href_to_id(). */
yp_dir->listen_socket_id = config_href_to_id(configuration, NULL, opt->value); yp_dir->listen_socket_id = config_href_to_id(configuration, NULL, opt->value);
} else { } else {
__found_bad_tag(configuration, node, BTR_INVALID, NULL);
ICECAST_LOG_WARN("Invalid YP <option> with unknown 'name' attribute."); ICECAST_LOG_WARN("Invalid YP <option> with unknown 'name' attribute.");
} }
} }