0
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2025-06-30 22:18:19 -04:00

Fix: Corrected and improved default value handling for relay upstreams

This commit is contained in:
Philipp Schafft 2018-07-26 08:25:21 +00:00
parent 4b2a062aa0
commit 2c8d45310a

View File

@ -75,6 +75,9 @@
#define CONFIG_DEFAULT_GROUP NULL #define CONFIG_DEFAULT_GROUP NULL
#define CONFIG_MASTER_UPDATE_INTERVAL 120 #define CONFIG_MASTER_UPDATE_INTERVAL 120
#define CONFIG_YP_URL_TIMEOUT 10 #define CONFIG_YP_URL_TIMEOUT 10
#define CONFIG_DEFAULT_RELAY_SERVER "127.0.0.1"
#define CONFIG_DEFAULT_RELAY_PORT 80
#define CONFIG_DEFAULT_RELAY_MOUNT "/"
#define CONFIG_DEFAULT_CIPHER_LIST "ECDHE-RSA-AES128-GCM-SHA256:"\ #define CONFIG_DEFAULT_CIPHER_LIST "ECDHE-RSA-AES128-GCM-SHA256:"\
"ECDHE-ECDSA-AES128-GCM-SHA256:"\ "ECDHE-ECDSA-AES128-GCM-SHA256:"\
"ECDHE-RSA-AES256-GCM-SHA384:"\ "ECDHE-RSA-AES256-GCM-SHA384:"\
@ -1720,11 +1723,16 @@ static void _parse_relay_upstream(xmlDocPtr doc,
node->xmlChildrenNode, 1); node->xmlChildrenNode, 1);
} }
} while ((node = node->next)); } while ((node = node->next));
}
static void _parse_relay_upstream_apply_defaults(relay_config_upstream_t *upstream)
{
if (!upstream->server) if (!upstream->server)
upstream->server = (char *)xmlCharStrdup("127.0.0.1"); upstream->server = (char *)xmlCharStrdup(CONFIG_DEFAULT_RELAY_SERVER);
if (!upstream->port)
upstream->port = CONFIG_DEFAULT_RELAY_PORT;
if (!upstream->mount) if (!upstream->mount)
upstream->mount = (char *)xmlCharStrdup("/"); upstream->mount = (char *)xmlCharStrdup(CONFIG_DEFAULT_RELAY_MOUNT);
} }
static void _parse_relay(xmlDocPtr doc, static void _parse_relay(xmlDocPtr doc,
@ -1775,6 +1783,8 @@ static void _parse_relay(xmlDocPtr doc,
} }
} while ((node = node->next)); } while ((node = node->next));
_parse_relay_upstream_apply_defaults(&(relay->upstream_default));
if (relay->localmount == NULL) if (relay->localmount == NULL)
relay->localmount = (char *)xmlStrdup(XMLSTR(relay->upstream_default.mount)); relay->localmount = (char *)xmlStrdup(XMLSTR(relay->upstream_default.mount));
} }