1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-11-03 04:17:17 -05: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.
-->
<!--
<directory>
<yp-url-timeout>15</yp-url-timeout>
<yp-url>http://dir.xiph.org/cgi-bin/yp-cgi</yp-url>
</directory>
<yp-directory url="https://dir.xiph.org/cgi-bin/yp-cgi">
<option name="timeout" value="15" />
</yp-directory>
-->
<!-- You may have multiple <listen-socket> elements -->

View File

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

View File

@ -16,10 +16,9 @@
<admin-user>admin</admin-user>
<admin-password>hackme</admin-password>
</authentication>
<directory>
<yp-url-timeout>15</yp-url-timeout>
<yp-url>http://dir.xiph.org/cgi-bin/yp-cgi</yp-url>
</directory>
<yp-directory url="https://dir.xiph.org/cgi-bin/yp-cgi">
<option name="timeout" value="15" />
</yp-directory>
<!-- 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
listings.

View File

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