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

Update: Renamed <no-mount> to <allow-direct-access>

Closes: #2408
This commit is contained in:
Philipp Schafft 2022-02-28 10:56:35 +00:00
parent ce814ba303
commit b7e204e3a7
5 changed files with 18 additions and 7 deletions

View File

@ -1652,6 +1652,7 @@ static void _parse_mount(xmlDocPtr doc,
mount->mp3_meta_interval = -1;
mount->yp_public = -1;
mount->max_history = -1;
mount->allow_direct_access = true;
mount->next = NULL;
tmp = (char *)xmlGetProp(parentnode, XMLSTR("type"));
@ -1723,8 +1724,14 @@ static void _parse_mount(xmlDocPtr doc,
if(tmp)
xmlFree(tmp);
} else if (xmlStrcmp(node->name, XMLSTR("no-mount")) == 0) {
__found_bad_tag(configuration, node, BTR_OBSOLETE, "Use <allow-direct-access>.");
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
mount->no_mount = util_str_to_bool(tmp);
mount->allow_direct_access = !util_str_to_bool(tmp);
if(tmp)
xmlFree(tmp);
} else if (xmlStrcmp(node->name, XMLSTR("allow-direct-access")) == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
mount->allow_direct_access = util_str_to_bool(tmp);
if(tmp)
xmlFree(tmp);
} else if (xmlStrcmp(node->name, XMLSTR("no-yp")) == 0) {
@ -2928,8 +2935,8 @@ static void merge_mounts(mount_proxy * dst, mount_proxy * src)
dst->fallback_mount = (char*)xmlStrdup((xmlChar*)src->fallback_mount);
if (dst->fallback_override == FALLBACK_OVERRIDE_NONE)
dst->fallback_override = src->fallback_override;
if (!dst->no_mount)
dst->no_mount = src->no_mount;
if (dst->allow_direct_access)
dst->allow_direct_access = src->allow_direct_access;
if (dst->burst_size == -1)
dst->burst_size = src->burst_size;
if (!dst->queue_size_limit)

View File

@ -20,6 +20,8 @@
#define CONFIG_EBADROOT -3
#define CONFIG_EPARSE -4
#include <stdbool.h>
#include <libxml/tree.h>
#include "common/thread/thread.h"
#include "common/avl/avl.h"
@ -102,7 +104,7 @@ typedef struct _mount_proxy {
/* Do we permit direct requests of this mountpoint?
* (or only indirect, through fallbacks)
*/
int no_mount;
bool allow_direct_access;
/* amount to send to a new client if possible, -1 take
* from global setting
*/

View File

@ -1061,7 +1061,7 @@ static void _handle_get_request(client_t *client) {
}
}
if (source->no_mount) {
if (!source->allow_direct_access) {
client_send_error_by_id(client, ICECAST_ERROR_CON_MOUNT_NO_FOR_DIRECT_ACCESS);
break;
}

View File

@ -108,6 +108,7 @@ source_t *source_reserve (const char *mount)
src->mount = strdup(mount);
src->identifier = mount_identifier_new(mount);
src->max_listeners = -1;
src->allow_direct_access = true;
thread_mutex_create(&src->lock);
avl_insert(global.source_tree, src);
@ -1020,7 +1021,7 @@ static void source_apply_mount (ice_config_t *config, source_t *source, mount_pr
source->max_listeners = mountinfo->max_listeners;
source->fallback_override = mountinfo->fallback_override;
source->hidden = mountinfo->hidden;
source->no_mount = mountinfo->no_mount;
source->allow_direct_access = mountinfo->allow_direct_access;
}
/* if a setting is available in the mount details then use it, else

View File

@ -15,6 +15,7 @@
#define __SOURCE_H__
#include <stdio.h>
#include <stdbool.h>
#include "common/thread/thread.h"
#include "common/httpp/httpp.h"
@ -77,7 +78,7 @@ struct source_tag {
int on_demand;
int on_demand_req;
int hidden;
int no_mount; // copy of mount_proxy->no_mount
bool allow_direct_access; // copy of mount_proxy->allow_direct_access
time_t last_read;
int short_delay;