mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2025-02-02 15:07:36 -05:00
Update: Made sane_hostname more formal config_problems and include flags for insane location and admin
This commit is contained in:
parent
59efa2689c
commit
15dd9af54d
@ -936,6 +936,7 @@ static void _set_defaults(ice_config_t *configuration)
|
||||
|
||||
static inline void __check_hostname(ice_config_t *configuration)
|
||||
{
|
||||
int sane_hostname = 0;
|
||||
char *p;
|
||||
|
||||
/* ensure we have a non-NULL buffer: */
|
||||
@ -948,10 +949,9 @@ static inline void __check_hostname(ice_config_t *configuration)
|
||||
*p += 'a' - 'A';
|
||||
}
|
||||
|
||||
configuration->sane_hostname = 0;
|
||||
switch (util_hostcheck(configuration->hostname)) {
|
||||
case HOSTCHECK_SANE:
|
||||
configuration->sane_hostname = 1;
|
||||
sane_hostname = 1;
|
||||
break;
|
||||
case HOSTCHECK_ERROR:
|
||||
ICECAST_LOG_ERROR("Can not check hostname \"%s\".",
|
||||
@ -985,6 +985,9 @@ static inline void __check_hostname(ice_config_t *configuration)
|
||||
"listings.");
|
||||
break;
|
||||
}
|
||||
|
||||
if (!sane_hostname)
|
||||
configuration->config_problems |= CONFIG_PROBLEM_HOSTNAME;
|
||||
}
|
||||
|
||||
static void _parse_root(xmlDocPtr doc,
|
||||
@ -1161,8 +1164,9 @@ static void _parse_root(xmlDocPtr doc,
|
||||
strcmp(configuration->location, CONFIG_DEFAULT_LOCATION) == 0) {
|
||||
ICECAST_LOG_WARN("Warning, <location> not configured, using default "
|
||||
"value \"%s\".", CONFIG_DEFAULT_LOCATION);
|
||||
if (!configuration->location)
|
||||
configuration->location = (char *) xmlCharStrdup(CONFIG_DEFAULT_LOCATION);
|
||||
if (!configuration->location)
|
||||
configuration->location = (char *) xmlCharStrdup(CONFIG_DEFAULT_LOCATION);
|
||||
configuration->config_problems |= CONFIG_PROBLEM_LOCATION;
|
||||
}
|
||||
|
||||
if (!configuration->admin ||
|
||||
@ -1171,9 +1175,10 @@ static void _parse_root(xmlDocPtr doc,
|
||||
"default value \"%s\". This breaks YP directory listings. "
|
||||
"YP directory support will be disabled.", CONFIG_DEFAULT_ADMIN);
|
||||
/* FIXME actually disable YP */
|
||||
if (!configuration->admin)
|
||||
configuration->admin = (char *) xmlCharStrdup(CONFIG_DEFAULT_ADMIN);
|
||||
}
|
||||
if (!configuration->admin)
|
||||
configuration->admin = (char *) xmlCharStrdup(CONFIG_DEFAULT_ADMIN);
|
||||
configuration->config_problems |= CONFIG_PROBLEM_ADMIN;
|
||||
}
|
||||
}
|
||||
|
||||
static void _parse_limits(xmlDocPtr doc,
|
||||
|
@ -28,6 +28,10 @@
|
||||
|
||||
#define XMLSTR(str) ((xmlChar *)(str))
|
||||
|
||||
#define CONFIG_PROBLEM_HOSTNAME 0x0001U
|
||||
#define CONFIG_PROBLEM_LOCATION 0x0002U
|
||||
#define CONFIG_PROBLEM_ADMIN 0x0004U
|
||||
|
||||
typedef enum _http_header_type {
|
||||
/* static: headers are passed as is to the client. */
|
||||
HTTP_HEADER_TYPE_STATIC,
|
||||
@ -198,6 +202,8 @@ typedef struct {
|
||||
struct ice_config_tag {
|
||||
char *config_filename;
|
||||
|
||||
unsigned int config_problems;
|
||||
|
||||
char *location;
|
||||
char *admin;
|
||||
|
||||
@ -220,7 +226,6 @@ struct ice_config_tag {
|
||||
struct event_registration_tag *event;
|
||||
|
||||
char *hostname;
|
||||
int sane_hostname;
|
||||
int port;
|
||||
char *mimetypes_fn;
|
||||
|
||||
|
@ -556,7 +556,7 @@ static inline void __log_system_name(void) {
|
||||
|
||||
if (have_hostname) {
|
||||
config = config_get_config();
|
||||
if (!config->sane_hostname && util_hostcheck(hostname) == HOSTCHECK_SANE) {
|
||||
if ((config->config_problems & CONFIG_PROBLEM_HOSTNAME) && util_hostcheck(hostname) == HOSTCHECK_SANE) {
|
||||
ICECAST_LOG_WARN("Hostname is not set to anything useful in <hostname>, Consider setting it to the system's name \"%s\".", hostname);
|
||||
}
|
||||
config_release_config();
|
||||
|
Loading…
x
Reference in New Issue
Block a user