diff --git a/src/core/config.py b/src/core/config.py index 2e0fa1da..182e0702 100755 --- a/src/core/config.py +++ b/src/core/config.py @@ -128,21 +128,36 @@ def _write_default_impl(self, option): def _write_apply_impl(self, option): s = "\tif (!strcmp(key, \"%s\"))\n\t{\n" % option.name + s_type = option.otype + s_default = option.default + s_min_str = "" + s_max_str = "" if option.otype == "int": + s_type = "integer" s_min = "0" s_max = "0" if (option.check_min): s += "\t\tmin = %s;\n" % option.check_min + if (option.check_min != "0"): + s_min_str = ", min=%s" % option.check_min s_min = "&min" if (option.check_max): s += "\t\tmax = %s;\n" % option.check_max + s_max_str = ", max=%s" % option.check_max s_max = "&max" s+= "\t\tif (!apply_integer(key, data, &config->%s, %s, %s))\n" % (option.name, s_min, s_max) elif option.otype == "boolean": s += "\t\tif (!apply_boolean(key, data, &config->%s))\n" % option.name elif option.is_string: + s_default = "\\\"%s\\\"" % option.default s += "\t\tif (!apply_string(key, data, &config->%s, (char*) \"\"))\n" % option.name - s += "\t\t{\n\t\t\tLOG_ERROR(\"Configuration parse error on line %d\", line_count);\n\t\t\treturn -1;\n\t\t}\n\t\treturn 0;\n\t}\n\n" + s += "\t\t{\n" + s += "\t\t\tLOG_ERROR(\"Configuration parse error on line %d\", line_count);\n" + s += "\t\t\tLOG_ERROR(\"\\\"%s\\\" (%s), default=%s%s%s\");\n" % (option.name, s_type, s_default, s_min_str, s_max_str) + s += "\t\t\treturn -1;\n" + s += "\t\t}\n" + s += "\t\treturn 0;\n" + s += "\t}\n\n" self.f.write(s) def _write_free_impl(self, option): diff --git a/src/core/gen_config.c b/src/core/gen_config.c index 9ce90791..5ac3b711 100644 --- a/src/core/gen_config.c +++ b/src/core/gen_config.c @@ -1,9 +1,9 @@ /* * uhub - A tiny ADC p2p connection hub - * Copyright (C) 2007-2014, Jan Vidar Krey + * Copyright (C) 2007-2020, Jan Vidar Krey * * THIS FILE IS AUTOGENERATED - DO NOT MODIFY - * Created 2014-07-29 12:22, by config.py + * Created 2020-02-08 21:04, by config.py */ void config_defaults(struct hub_config* config) @@ -103,6 +103,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_boolean(key, data, &config->hub_enabled)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"hub_enabled\" (boolean), default=1"); return -1; } return 0; @@ -115,6 +116,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_integer(key, data, &config->server_port, &min, &max)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"server_port\" (integer), default=1511, min=1, max=65535"); return -1; } return 0; @@ -125,6 +127,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->server_bind_addr, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"server_bind_addr\" (string), default=\"any\""); return -1; } return 0; @@ -136,6 +139,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_integer(key, data, &config->server_listen_backlog, &min, 0)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"server_listen_backlog\" (integer), default=50, min=5"); return -1; } return 0; @@ -146,6 +150,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->server_alt_ports, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"server_alt_ports\" (string), default=\"\""); return -1; } return 0; @@ -156,6 +161,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_boolean(key, data, &config->show_banner)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"show_banner\" (boolean), default=1"); return -1; } return 0; @@ -166,6 +172,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_boolean(key, data, &config->show_banner_sys_info)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"show_banner_sys_info\" (boolean), default=1"); return -1; } return 0; @@ -178,6 +185,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_integer(key, data, &config->max_users, &min, &max)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"max_users\" (integer), default=500, min=1, max=1048576"); return -1; } return 0; @@ -188,6 +196,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_boolean(key, data, &config->registered_users_only)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"registered_users_only\" (boolean), default=0"); return -1; } return 0; @@ -198,6 +207,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_boolean(key, data, &config->register_self)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"register_self\" (boolean), default=0"); return -1; } return 0; @@ -208,6 +218,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_boolean(key, data, &config->obsolete_clients)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"obsolete_clients\" (boolean), default=0"); return -1; } return 0; @@ -218,6 +229,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_boolean(key, data, &config->chat_is_privileged)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"chat_is_privileged\" (boolean), default=0"); return -1; } return 0; @@ -228,6 +240,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->hub_name, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"hub_name\" (string), default=\"uhub\""); return -1; } return 0; @@ -238,6 +251,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->hub_description, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"hub_description\" (string), default=\"no description\""); return -1; } return 0; @@ -248,6 +262,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->redirect_addr, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"redirect_addr\" (string), default=\"\""); return -1; } return 0; @@ -260,6 +275,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_integer(key, data, &config->max_recv_buffer, &min, &max)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"max_recv_buffer\" (integer), default=4096, min=1024, max=1048576"); return -1; } return 0; @@ -271,6 +287,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_integer(key, data, &config->max_send_buffer, &min, 0)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"max_send_buffer\" (integer), default=131072, min=2048"); return -1; } return 0; @@ -282,6 +299,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_integer(key, data, &config->max_send_buffer_soft, &min, 0)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"max_send_buffer_soft\" (integer), default=98304, min=1024"); return -1; } return 0; @@ -292,6 +310,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_boolean(key, data, &config->low_bandwidth_mode)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"low_bandwidth_mode\" (boolean), default=0"); return -1; } return 0; @@ -304,6 +323,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_integer(key, data, &config->max_chat_history, &min, &max)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"max_chat_history\" (integer), default=20, max=250"); return -1; } return 0; @@ -316,6 +336,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_integer(key, data, &config->max_logout_log, &min, &max)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"max_logout_log\" (integer), default=20, max=2000"); return -1; } return 0; @@ -327,6 +348,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_integer(key, data, &config->limit_max_hubs_user, &min, 0)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"limit_max_hubs_user\" (integer), default=10"); return -1; } return 0; @@ -338,6 +360,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_integer(key, data, &config->limit_max_hubs_reg, &min, 0)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"limit_max_hubs_reg\" (integer), default=10"); return -1; } return 0; @@ -349,6 +372,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_integer(key, data, &config->limit_max_hubs_op, &min, 0)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"limit_max_hubs_op\" (integer), default=10"); return -1; } return 0; @@ -360,6 +384,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_integer(key, data, &config->limit_max_hubs, &min, 0)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"limit_max_hubs\" (integer), default=25"); return -1; } return 0; @@ -371,6 +396,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_integer(key, data, &config->limit_min_hubs_user, &min, 0)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"limit_min_hubs_user\" (integer), default=0"); return -1; } return 0; @@ -382,6 +408,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_integer(key, data, &config->limit_min_hubs_reg, &min, 0)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"limit_min_hubs_reg\" (integer), default=0"); return -1; } return 0; @@ -393,6 +420,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_integer(key, data, &config->limit_min_hubs_op, &min, 0)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"limit_min_hubs_op\" (integer), default=0"); return -1; } return 0; @@ -404,6 +432,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_integer(key, data, &config->limit_min_share, &min, 0)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"limit_min_share\" (integer), default=0"); return -1; } return 0; @@ -415,6 +444,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_integer(key, data, &config->limit_max_share, &min, 0)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"limit_max_share\" (integer), default=0"); return -1; } return 0; @@ -426,6 +456,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_integer(key, data, &config->limit_min_slots, &min, 0)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"limit_min_slots\" (integer), default=0"); return -1; } return 0; @@ -437,6 +468,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_integer(key, data, &config->limit_max_slots, &min, 0)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"limit_max_slots\" (integer), default=0"); return -1; } return 0; @@ -449,6 +481,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_integer(key, data, &config->flood_ctl_interval, &min, &max)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"flood_ctl_interval\" (integer), default=0, min=1, max=60"); return -1; } return 0; @@ -459,6 +492,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_integer(key, data, &config->flood_ctl_chat, 0, 0)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"flood_ctl_chat\" (integer), default=0"); return -1; } return 0; @@ -469,6 +503,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_integer(key, data, &config->flood_ctl_connect, 0, 0)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"flood_ctl_connect\" (integer), default=0"); return -1; } return 0; @@ -479,6 +514,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_integer(key, data, &config->flood_ctl_search, 0, 0)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"flood_ctl_search\" (integer), default=0"); return -1; } return 0; @@ -489,6 +525,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_integer(key, data, &config->flood_ctl_update, 0, 0)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"flood_ctl_update\" (integer), default=0"); return -1; } return 0; @@ -499,6 +536,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_integer(key, data, &config->flood_ctl_extras, 0, 0)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"flood_ctl_extras\" (integer), default=0"); return -1; } return 0; @@ -509,6 +547,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_boolean(key, data, &config->tls_enable)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"tls_enable\" (boolean), default=0"); return -1; } return 0; @@ -519,6 +558,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_boolean(key, data, &config->tls_require)) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"tls_require\" (boolean), default=0"); return -1; } return 0; @@ -529,6 +569,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->tls_require_redirect_addr, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"tls_require_redirect_addr\" (string), default=\"\""); return -1; } return 0; @@ -539,6 +580,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->tls_certificate, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"tls_certificate\" (file), default=\"\""); return -1; } return 0; @@ -549,6 +591,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->tls_private_key, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"tls_private_key\" (file), default=\"\""); return -1; } return 0; @@ -559,6 +602,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->tls_ciphersuite, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"tls_ciphersuite\" (string), default=\"ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS\""); return -1; } return 0; @@ -569,6 +613,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->tls_version, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"tls_version\" (string), default=\"1.2\""); return -1; } return 0; @@ -579,6 +624,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->file_acl, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"file_acl\" (file), default=\"\""); return -1; } return 0; @@ -589,6 +635,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->file_plugins, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"file_plugins\" (file), default=\"\""); return -1; } return 0; @@ -599,6 +646,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_hub_full, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_hub_full\" (message), default=\"Hub is full\""); return -1; } return 0; @@ -609,6 +657,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_hub_disabled, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_hub_disabled\" (message), default=\"Hub is disabled\""); return -1; } return 0; @@ -619,6 +668,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_hub_registered_users_only, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_hub_registered_users_only\" (message), default=\"Hub is for registered users only\""); return -1; } return 0; @@ -629,6 +679,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_inf_error_nick_missing, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_inf_error_nick_missing\" (message), default=\"No nickname given\""); return -1; } return 0; @@ -639,6 +690,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_inf_error_nick_multiple, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_inf_error_nick_multiple\" (message), default=\"Multiple nicknames given\""); return -1; } return 0; @@ -649,6 +701,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_inf_error_nick_invalid, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_inf_error_nick_invalid\" (message), default=\"Nickname is invalid\""); return -1; } return 0; @@ -659,6 +712,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_inf_error_nick_long, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_inf_error_nick_long\" (message), default=\"Nickname too long\""); return -1; } return 0; @@ -669,6 +723,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_inf_error_nick_short, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_inf_error_nick_short\" (message), default=\"Nickname too short\""); return -1; } return 0; @@ -679,6 +734,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_inf_error_nick_spaces, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_inf_error_nick_spaces\" (message), default=\"Nickname cannot start with spaces\""); return -1; } return 0; @@ -689,6 +745,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_inf_error_nick_bad_chars, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_inf_error_nick_bad_chars\" (message), default=\"Nickname contains invalid characters\""); return -1; } return 0; @@ -699,6 +756,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_inf_error_nick_not_utf8, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_inf_error_nick_not_utf8\" (message), default=\"Nickname is not valid UTF-8\""); return -1; } return 0; @@ -709,6 +767,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_inf_error_nick_taken, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_inf_error_nick_taken\" (message), default=\"Nickname is already in use\""); return -1; } return 0; @@ -719,6 +778,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_inf_error_nick_restricted, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_inf_error_nick_restricted\" (message), default=\"Nickname cannot be used on this hub\""); return -1; } return 0; @@ -729,6 +789,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_inf_error_cid_invalid, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_inf_error_cid_invalid\" (message), default=\"CID is not valid\""); return -1; } return 0; @@ -739,6 +800,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_inf_error_cid_missing, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_inf_error_cid_missing\" (message), default=\"CID is not specified\""); return -1; } return 0; @@ -749,6 +811,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_inf_error_cid_taken, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_inf_error_cid_taken\" (message), default=\"CID is taken\""); return -1; } return 0; @@ -759,6 +822,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_inf_error_pid_missing, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_inf_error_pid_missing\" (message), default=\"PID is not specified\""); return -1; } return 0; @@ -769,6 +833,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_inf_error_pid_invalid, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_inf_error_pid_invalid\" (message), default=\"PID is invalid\""); return -1; } return 0; @@ -779,6 +844,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_ban_permanently, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_ban_permanently\" (message), default=\"Banned permanently\""); return -1; } return 0; @@ -789,6 +855,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_ban_temporarily, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_ban_temporarily\" (message), default=\"Banned temporarily\""); return -1; } return 0; @@ -799,6 +866,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_auth_invalid_password, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_auth_invalid_password\" (message), default=\"Password is wrong\""); return -1; } return 0; @@ -809,6 +877,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_auth_user_not_found, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_auth_user_not_found\" (message), default=\"User not found in password database\""); return -1; } return 0; @@ -819,6 +888,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_error_no_memory, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_error_no_memory\" (message), default=\"No memory\""); return -1; } return 0; @@ -829,6 +899,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_user_share_size_low, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_user_share_size_low\" (message), default=\"User is not sharing enough\""); return -1; } return 0; @@ -839,6 +910,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_user_share_size_high, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_user_share_size_high\" (message), default=\"User is sharing too much\""); return -1; } return 0; @@ -849,6 +921,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_user_slots_low, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_user_slots_low\" (message), default=\"User have too few upload slots.\""); return -1; } return 0; @@ -859,6 +932,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_user_slots_high, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_user_slots_high\" (message), default=\"User have too many upload slots.\""); return -1; } return 0; @@ -869,6 +943,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_user_hub_limit_low, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_user_hub_limit_low\" (message), default=\"User is on too few hubs.\""); return -1; } return 0; @@ -879,6 +954,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_user_hub_limit_high, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_user_hub_limit_high\" (message), default=\"User is on too many hubs.\""); return -1; } return 0; @@ -889,6 +965,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_user_flood_chat, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_user_flood_chat\" (message), default=\"Chat flood detected, messages are dropped.\""); return -1; } return 0; @@ -899,6 +976,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_user_flood_connect, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_user_flood_connect\" (message), default=\"Connect flood detected, connection refused.\""); return -1; } return 0; @@ -909,6 +987,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_user_flood_search, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_user_flood_search\" (message), default=\"Search flood detected, search is stopped.\""); return -1; } return 0; @@ -919,6 +998,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_user_flood_update, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_user_flood_update\" (message), default=\"Update flood detected.\""); return -1; } return 0; @@ -929,6 +1009,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_user_flood_extras, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_user_flood_extras\" (message), default=\"Flood detected.\""); return -1; } return 0; @@ -939,6 +1020,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_proto_no_common_hash, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_proto_no_common_hash\" (message), default=\"No common hash algorithm.\""); return -1; } return 0; @@ -949,6 +1031,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li if (!apply_string(key, data, &config->msg_proto_obsolete_adc0, (char*) "")) { LOG_ERROR("Configuration parse error on line %d", line_count); + LOG_ERROR("\"msg_proto_obsolete_adc0\" (message), default=\"Client is using an obsolete ADC protocol version.\""); return -1; } return 0; diff --git a/src/core/gen_config.h b/src/core/gen_config.h index cc8415bd..d324acb1 100644 --- a/src/core/gen_config.h +++ b/src/core/gen_config.h @@ -1,9 +1,9 @@ /* * uhub - A tiny ADC p2p connection hub - * Copyright (C) 2007-2014, Jan Vidar Krey + * Copyright (C) 2007-2020, Jan Vidar Krey * * THIS FILE IS AUTOGENERATED - DO NOT MODIFY - * Created 2014-07-29 12:22, by config.py + * Created 2020-02-08 21:04, by config.py */ struct hub_config diff --git a/src/core/probe.c b/src/core/probe.c index 4e1c517a..8a321c19 100644 --- a/src/core/probe.c +++ b/src/core/probe.c @@ -49,7 +49,6 @@ static void probe_net_event(struct net_connection* con, int events, void *arg) #ifdef SSL_SUPPORT if (probe->hub->config->tls_enable && probe->hub->config->tls_require) { - LOG_TRACE("Not TLS connection - closing connection."); if (*probe->hub->config->tls_require_redirect_addr) { char buf[512];