From 671c2366cf2a0ae32c04451679a51733031f14b8 Mon Sep 17 00:00:00 2001 From: "Thomas B. Ruecker" Date: Sun, 1 Mar 2015 16:51:09 +0000 Subject: [PATCH] Fixed log messages and comments * Reworded many log messages for better understanding. * Adjusted some version targets as we won't have a 2.4.2 release. * Added some FIXME comments --- src/auth.c | 4 ++-- src/auth_htpasswd.c | 2 +- src/auth_static.c | 6 ++--- src/cfgfile.c | 53 +++++++++++++++++++++++++-------------------- src/connection.c | 17 ++++++++------- src/event.c | 10 ++++----- src/event_exec.c | 12 +++++----- src/event_log.c | 2 +- src/event_url.c | 2 +- src/source.c | 2 +- src/yp.c | 4 ++-- 11 files changed, 61 insertions(+), 53 deletions(-) diff --git a/src/auth.c b/src/auth.c index 9ad245b3..f7d98b10 100644 --- a/src/auth.c +++ b/src/auth.c @@ -318,7 +318,7 @@ static void *auth_run_thread (void *arg) } thread_sleep (150000); } - ICECAST_LOG_INFO("Authenication thread shutting down"); + ICECAST_LOG_INFO("Authentication thread shutting down"); return NULL; } @@ -494,7 +494,7 @@ auth_t *auth_get_authenticator(xmlNodePtr node) auth->method[i] = 1; } - /* BEFORE RELEASE 2.4.2 TODO: Migrate this to config_parse_options(). */ + /* BEFORE RELEASE 2.5.0 TODO: Migrate this to config_parse_options(). */ option = node->xmlChildrenNode; while (option) { diff --git a/src/auth_htpasswd.c b/src/auth_htpasswd.c index 10b3d926..56f3f638 100644 --- a/src/auth_htpasswd.c +++ b/src/auth_htpasswd.c @@ -202,7 +202,7 @@ static auth_result htpasswd_auth (auth_client *auth_user) return AUTH_OK; } free (hashed_pw); - ICECAST_LOG_DEBUG("incorrect password for client"); + ICECAST_LOG_DEBUG("incorrect password for client with username: %s", client->username); return AUTH_FAILED; } ICECAST_LOG_DEBUG("no such username: %s", client->username); diff --git a/src/auth_static.c b/src/auth_static.c index 1107dc1e..15164b9c 100644 --- a/src/auth_static.c +++ b/src/auth_static.c @@ -83,7 +83,7 @@ int auth_get_static_auth (auth_t *authenticator, config_options_t *options) } else if (strcmp(authenticator->type, AUTH_TYPE_LEGACY_PASSWORD) == 0) { need_user = 0; } else { - ICECAST_LOG_ERROR("Type is not known."); + ICECAST_LOG_ERROR("Unknown type."); return -1; } @@ -113,11 +113,11 @@ int auth_get_static_auth (auth_t *authenticator, config_options_t *options) } if (need_user && !auth_info->username) { - ICECAST_LOG_ERROR("No Username given but needed."); + ICECAST_LOG_ERROR("Username required, but not given."); clear_auth(authenticator); return -1; } else if (!auth_info->password) { - ICECAST_LOG_ERROR("No password given but needed."); + ICECAST_LOG_ERROR("Password required, but not given."); clear_auth(authenticator); return -1; } diff --git a/src/cfgfile.c b/src/cfgfile.c index 6b514aaa..ce925107 100644 --- a/src/cfgfile.c +++ b/src/cfgfile.c @@ -775,11 +775,11 @@ static inline void __check_hostname(ice_config_t *configuration) { char *p; - // ensure we have a non-NULL buffer: + /* ensure we have a non-NULL buffer: */ if (!configuration->hostname) configuration->hostname = (char *)xmlCharStrdup (CONFIG_DEFAULT_HOSTNAME); - // convert to lower case: + /* convert to lower case: */ for (p = configuration->hostname; *p; p++) { if ( *p >= 'A' && *p <= 'Z' ) *p += 'a' - 'A'; @@ -796,13 +796,15 @@ static inline void __check_hostname(ice_config_t *configuration) break; case HOSTCHECK_NOT_FQDN: ICECAST_LOG_WARN("Warning, seems not to be set to a " - "fully qualified fomain name (FQDN). This may cause problems, " + "fully qualified domain name (FQDN). This may cause problems, " "e.g. with YP directory listings."); break; case HOSTCHECK_IS_LOCALHOST: ICECAST_LOG_WARN("Warning, not configured, using " - "default value \"%s\". This will cause problems, e.g. with " - "YP directory listings.", CONFIG_DEFAULT_HOSTNAME); + "default value \"%s\". This will cause problems, e.g. " + "this breaks YP directory listings. YP directory listing " + "support will be disabled.", CONFIG_DEFAULT_HOSTNAME); + /* FIXME actually disable YP */ break; case HOSTCHECK_IS_IPV4: ICECAST_LOG_WARN("Warning, seems to be set to an IPv4 " @@ -815,7 +817,7 @@ static inline void __check_hostname(ice_config_t *configuration) "listings."); break; case HOSTCHECK_BADCHAR: - ICECAST_LOG_WARN("Warning, configured to unusual " + ICECAST_LOG_WARN("Warning, contains unusual " "characters. This may cause problems, e.g. with YP directory " "listings."); break; @@ -861,12 +863,13 @@ static void _parse_root(xmlDocPtr doc, /* TODO: This is the backwards-compatibility location */ ICECAST_LOG_WARN(" defined outside " ". This is deprecated and will be removed in " - "version 2.5."); + "version 2.X.0"); + /* FIXME Settle target version for removal of this functionality! */ if (source_password) xmlFree(source_password); source_password = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1); } else if (xmlStrcmp(node->name, XMLSTR("icelogin")) == 0) { - ICECAST_LOG_ERROR(" has been removed."); + ICECAST_LOG_ERROR(" support has been removed."); } else if (xmlStrcmp(node->name, XMLSTR("fileserve")) == 0) { tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1); configuration->fileserve = util_str_to_bool(tmp); @@ -894,7 +897,7 @@ static void _parse_root(xmlDocPtr doc, configuration->listen_sock->port = atoi(tmp); xmlFree(tmp); } else { - ICECAST_LOG_WARN(" must not be empty."); + ICECAST_LOG_WARN(" setting must not be empty."); } } else if (xmlStrcmp(node->name, XMLSTR("bind-address")) == 0) { if (configuration->listen_sock->bind_address) @@ -970,8 +973,8 @@ static void _parse_root(xmlDocPtr doc, "source,put,get", 0, "*"); } } else { - ICECAST_LOG_ERROR("Can not find nor create default mount but " - "global lagency source password set. Bad."); + ICECAST_LOG_ERROR("Can not find nor create default mount, but " + "global legacy source password set. This is bad."); } xmlFree(source_password); } @@ -1003,7 +1006,9 @@ static void _parse_root(xmlDocPtr doc, if (!configuration->admin || strcmp(configuration->admin, CONFIG_DEFAULT_ADMIN) == 0) { ICECAST_LOG_WARN("Warning, contact not configured, using " - "default value \"%s\".", CONFIG_DEFAULT_ADMIN); + "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); } @@ -1036,7 +1041,8 @@ static void _parse_limits(xmlDocPtr doc, if (tmp) xmlFree(tmp); } else if (xmlStrcmp (node->name, XMLSTR("threadpool")) == 0) { - ICECAST_LOG_WARN(" deprecated and will be removed in version 2.5."); + ICECAST_LOG_WARN(" functionality was removed in Icecast" + " version 2.3.0, please remove this from your config."); } else if (xmlStrcmp (node->name, XMLSTR("client-timeout")) == 0) { tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1); configuration->client_timeout = atoi(tmp); @@ -1111,7 +1117,7 @@ static void _parse_mount_oldstyle_authentication(mount_proxy *mount, __append_old_style_auth(authstack, NULL, AUTH_TYPE_ANONYMOUS, NULL, NULL, "get,head,post", NULL, 0, NULL); } else if (strcmp(type, AUTH_TYPE_URL) == 0) { - /* This block is super fun! Attention! Super fun ahead! Ladies and Gentlemans take care and watch your children! */ + /* This block is super fun! Attention! Super fun ahead! Ladies and Gentlemen take care and watch your children! */ /* Stuff that was of help: * $ sed 's/^.*name="\([^"]*\)".*$/ const char *\1 = NULL;/' * $ sed 's/^.*name="\([^"]*\)".*$/ if (\1)\n xmlFree(\1);/' @@ -1230,7 +1236,7 @@ static void _parse_mount_oldstyle_authentication(mount_proxy *mount, xmlFree(stream_auth); } else { ICECAST_LOG_ERROR("Unknown authentication type in legacy mode. " - "Disable anonymous login listener and global login for source."); + "Anonymous listeners and global login for sources disabled."); __append_old_style_auth(authstack, NULL, AUTH_TYPE_ANONYMOUS, NULL, NULL, NULL, NULL, 0, NULL); } @@ -1327,7 +1333,8 @@ static void _parse_mount(xmlDocPtr doc, xmlFree(tmp); } else if (xmlStrcmp(node->name, XMLSTR("no-yp")) == 0) { ICECAST_LOG_WARN(" defined. Please use . This is " - "deprecated and will be removed in version 2.5."); + "deprecated and will be removed in a future version."); + /* FIXME when do we plan to remove this? */ tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1); mount->yp_public = util_str_to_bool(tmp) == 0 ? -1 : 0; if(tmp) @@ -1606,7 +1613,7 @@ static void _parse_relay(xmlDocPtr doc, relay->port = atoi(tmp); xmlFree(tmp); } else { - ICECAST_LOG_WARN(" must not be empty."); + ICECAST_LOG_WARN(" setting must not be empty."); } } else if (xmlStrcmp(node->name, XMLSTR("mount")) == 0) { if (relay->mount) @@ -1674,7 +1681,7 @@ static void _parse_listen_socket(xmlDocPtr doc, listener->port = atoi(tmp); xmlFree(tmp); } else { - ICECAST_LOG_WARN(" must not be empty."); + ICECAST_LOG_WARN(" setting must not be empty."); } } else if (xmlStrcmp (node->name, XMLSTR("ssl")) == 0) { tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1); @@ -1870,7 +1877,7 @@ static void _parse_paths(xmlDocPtr doc, (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1); } else if (xmlStrcmp(node->name, XMLSTR("logdir")) == 0) { if (!(temp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1))) { - ICECAST_LOG_WARN(" must not be empty."); + ICECAST_LOG_WARN(" setting must not be empty."); continue; } if (configuration->log_dir) @@ -1902,7 +1909,7 @@ static void _parse_paths(xmlDocPtr doc, configuration->cipher_list = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1); } else if (xmlStrcmp(node->name, XMLSTR("webroot")) == 0) { if (!(temp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1))) { - ICECAST_LOG_WARN(" must not be empty."); + ICECAST_LOG_WARN(" setting must not be empty."); continue; } if (configuration->webroot_dir) @@ -1912,7 +1919,7 @@ static void _parse_paths(xmlDocPtr doc, configuration->webroot_dir[strlen(configuration->webroot_dir)-1] = 0; } else if (xmlStrcmp(node->name, XMLSTR("adminroot")) == 0) { if (!(temp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1))) { - ICECAST_LOG_WARN(" must not be empty."); + ICECAST_LOG_WARN(" setting must not be empty."); continue; } if (configuration->adminroot_dir) @@ -1982,7 +1989,7 @@ static void _parse_logging(xmlDocPtr doc, if (xmlStrcmp (node->name, XMLSTR("accesslog")) == 0) { if (!(tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1))) { - ICECAST_LOG_WARN(" must not be empty."); + ICECAST_LOG_WARN(" setting must not be empty."); continue; } if (configuration->access_log) @@ -1990,7 +1997,7 @@ static void _parse_logging(xmlDocPtr doc, configuration->access_log = tmp; } else if (xmlStrcmp (node->name, XMLSTR("errorlog")) == 0) { if (!(tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1))) { - ICECAST_LOG_WARN(" must not be empty."); + ICECAST_LOG_WARN(" setting must not be empty."); continue; } if (configuration->error_log) diff --git a/src/connection.c b/src/connection.c index 837925c8..d6d467c1 100644 --- a/src/connection.c +++ b/src/connection.c @@ -225,11 +225,11 @@ static void get_ssl_certificate(ice_config_t *config) ICECAST_LOG_WARN("Invalid cipher list: %s", config->cipher_list); } config->tls_ok = ssl_ok = 1; - ICECAST_LOG_INFO("SSL certificate found at %s", config->cert_file); - ICECAST_LOG_INFO("SSL using ciphers %s", config->cipher_list); + ICECAST_LOG_INFO("Certificate found at %s", config->cert_file); + ICECAST_LOG_INFO("Using ciphers %s", config->cipher_list); return; } while (0); - ICECAST_LOG_INFO("No SSL capability on any configured ports"); + ICECAST_LOG_INFO("No TLS capability on any configured ports"); } @@ -273,7 +273,8 @@ static int connection_send_ssl(connection_t *con, const void *buf, size_t len) static void get_ssl_certificate(ice_config_t *config) { ssl_ok = 0; - ICECAST_LOG_INFO("No SSL capability"); + ICECAST_LOG_INFO("No TLS capability. " + "Rebuild Icecast with openSSL support to enable this."); } #endif /* HAVE_OPENSSL */ @@ -326,7 +327,7 @@ static void recheck_ip_file(cache_file_contents *cache) return; } if (stat(cache->filename, &file_stat) < 0) { - ICECAST_LOG_WARN("failed to check status of \"%s\": %s", cache->filename, strerror(errno)); + ICECAST_LOG_WARN("Failed to check status of \"%s\": %s", cache->filename, strerror(errno)); return; } if (file_stat.st_mtime == cache->file_mtime) @@ -712,7 +713,7 @@ void connection_queue(connection_t *con) if (sock_set_blocking(client->con->sock, 0) || sock_set_nodelay(client->con->sock)) { global_unlock(); - ICECAST_LOG_WARN("failed to set tcp options on client connection, dropping"); + ICECAST_LOG_WARN("Failed to set tcp options on client connection, dropping"); client_destroy(client); return; } @@ -891,7 +892,7 @@ static inline void source_startup(client_t *client, const char *uri) #ifdef HAVE_STRCASESTR if (strcasestr (expectcontinue, "100-continue") != NULL) #else - ICECAST_LOG_WARN("OS doesn't support case insenestive substring checks..."); + ICECAST_LOG_WARN("OS doesn't support case insensitive substring checks..."); if (strstr (expectcontinue, "100-continue") != NULL) #endif { @@ -962,7 +963,7 @@ static int __add_listener_to_source(source_t *source, client_t *client) source->mount, source->fallback_mount); return -1; } - ICECAST_LOG_INFO("stream full trying %s", next->mount); + ICECAST_LOG_INFO("stream full, trying %s", next->mount); source = next; loop--; continue; diff --git a/src/event.c b/src/event.c index 032745fd..a08b2faf 100644 --- a/src/event.c +++ b/src/event.c @@ -230,12 +230,12 @@ event_registration_t * event_new_from_xml_node(xmlNodePtr node) { ret->refcount = 1; - /* BEFORE RELEASE 2.4.2 DOCUMENT: Document */ + /* BEFORE RELEASE 2.5.0 DOCUMENT: Document */ ret->type = (char*)xmlGetProp(node, XMLSTR("type")); ret->trigger = (char*)xmlGetProp(node, XMLSTR("trigger")); if (!ret->type || !ret->trigger) { - ICECAST_LOG_ERROR("Event node isn't complet. Type or Trigger missing."); + ICECAST_LOG_ERROR("Event node isn't complete. Type or Trigger missing."); event_registration_release(ret); return NULL; } @@ -250,7 +250,7 @@ event_registration_t * event_new_from_xml_node(xmlNodePtr node) { rv = event_get_url(ret, options); #endif } else { - ICECAST_LOG_ERROR("Event backend %s is unknown.", ret->type); + ICECAST_LOG_ERROR("Unknown Event backend %s.", ret->type); rv = -1; } config_clear_options(options); @@ -334,7 +334,7 @@ void event_emit(event_t *event) { thread_mutex_unlock(&event_lock); } -/* this function needs to extract all the infos from the client, source and mount object +/* this function needs to extract all the info from the client, source and mount object * as after return the pointers become invalid. */ void event_emit_clientevent(const char *trigger, client_t *client, const char *uri) { @@ -359,7 +359,7 @@ void event_emit_clientevent(const char *trigger, client_t *client, const char *u event_push_reglist(event, mount->event); config_release_config(); - /* This isn't perfectly clean but is a important speedup: + /* This isn't perfectly clean but is an important speedup: * If first element of reglist is NULL none of the above pushed in * some registrations. If there are no registrations we can just drop * this event now and here. diff --git a/src/event_exec.c b/src/event_exec.c index f5926d00..0ce34fbb 100644 --- a/src/event_exec.c +++ b/src/event_exec.c @@ -55,7 +55,7 @@ static inline size_t __argvtype2offset(event_exec_argvtype_t argvtype) { } } -/* BEFORE RELEASE 2.4.2 DOCUMENT: Document names of possible values. */ +/* BEFORE RELEASE 2.5.0 DOCUMENT: Document names of possible values. */ static inline event_exec_argvtype_t __str2argvtype(const char *str) { if (!str) str = "(BAD VALUE)"; @@ -125,7 +125,7 @@ static inline void __setup_environ(ice_config_t *config, event_exec_t *self, eve source_t *source; char buf[80]; - /* BEFORE RELEASE 2.4.2 DOCUMENT: Document all those env vars. */ + /* BEFORE RELEASE 2.5.0 DOCUMENT: Document all those env vars. */ __update_environ("ICECAST_VERSION", ICECAST_VERSION_STRING); __update_environ("ICECAST_HOSTNAME", config->hostname); __update_environ("ICECAST_ADMIN", config->admin); @@ -235,8 +235,8 @@ static void _run_script (event_exec_t *self, event_t *event) { static int event_exec_emit(void *state, event_t *event) { event_exec_t *self = state; #ifdef _WIN32 - /* BEFORE RELEASE 2.4.2 DOCUMENT: Document this not working on win*. */ - ICECAST_LOG_ERROR(" not supported on win*"); + /* BEFORE RELEASE 2.5.0 DOCUMENT: Document this not working on win*. */ + ICECAST_LOG_ERROR(" not supported on Windows"); #else _run_script(self, event); #endif @@ -268,7 +268,7 @@ int event_get_exec(event_registration_t *er, config_options_t *options) { if ((cur = options)) { do { if (cur->name) { - /* BEFORE RELEASE 2.4.2 DOCUMENT: Document supported options: + /* BEFORE RELEASE 2.5.0 DOCUMENT: Document supported options: *