Compare commits
22 Commits
history_on
...
0.3.x-stab
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c9f32c8f7f | ||
|
|
4c94753469 | ||
|
|
43375d8443 | ||
|
|
0190c38c32 | ||
|
|
25c03f5c96 | ||
|
|
f25cb7bd5d | ||
|
|
1e6d6cd1e7 | ||
|
|
f55243cf88 | ||
|
|
6e1de7329c | ||
|
|
f65a81a2aa | ||
|
|
6daa5ecf95 | ||
|
|
23498e9ac8 | ||
|
|
c30b85bbcb | ||
|
|
0810982b57 | ||
|
|
ac5811633e | ||
|
|
b3ed3a5526 | ||
|
|
1480b7e9c0 | ||
|
|
50fde1c5c8 | ||
|
|
77faac0494 | ||
|
|
473ff0e159 | ||
|
|
62333c5f39 | ||
|
|
44860c8477 |
20
ChangeLog
20
ChangeLog
@@ -1,3 +1,23 @@
|
|||||||
|
0.3.3:
|
||||||
|
- Fix SSL/TLS related memory leak.
|
||||||
|
- Fix 100% CPU issue with SSL connections.
|
||||||
|
- Added option to redirect from adc:// to adcs:// if tls is required.
|
||||||
|
- Added more informative error messages for the configuration file parser.
|
||||||
|
- Made sure logs can be rotated by sending a SIGHUP to the hub
|
||||||
|
- Fix bug #139: Unable to use TLS - due to not handling quotes around configuration strings.
|
||||||
|
- Fix bug #136 - !broadcast does not report status back to to sender.
|
||||||
|
|
||||||
|
|
||||||
|
0.3.2:
|
||||||
|
- Fixed bugs in the kqueue network backend (OSX/BSD)
|
||||||
|
- Rewrote the configuration backend code.
|
||||||
|
- Added support for escaping characters in the configuration files.
|
||||||
|
- Updated the !broadcast command to send private messages instead of main chat messages.
|
||||||
|
- Adding support for redirecting clients to other hubs when they fail to log in.
|
||||||
|
- Fix some out of memory related crashes.
|
||||||
|
- Fixed minor memory leaks.
|
||||||
|
|
||||||
|
|
||||||
0.3.1:
|
0.3.1:
|
||||||
- Fixed bug where !getip did not work.
|
- Fixed bug where !getip did not work.
|
||||||
- Added flood control configuration options.
|
- Added flood control configuration options.
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ LD := $(CC)
|
|||||||
MV := mv
|
MV := mv
|
||||||
RANLIB := ranlib
|
RANLIB := ranlib
|
||||||
CFLAGS += -pipe -Wall
|
CFLAGS += -pipe -Wall
|
||||||
USE_SSL ?= NO
|
USE_SSL ?= YES
|
||||||
USE_BIGENDIAN ?= AUTO
|
USE_BIGENDIAN ?= AUTO
|
||||||
BITS ?= AUTO
|
BITS ?= AUTO
|
||||||
SILENT ?= YES
|
SILENT ?= YES
|
||||||
|
|||||||
12
debian/changelog
vendored
12
debian/changelog
vendored
@@ -1,3 +1,15 @@
|
|||||||
|
uhub (0.3.3-1) unstable; urgency=low
|
||||||
|
|
||||||
|
* Updated upstream version.
|
||||||
|
|
||||||
|
-- Jan Vidar Krey <janvidar@extatic.org> Tue 24 Aug 2010 18:00:00 +0200
|
||||||
|
|
||||||
|
uhub (0.3.2-1) unstable; urgency=low
|
||||||
|
|
||||||
|
* Updated upstream version.
|
||||||
|
|
||||||
|
-- Jan Vidar Krey <janvidar@extatic.org> Mon 30 May 2010 18:00:00 +0200
|
||||||
|
|
||||||
uhub (0.3.1-1) unstable; urgency=low
|
uhub (0.3.1-1) unstable; urgency=low
|
||||||
|
|
||||||
* Updated version number.
|
* Updated version number.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
Summary: High performance ADC p2p hub.
|
Summary: High performance ADC p2p hub.
|
||||||
Name: uhub
|
Name: uhub
|
||||||
Version: 0.3.1
|
Version: 0.3.3
|
||||||
Release: 3
|
Release: 3
|
||||||
License: GPLv3
|
License: GPLv3
|
||||||
Group: Networking/File transfer
|
Group: Networking/File transfer
|
||||||
|
|||||||
@@ -756,7 +756,7 @@ char* adc_msg_get_argument(struct adc_message* cmd, int offset)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
argument = hub_strdup(&start[1]);
|
argument = hub_strdup(&start[1]);
|
||||||
if (argument && argument[strlen(argument)-1] == '\n')
|
if (argument && *argument && argument[strlen(argument)-1] == '\n')
|
||||||
argument[strlen(argument)-1] = 0;
|
argument[strlen(argument)-1] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ void sid_pool_destroy(struct sid_pool* pool)
|
|||||||
|
|
||||||
sid_t sid_alloc(struct sid_pool* pool, struct hub_user* user)
|
sid_t sid_alloc(struct sid_pool* pool, struct hub_user* user)
|
||||||
{
|
{
|
||||||
|
sid_t n;
|
||||||
if (pool->count >= (pool->max - pool->min))
|
if (pool->count >= (pool->max - pool->min))
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_SID
|
#ifdef DEBUG_SID
|
||||||
@@ -127,7 +128,7 @@ sid_t sid_alloc(struct sid_pool* pool, struct hub_user* user)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sid_t n = (++pool->count);
|
n = (++pool->count);
|
||||||
for (; (pool->map[n % pool->max]); n++) ;
|
for (; (pool->map[n % pool->max]); n++) ;
|
||||||
|
|
||||||
#ifdef DEBUG_SID
|
#ifdef DEBUG_SID
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* uhub - A tiny ADC p2p connection hub
|
* uhub - A tiny ADC p2p connection hub
|
||||||
* Copyright (C) 2007-2009, Jan Vidar Krey
|
* Copyright (C) 2007-2010, Jan Vidar Krey
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -176,14 +176,10 @@ static int check_cmd_addr(const char* cmd, struct linked_list* list, char* line,
|
|||||||
|
|
||||||
static int acl_parse_line(char* line, int line_count, void* ptr_data)
|
static int acl_parse_line(char* line, int line_count, void* ptr_data)
|
||||||
{
|
{
|
||||||
char* pos;
|
|
||||||
struct acl_handle* handle = (struct acl_handle*) ptr_data;
|
struct acl_handle* handle = (struct acl_handle*) ptr_data;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if ((pos = strchr(line, '#')) != NULL)
|
strip_off_ini_line_comments(line, line_count);
|
||||||
{
|
|
||||||
pos[0] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
line = strip_white_space(line);
|
line = strip_white_space(line);
|
||||||
if (!*line)
|
if (!*line)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* uhub - A tiny ADC p2p connection hub
|
* uhub - A tiny ADC p2p connection hub
|
||||||
* Copyright (C) 2007-2009, Jan Vidar Krey
|
* Copyright (C) 2007-2010, Jan Vidar Krey
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -412,11 +412,50 @@ static int command_whoip(struct hub_info* hub, struct hub_user* user, struct hub
|
|||||||
|
|
||||||
static int command_broadcast(struct hub_info* hub, struct hub_user* user, struct hub_command* cmd)
|
static int command_broadcast(struct hub_info* hub, struct hub_user* user, struct hub_command* cmd)
|
||||||
{
|
{
|
||||||
struct adc_message* command = adc_msg_construct(ADC_CMD_IMSG, strlen((cmd->message + 12)) + 6);
|
size_t offset = 12;
|
||||||
adc_msg_add_argument(command, (cmd->message + 12));
|
#if USE_OLD_BROADCAST_STYLE
|
||||||
|
struct adc_message* command = adc_msg_construct(ADC_CMD_IMSG, strlen((cmd->message + offset)) + 6);
|
||||||
|
adc_msg_add_argument(command, (cmd->message + offset));
|
||||||
route_to_all(hub, command);
|
route_to_all(hub, command);
|
||||||
adc_msg_free(command);
|
adc_msg_free(command);
|
||||||
return 0;
|
return 0;
|
||||||
|
#else
|
||||||
|
size_t message_len = strlen(cmd->message + offset);
|
||||||
|
struct adc_message* command = 0;
|
||||||
|
char pm_flag[7] = "PM";
|
||||||
|
char from_sid[5];
|
||||||
|
char buffer[128];
|
||||||
|
size_t recipients = 0;
|
||||||
|
struct hub_user* target;
|
||||||
|
|
||||||
|
memcpy(from_sid, sid_to_string(user->id.sid), sizeof(from_sid));
|
||||||
|
memcpy(pm_flag + 2, from_sid, sizeof(from_sid));
|
||||||
|
|
||||||
|
target = (struct hub_user*) list_get_first(hub->users->list);
|
||||||
|
while (target)
|
||||||
|
{
|
||||||
|
if (target != user)
|
||||||
|
{
|
||||||
|
recipients++;
|
||||||
|
command = adc_msg_construct(ADC_CMD_DMSG, message_len + 23);
|
||||||
|
if (!command)
|
||||||
|
break;
|
||||||
|
|
||||||
|
adc_msg_add_argument(command, from_sid);
|
||||||
|
adc_msg_add_argument(command, sid_to_string(target->id.sid));
|
||||||
|
adc_msg_add_argument(command, (cmd->message + offset));
|
||||||
|
adc_msg_add_argument(command, pm_flag);
|
||||||
|
|
||||||
|
route_to_user(hub, target, command);
|
||||||
|
adc_msg_free(command);
|
||||||
|
}
|
||||||
|
target = (struct hub_user*) list_get_next(hub->users->list);
|
||||||
|
}
|
||||||
|
|
||||||
|
snprintf(buffer, sizeof(buffer), "*** %s: Delivered to " PRINTF_SIZE_T " user%s", cmd->prefix, recipients, (recipients != 1 ? "s" : ""));
|
||||||
|
send_message(hub, user, buffer);
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static int command_history(struct hub_info* hub, struct hub_user* user, struct hub_command* cmd)
|
static int command_history(struct hub_info* hub, struct hub_user* user, struct hub_command* cmd)
|
||||||
|
|||||||
@@ -85,10 +85,7 @@ static int config_parse_line(char* line, int line_count, void* ptr_data)
|
|||||||
char* data;
|
char* data;
|
||||||
struct hub_config* config = (struct hub_config*) ptr_data;
|
struct hub_config* config = (struct hub_config*) ptr_data;
|
||||||
|
|
||||||
if ((pos = strchr(line, '#')) != NULL)
|
strip_off_ini_line_comments(line, line_count);
|
||||||
{
|
|
||||||
pos[0] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!*line) return 0;
|
if (!*line) return 0;
|
||||||
|
|
||||||
@@ -113,6 +110,7 @@ static int config_parse_line(char* line, int line_count, void* ptr_data)
|
|||||||
|
|
||||||
key = strip_white_space(key);
|
key = strip_white_space(key);
|
||||||
data = strip_white_space(data);
|
data = strip_white_space(data);
|
||||||
|
data = strip_off_quotes(data);
|
||||||
|
|
||||||
if (!*key || !*data)
|
if (!*key || !*data)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ sub write_c_impl_apply(@)
|
|||||||
my $min;
|
my $min;
|
||||||
my $max;
|
my $max;
|
||||||
my $regexp;
|
my $regexp;
|
||||||
|
my $expect = "";
|
||||||
|
|
||||||
if (defined $p)
|
if (defined $p)
|
||||||
{
|
{
|
||||||
@@ -141,14 +142,21 @@ sub write_c_impl_apply(@)
|
|||||||
|
|
||||||
print GENIMPL "\tif (!strcmp(key, \"" . $name . "\"))\n\t{\n";
|
print GENIMPL "\tif (!strcmp(key, \"" . $name . "\"))\n\t{\n";
|
||||||
|
|
||||||
|
$expect = "\\\"$name\\\"";
|
||||||
|
|
||||||
if ($type eq "int")
|
if ($type eq "int")
|
||||||
{
|
{
|
||||||
|
$expect .= " (integer)";
|
||||||
|
$expect .= ", default=" . $default;
|
||||||
|
|
||||||
if (defined $min)
|
if (defined $min)
|
||||||
{
|
{
|
||||||
|
$expect .= ", min=" . $min;
|
||||||
print GENIMPL "\t\tmin = $min;\n"
|
print GENIMPL "\t\tmin = $min;\n"
|
||||||
}
|
}
|
||||||
if (defined $max)
|
if (defined $max)
|
||||||
{
|
{
|
||||||
|
$expect .= ", max=" . $max;
|
||||||
print GENIMPL "\t\tmax = $max;\n"
|
print GENIMPL "\t\tmax = $max;\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,16 +186,27 @@ sub write_c_impl_apply(@)
|
|||||||
}
|
}
|
||||||
elsif ($type eq "boolean")
|
elsif ($type eq "boolean")
|
||||||
{
|
{
|
||||||
|
$expect .= " (boolean)";
|
||||||
|
$expect .= ", default=" . $default;
|
||||||
print GENIMPL "\t\tif (!apply_boolean(key, data, &config->$name))\n";
|
print GENIMPL "\t\tif (!apply_boolean(key, data, &config->$name))\n";
|
||||||
}
|
}
|
||||||
elsif ($type =~ /(string|file|message)/)
|
elsif ($type =~ /(string|file|message)/)
|
||||||
{
|
{
|
||||||
|
$expect .= " (" . $type . ")";
|
||||||
|
$expect .= ", default=\\\"" . $default . "\\\"";
|
||||||
print GENIMPL "\t\tif (!apply_string(key, data, &config->$name, (char*) \"\"))\n";
|
print GENIMPL "\t\tif (!apply_string(key, data, &config->$name, (char*) \"\"))\n";
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$expect = " is unknown.";
|
||||||
|
}
|
||||||
|
|
||||||
print GENIMPL "\t\t{\n" .
|
print GENIMPL "\t\t{\n" .
|
||||||
"\t\t\tLOG_ERROR(\"Configuration parse error on line %d\", line_count);\n" .
|
"\t\t\tLOG_ERROR(\"Configuration parse error on line %d\", line_count);\n";
|
||||||
"\t\t\treturn -1;\n" .
|
|
||||||
|
print GENIMPL "\t\t\tLOG_ERROR(\"" . $expect . "\");\n" if ($expect ne "");
|
||||||
|
|
||||||
|
print GENIMPL "\t\t\treturn -1;\n" .
|
||||||
"\t\t}\n" .
|
"\t\t}\n" .
|
||||||
"\t\treturn 0;\n" .
|
"\t\treturn 0;\n" .
|
||||||
"\t}\n\n";
|
"\t}\n\n";
|
||||||
|
|||||||
@@ -417,6 +417,17 @@
|
|||||||
<since>0.3.0</since>
|
<since>0.3.0</since>
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
|
<option name="tls_require_redirect_addr" type="string" default="">
|
||||||
|
<check regexp="(adc|adcs|dchub)://.*" />
|
||||||
|
<short>A redirect address in case a client connects using "adc://" when "adcs://" is required.</short>
|
||||||
|
<description><![CDATA[
|
||||||
|
This is the redirect address used when the hub wants to redirect a client for not using ADCS.
|
||||||
|
For instance a hub at adc://adc.example.com might redirect to adcs://adc.example.com
|
||||||
|
]]></description>
|
||||||
|
<since>0.3.3</since>
|
||||||
|
</option>
|
||||||
|
|
||||||
|
|
||||||
<option name="tls_certificate" type="file" default="">
|
<option name="tls_certificate" type="file" default="">
|
||||||
<short>Certificate file</short>
|
<short>Certificate file</short>
|
||||||
<description><![CDATA[
|
<description><![CDATA[
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ void config_defaults(struct hub_config* config)
|
|||||||
config->flood_ctl_extras = 0;
|
config->flood_ctl_extras = 0;
|
||||||
config->tls_enable = 0;
|
config->tls_enable = 0;
|
||||||
config->tls_require = 0;
|
config->tls_require = 0;
|
||||||
|
config->tls_require_redirect_addr = hub_strdup("");
|
||||||
config->tls_certificate = hub_strdup("");
|
config->tls_certificate = hub_strdup("");
|
||||||
config->tls_private_key = hub_strdup("");
|
config->tls_private_key = hub_strdup("");
|
||||||
config->file_motd = hub_strdup("");
|
config->file_motd = hub_strdup("");
|
||||||
@@ -95,6 +96,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
|
|||||||
if (!apply_boolean(key, data, &config->hub_enabled))
|
if (!apply_boolean(key, data, &config->hub_enabled))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"hub_enabled\" (boolean), default=1");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -105,6 +107,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
|
|||||||
if (!apply_integer(key, data, &config->server_port, 0, 0))
|
if (!apply_integer(key, data, &config->server_port, 0, 0))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"server_port\" (integer), default=1511");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -115,6 +118,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*) ""))
|
if (!apply_string(key, data, &config->server_bind_addr, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"server_bind_addr\" (string), default=\"any\"");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -125,6 +129,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
|
|||||||
if (!apply_integer(key, data, &config->server_listen_backlog, 0, 0))
|
if (!apply_integer(key, data, &config->server_listen_backlog, 0, 0))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"server_listen_backlog\" (integer), default=50");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -135,6 +140,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*) ""))
|
if (!apply_string(key, data, &config->server_alt_ports, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"server_alt_ports\" (string), default=\"\"");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -145,6 +151,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
|
|||||||
if (!apply_boolean(key, data, &config->show_banner))
|
if (!apply_boolean(key, data, &config->show_banner))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"show_banner\" (boolean), default=1");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -155,6 +162,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))
|
if (!apply_boolean(key, data, &config->show_banner_sys_info))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"show_banner_sys_info\" (boolean), default=1");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -167,6 +175,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))
|
if (!apply_integer(key, data, &config->max_users, &min, &max))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"max_users\" (integer), default=500, min=1, max=1048576");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -177,6 +186,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
|
|||||||
if (!apply_boolean(key, data, &config->registered_users_only))
|
if (!apply_boolean(key, data, &config->registered_users_only))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"registered_users_only\" (boolean), default=0");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -187,6 +197,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
|
|||||||
if (!apply_boolean(key, data, &config->obsolete_clients))
|
if (!apply_boolean(key, data, &config->obsolete_clients))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"obsolete_clients\" (boolean), default=0");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -197,6 +208,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
|
|||||||
if (!apply_boolean(key, data, &config->chat_only))
|
if (!apply_boolean(key, data, &config->chat_only))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"chat_only\" (boolean), default=0");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -207,6 +219,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
|
|||||||
if (!apply_boolean(key, data, &config->chat_is_privileged))
|
if (!apply_boolean(key, data, &config->chat_is_privileged))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"chat_is_privileged\" (boolean), default=0");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -217,6 +230,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
|
|||||||
if (!apply_string(key, data, &config->hub_name, (char*) ""))
|
if (!apply_string(key, data, &config->hub_name, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"hub_name\" (string), default=\"uhub\"");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -227,6 +241,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
|
|||||||
if (!apply_string(key, data, &config->hub_description, (char*) ""))
|
if (!apply_string(key, data, &config->hub_description, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"hub_description\" (string), default=\"no description\"");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -237,6 +252,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
|
|||||||
if (!apply_string(key, data, &config->redirect_addr, (char*) ""))
|
if (!apply_string(key, data, &config->redirect_addr, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"redirect_addr\" (string), default=\"\"");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -247,6 +263,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
|
|||||||
if (!apply_integer(key, data, &config->max_recv_buffer, 0, 0))
|
if (!apply_integer(key, data, &config->max_recv_buffer, 0, 0))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"max_recv_buffer\" (integer), default=4096");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -257,6 +274,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
|
|||||||
if (!apply_integer(key, data, &config->max_send_buffer, 0, 0))
|
if (!apply_integer(key, data, &config->max_send_buffer, 0, 0))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"max_send_buffer\" (integer), default=131072");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -267,6 +285,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, 0, 0))
|
if (!apply_integer(key, data, &config->max_send_buffer_soft, 0, 0))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"max_send_buffer_soft\" (integer), default=98304");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -277,6 +296,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
|
|||||||
if (!apply_boolean(key, data, &config->low_bandwidth_mode))
|
if (!apply_boolean(key, data, &config->low_bandwidth_mode))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"low_bandwidth_mode\" (boolean), default=0");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -287,6 +307,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
|
|||||||
if (!apply_integer(key, data, &config->max_chat_history, 0, 0))
|
if (!apply_integer(key, data, &config->max_chat_history, 0, 0))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"max_chat_history\" (integer), default=20");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -297,6 +318,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
|
|||||||
if (!apply_integer(key, data, &config->max_logout_log, 0, 0))
|
if (!apply_integer(key, data, &config->max_logout_log, 0, 0))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"max_logout_log\" (integer), default=20");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -307,6 +329,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, 0, 0))
|
if (!apply_integer(key, data, &config->limit_max_hubs_user, 0, 0))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"limit_max_hubs_user\" (integer), default=10");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -317,6 +340,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, 0, 0))
|
if (!apply_integer(key, data, &config->limit_max_hubs_reg, 0, 0))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"limit_max_hubs_reg\" (integer), default=10");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -327,6 +351,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, 0, 0))
|
if (!apply_integer(key, data, &config->limit_max_hubs_op, 0, 0))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"limit_max_hubs_op\" (integer), default=10");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -337,6 +362,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
|
|||||||
if (!apply_integer(key, data, &config->limit_max_hubs, 0, 0))
|
if (!apply_integer(key, data, &config->limit_max_hubs, 0, 0))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"limit_max_hubs\" (integer), default=25");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -347,6 +373,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, 0, 0))
|
if (!apply_integer(key, data, &config->limit_min_hubs_user, 0, 0))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"limit_min_hubs_user\" (integer), default=0");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -357,6 +384,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, 0, 0))
|
if (!apply_integer(key, data, &config->limit_min_hubs_reg, 0, 0))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"limit_min_hubs_reg\" (integer), default=0");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -367,6 +395,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, 0, 0))
|
if (!apply_integer(key, data, &config->limit_min_hubs_op, 0, 0))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"limit_min_hubs_op\" (integer), default=0");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -378,6 +407,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))
|
if (!apply_integer(key, data, &config->limit_min_share, &min, 0))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"limit_min_share\" (integer), default=0, min=0");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -388,6 +418,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
|
|||||||
if (!apply_integer(key, data, &config->limit_max_share, 0, 0))
|
if (!apply_integer(key, data, &config->limit_max_share, 0, 0))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"limit_max_share\" (integer), default=0");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -398,6 +429,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
|
|||||||
if (!apply_integer(key, data, &config->limit_min_slots, 0, 0))
|
if (!apply_integer(key, data, &config->limit_min_slots, 0, 0))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"limit_min_slots\" (integer), default=0");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -408,6 +440,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
|
|||||||
if (!apply_integer(key, data, &config->limit_max_slots, 0, 0))
|
if (!apply_integer(key, data, &config->limit_max_slots, 0, 0))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"limit_max_slots\" (integer), default=0");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -420,6 +453,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))
|
if (!apply_integer(key, data, &config->flood_ctl_interval, &min, &max))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -430,6 +464,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))
|
if (!apply_integer(key, data, &config->flood_ctl_chat, 0, 0))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"flood_ctl_chat\" (integer), default=0");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -440,6 +475,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))
|
if (!apply_integer(key, data, &config->flood_ctl_connect, 0, 0))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"flood_ctl_connect\" (integer), default=0");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -450,6 +486,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))
|
if (!apply_integer(key, data, &config->flood_ctl_search, 0, 0))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"flood_ctl_search\" (integer), default=0");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -460,6 +497,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))
|
if (!apply_integer(key, data, &config->flood_ctl_update, 0, 0))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"flood_ctl_update\" (integer), default=0");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -470,6 +508,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))
|
if (!apply_integer(key, data, &config->flood_ctl_extras, 0, 0))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"flood_ctl_extras\" (integer), default=0");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -480,6 +519,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
|
|||||||
if (!apply_boolean(key, data, &config->tls_enable))
|
if (!apply_boolean(key, data, &config->tls_enable))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"tls_enable\" (boolean), default=0");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -490,6 +530,18 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
|
|||||||
if (!apply_boolean(key, data, &config->tls_require))
|
if (!apply_boolean(key, data, &config->tls_require))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"tls_require\" (boolean), default=0");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!strcmp(key, "tls_require_redirect_addr"))
|
||||||
|
{
|
||||||
|
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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -500,6 +552,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
|
|||||||
if (!apply_string(key, data, &config->tls_certificate, (char*) ""))
|
if (!apply_string(key, data, &config->tls_certificate, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"tls_certificate\" (file), default=\"\"");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -510,6 +563,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*) ""))
|
if (!apply_string(key, data, &config->tls_private_key, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"tls_private_key\" (file), default=\"\"");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -520,6 +574,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
|
|||||||
if (!apply_string(key, data, &config->file_motd, (char*) ""))
|
if (!apply_string(key, data, &config->file_motd, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"file_motd\" (file), default=\"\"");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -530,6 +585,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
|
|||||||
if (!apply_string(key, data, &config->file_acl, (char*) ""))
|
if (!apply_string(key, data, &config->file_acl, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"file_acl\" (file), default=\"\"");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -540,6 +596,7 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
|
|||||||
if (!apply_string(key, data, &config->file_rules, (char*) ""))
|
if (!apply_string(key, data, &config->file_rules, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"file_rules\" (file), default=\"\"");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -550,6 +607,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*) ""))
|
if (!apply_string(key, data, &config->msg_hub_full, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"msg_hub_full\" (message), default=\"Hub is full\"");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -560,6 +618,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*) ""))
|
if (!apply_string(key, data, &config->msg_hub_disabled, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"msg_hub_disabled\" (message), default=\"Hub is disabled\"");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -570,6 +629,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*) ""))
|
if (!apply_string(key, data, &config->msg_hub_registered_users_only, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -580,6 +640,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*) ""))
|
if (!apply_string(key, data, &config->msg_inf_error_nick_missing, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -590,6 +651,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*) ""))
|
if (!apply_string(key, data, &config->msg_inf_error_nick_multiple, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -600,6 +662,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*) ""))
|
if (!apply_string(key, data, &config->msg_inf_error_nick_invalid, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -610,6 +673,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*) ""))
|
if (!apply_string(key, data, &config->msg_inf_error_nick_long, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -620,6 +684,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*) ""))
|
if (!apply_string(key, data, &config->msg_inf_error_nick_short, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -630,6 +695,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*) ""))
|
if (!apply_string(key, data, &config->msg_inf_error_nick_spaces, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -640,6 +706,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*) ""))
|
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("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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -650,6 +717,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*) ""))
|
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("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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -660,6 +728,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*) ""))
|
if (!apply_string(key, data, &config->msg_inf_error_nick_taken, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -670,6 +739,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*) ""))
|
if (!apply_string(key, data, &config->msg_inf_error_nick_restricted, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -680,6 +750,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*) ""))
|
if (!apply_string(key, data, &config->msg_inf_error_cid_invalid, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -690,6 +761,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*) ""))
|
if (!apply_string(key, data, &config->msg_inf_error_cid_missing, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -700,6 +772,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*) ""))
|
if (!apply_string(key, data, &config->msg_inf_error_cid_taken, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -710,6 +783,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*) ""))
|
if (!apply_string(key, data, &config->msg_inf_error_pid_missing, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -720,6 +794,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*) ""))
|
if (!apply_string(key, data, &config->msg_inf_error_pid_invalid, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -730,6 +805,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*) ""))
|
if (!apply_string(key, data, &config->msg_ban_permanently, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"msg_ban_permanently\" (message), default=\"Banned permanently\"");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -740,6 +816,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*) ""))
|
if (!apply_string(key, data, &config->msg_ban_temporarily, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"msg_ban_temporarily\" (message), default=\"Banned temporarily\"");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -750,6 +827,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*) ""))
|
if (!apply_string(key, data, &config->msg_auth_invalid_password, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"msg_auth_invalid_password\" (message), default=\"Password is wrong\"");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -760,6 +838,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*) ""))
|
if (!apply_string(key, data, &config->msg_auth_user_not_found, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -770,6 +849,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*) ""))
|
if (!apply_string(key, data, &config->msg_error_no_memory, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"msg_error_no_memory\" (message), default=\"No memory\"");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -780,6 +860,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*) ""))
|
if (!apply_string(key, data, &config->msg_user_share_size_low, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -790,6 +871,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*) ""))
|
if (!apply_string(key, data, &config->msg_user_share_size_high, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -800,6 +882,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*) ""))
|
if (!apply_string(key, data, &config->msg_user_slots_low, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -810,6 +893,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*) ""))
|
if (!apply_string(key, data, &config->msg_user_slots_high, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -820,6 +904,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*) ""))
|
if (!apply_string(key, data, &config->msg_user_hub_limit_low, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -830,6 +915,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*) ""))
|
if (!apply_string(key, data, &config->msg_user_hub_limit_high, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -840,6 +926,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*) ""))
|
if (!apply_string(key, data, &config->msg_user_flood_chat, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -850,6 +937,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*) ""))
|
if (!apply_string(key, data, &config->msg_user_flood_connect, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -860,6 +948,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*) ""))
|
if (!apply_string(key, data, &config->msg_user_flood_search, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -870,6 +959,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*) ""))
|
if (!apply_string(key, data, &config->msg_user_flood_update, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"msg_user_flood_update\" (message), default=\"Update flood detected.\"");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -880,6 +970,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*) ""))
|
if (!apply_string(key, data, &config->msg_user_flood_extras, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
LOG_ERROR("Configuration parse error on line %d", line_count);
|
||||||
|
LOG_ERROR("\"msg_user_flood_extras\" (message), default=\"Flood detected.\"");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -890,6 +981,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*) ""))
|
if (!apply_string(key, data, &config->msg_proto_no_common_hash, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -900,6 +992,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*) ""))
|
if (!apply_string(key, data, &config->msg_proto_obsolete_adc0, (char*) ""))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Configuration parse error on line %d", line_count);
|
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 -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -922,6 +1015,8 @@ void free_config(struct hub_config* config)
|
|||||||
|
|
||||||
hub_free(config->redirect_addr);
|
hub_free(config->redirect_addr);
|
||||||
|
|
||||||
|
hub_free(config->tls_require_redirect_addr);
|
||||||
|
|
||||||
hub_free(config->tls_certificate);
|
hub_free(config->tls_certificate);
|
||||||
|
|
||||||
hub_free(config->tls_private_key);
|
hub_free(config->tls_private_key);
|
||||||
@@ -1128,6 +1223,9 @@ void dump_config(struct hub_config* config, int ignore_defaults)
|
|||||||
if (!ignore_defaults || config->tls_require != 0)
|
if (!ignore_defaults || config->tls_require != 0)
|
||||||
fprintf(stdout, "tls_require = %s\n", config->tls_require ? "yes" : "no");
|
fprintf(stdout, "tls_require = %s\n", config->tls_require ? "yes" : "no");
|
||||||
|
|
||||||
|
if (!ignore_defaults || strcmp(config->tls_require_redirect_addr, "") != 0)
|
||||||
|
fprintf(stdout, "tls_require_redirect_addr = \"%s\"\n", config->tls_require_redirect_addr);
|
||||||
|
|
||||||
if (!ignore_defaults || strcmp(config->tls_certificate, "") != 0)
|
if (!ignore_defaults || strcmp(config->tls_certificate, "") != 0)
|
||||||
fprintf(stdout, "tls_certificate = \"%s\"\n", config->tls_certificate);
|
fprintf(stdout, "tls_certificate = \"%s\"\n", config->tls_certificate);
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ struct hub_config
|
|||||||
int flood_ctl_extras; /*<<< Max extra messages allowed in time interval (default: 0) */
|
int flood_ctl_extras; /*<<< Max extra messages allowed in time interval (default: 0) */
|
||||||
int tls_enable; /*<<< Enable SSL/TLS support (default: 0) */
|
int tls_enable; /*<<< Enable SSL/TLS support (default: 0) */
|
||||||
int tls_require; /*<<< If SSL/TLS enabled, should it be required (default: 0) (default: 0) */
|
int tls_require; /*<<< If SSL/TLS enabled, should it be required (default: 0) (default: 0) */
|
||||||
|
char* tls_require_redirect_addr; /*<<< A redirect address in case a client connects using "adc://" when "adcs://" is required. (default: ) */
|
||||||
char* tls_certificate; /*<<< Certificate file (default: ) */
|
char* tls_certificate; /*<<< Certificate file (default: ) */
|
||||||
char* tls_private_key; /*<<< Private key file (default: ) */
|
char* tls_private_key; /*<<< Private key file (default: ) */
|
||||||
char* file_motd; /*<<< File containing the 'message of the day (default: ) */
|
char* file_motd; /*<<< File containing the 'message of the day (default: ) */
|
||||||
|
|||||||
@@ -257,9 +257,15 @@ int hub_handle_chat_message(struct hub_info* hub, struct hub_user* u, struct adc
|
|||||||
int relay = 1;
|
int relay = 1;
|
||||||
int offset;
|
int offset;
|
||||||
|
|
||||||
if (!message || !user_is_logged_in(u))
|
if (!message)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (!user_is_logged_in(u))
|
||||||
|
{
|
||||||
|
hub_free(message);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ((cmd->cache[0] == 'B') && (message[0] == '!' || message[0] == '+'))
|
if ((cmd->cache[0] == 'B') && (message[0] == '!' || message[0] == '+'))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@@ -480,12 +486,12 @@ void hub_send_flood_warning(struct hub_info* hub, struct hub_user* u, const char
|
|||||||
adc_msg_add_argument(msg, "110");
|
adc_msg_add_argument(msg, "110");
|
||||||
adc_msg_add_argument(msg, tmp);
|
adc_msg_add_argument(msg, tmp);
|
||||||
hub_free(tmp);
|
hub_free(tmp);
|
||||||
}
|
|
||||||
|
|
||||||
route_to_user(hub, u, msg);
|
route_to_user(hub, u, msg);
|
||||||
user_flag_set(u, flag_flood);
|
user_flag_set(u, flag_flood);
|
||||||
adc_msg_free(msg);
|
adc_msg_free(msg);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void hub_event_dispatcher(void* callback_data, struct event_data* message)
|
static void hub_event_dispatcher(void* callback_data, struct event_data* message)
|
||||||
{
|
{
|
||||||
@@ -656,6 +662,7 @@ static int load_ssl_certificates(struct hub_info* hub, struct hub_config* config
|
|||||||
|
|
||||||
/* Disable SSLv2 */
|
/* Disable SSLv2 */
|
||||||
SSL_CTX_set_options(hub->ssl_ctx, SSL_OP_NO_SSLv2);
|
SSL_CTX_set_options(hub->ssl_ctx, SSL_OP_NO_SSLv2);
|
||||||
|
SSL_CTX_set_quiet_shutdown(hub->ssl_ctx, 1);
|
||||||
|
|
||||||
if (SSL_CTX_use_certificate_file(hub->ssl_ctx, config->tls_certificate, SSL_FILETYPE_PEM) < 0)
|
if (SSL_CTX_use_certificate_file(hub->ssl_ctx, config->tls_certificate, SSL_FILETYPE_PEM) < 0)
|
||||||
{
|
{
|
||||||
@@ -785,7 +792,6 @@ void hub_shutdown_service(struct hub_info* hub)
|
|||||||
|
|
||||||
event_queue_shutdown(hub->queue);
|
event_queue_shutdown(hub->queue);
|
||||||
net_con_close(hub->server);
|
net_con_close(hub->server);
|
||||||
hub_free(hub->server);
|
|
||||||
server_alt_port_stop(hub);
|
server_alt_port_stop(hub);
|
||||||
uman_shutdown(hub);
|
uman_shutdown(hub);
|
||||||
hub->status = hub_status_stopped;
|
hub->status = hub_status_stopped;
|
||||||
@@ -944,7 +950,7 @@ void hub_send_status(struct hub_info* hub, struct hub_user* user, enum status_me
|
|||||||
struct adc_message* cmd = adc_msg_construct(ADC_CMD_ISTA, 6);
|
struct adc_message* cmd = adc_msg_construct(ADC_CMD_ISTA, 6);
|
||||||
struct adc_message* qui = adc_msg_construct(ADC_CMD_IQUI, 512);
|
struct adc_message* qui = adc_msg_construct(ADC_CMD_IQUI, 512);
|
||||||
char code[4];
|
char code[4];
|
||||||
char buf[250];
|
char buf[256];
|
||||||
const char* text = 0;
|
const char* text = 0;
|
||||||
const char* flag = 0;
|
const char* flag = 0;
|
||||||
char* escaped_text = 0;
|
char* escaped_text = 0;
|
||||||
|
|||||||
@@ -115,6 +115,11 @@ int main_loop()
|
|||||||
{
|
{
|
||||||
LOG_INFO("Reloading configuration files...");
|
LOG_INFO("Reloading configuration files...");
|
||||||
LOG_DEBUG("Hub status: %d", (int) hub->status);
|
LOG_DEBUG("Hub status: %d", (int) hub->status);
|
||||||
|
|
||||||
|
/* Reinitialize logs */
|
||||||
|
hub_log_shutdown();
|
||||||
|
hub_log_initialize(arg_log, arg_log_syslog);
|
||||||
|
hub_set_log_verbosity(arg_verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (read_config(arg_config, &configuration, !arg_have_config) == -1)
|
if (read_config(arg_config, &configuration, !arg_have_config) == -1)
|
||||||
|
|||||||
@@ -48,9 +48,19 @@ static void probe_net_event(struct net_connection* con, int events, void *arg)
|
|||||||
LOG_TRACE("Probed ADC");
|
LOG_TRACE("Probed ADC");
|
||||||
#ifdef SSL_SUPPORT
|
#ifdef SSL_SUPPORT
|
||||||
if (probe->hub->config->tls_enable && probe->hub->config->tls_require)
|
if (probe->hub->config->tls_enable && probe->hub->config->tls_require)
|
||||||
|
{
|
||||||
|
if (*probe->hub->config->tls_require_redirect_addr)
|
||||||
|
{
|
||||||
|
char buf[512];
|
||||||
|
ssize_t len = snprintf(buf, sizeof(buf), "ISUP " ADC_PROTO_SUPPORT "\nISID AAAB\nIINF NIRedirecting...\nIQUI AAAB RD%s\n", probe->hub->config->tls_require_redirect_addr);
|
||||||
|
net_con_send(con, buf, (size_t) len);
|
||||||
|
LOG_TRACE("Not TLS connection - Redirecting to %s.", probe->hub->config->tls_require_redirect_addr);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
LOG_TRACE("Not TLS connection - closing connection.");
|
LOG_TRACE("Not TLS connection - closing connection.");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if (user_create(probe->hub, probe->connection, &probe->addr))
|
if (user_create(probe->hub, probe->connection, &probe->addr))
|
||||||
@@ -60,9 +70,8 @@ static void probe_net_event(struct net_connection* con, int events, void *arg)
|
|||||||
probe_destroy(probe);
|
probe_destroy(probe);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SSL_SUPPORT
|
#ifdef SSL_SUPPORT
|
||||||
if (bytes >= 11 &&
|
else if (bytes >= 11 &&
|
||||||
probe_recvbuf[0] == 22 &&
|
probe_recvbuf[0] == 22 &&
|
||||||
probe_recvbuf[1] == 3 && /* protocol major version */
|
probe_recvbuf[1] == 3 && /* protocol major version */
|
||||||
probe_recvbuf[5] == 1 && /* message type */
|
probe_recvbuf[5] == 1 && /* message type */
|
||||||
@@ -92,9 +101,10 @@ static void probe_net_event(struct net_connection* con, int events, void *arg)
|
|||||||
net_con_ssl_handshake(con, net_con_ssl_mode_server, probe->hub->ssl_ctx);
|
net_con_ssl_handshake(con, net_con_ssl_mode_server, probe->hub->ssl_ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#else
|
||||||
probe_destroy(probe);
|
probe_destroy(probe);
|
||||||
return;
|
return;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -106,6 +116,8 @@ struct hub_probe* probe_create(struct hub_info* hub, int sd, struct ip_addr_enca
|
|||||||
if (probe == NULL)
|
if (probe == NULL)
|
||||||
return NULL; /* OOM */
|
return NULL; /* OOM */
|
||||||
|
|
||||||
|
LOG_TRACE("probe_create(): %p", probe);
|
||||||
|
|
||||||
probe->hub = hub;
|
probe->hub = hub;
|
||||||
probe->connection = net_con_create();
|
probe->connection = net_con_create();
|
||||||
net_con_initialize(probe->connection, sd, probe_net_event, probe, NET_EVENT_READ);
|
net_con_initialize(probe->connection, sd, probe_net_event, probe, NET_EVENT_READ);
|
||||||
@@ -117,6 +129,7 @@ struct hub_probe* probe_create(struct hub_info* hub, int sd, struct ip_addr_enca
|
|||||||
|
|
||||||
void probe_destroy(struct hub_probe* probe)
|
void probe_destroy(struct hub_probe* probe)
|
||||||
{
|
{
|
||||||
|
LOG_TRACE("probe_destroy(): %p (connection=%p)", probe, probe->connection);
|
||||||
if (probe->connection)
|
if (probe->connection)
|
||||||
{
|
{
|
||||||
net_con_close(probe->connection);
|
net_con_close(probe->connection);
|
||||||
|
|||||||
@@ -71,6 +71,12 @@ void user_destroy(struct hub_user* user)
|
|||||||
hub_recvq_destroy(user->recv_queue);
|
hub_recvq_destroy(user->recv_queue);
|
||||||
hub_sendq_destroy(user->send_queue);
|
hub_sendq_destroy(user->send_queue);
|
||||||
|
|
||||||
|
if (user->connection)
|
||||||
|
{
|
||||||
|
LOG_TRACE("user_destory() -> net_con_close(%p)", user->connection);
|
||||||
|
net_con_close(user->connection);
|
||||||
|
}
|
||||||
|
|
||||||
adc_msg_free(user->info);
|
adc_msg_free(user->info);
|
||||||
user_clear_feature_cast_support(user);
|
user_clear_feature_cast_support(user);
|
||||||
hub_free(user);
|
hub_free(user);
|
||||||
|
|||||||
109
src/includes.h
Normal file
109
src/includes.h
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
/*
|
||||||
|
* uhub - A tiny ADC p2p connection hub
|
||||||
|
* Copyright (C) 2007-2010, Jan Vidar Krey
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HAVE_UHUB_INCLUDES_H
|
||||||
|
#define HAVE_UHUB_INCLUDES_H
|
||||||
|
|
||||||
|
#define _FILE_OFFSET_BITS 64
|
||||||
|
|
||||||
|
#ifndef _GNU_SOURCE
|
||||||
|
# define _GNU_SOURCE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef WINSOCK
|
||||||
|
# include <winsock2.h>
|
||||||
|
# include <ws2tcpip.h>
|
||||||
|
#else
|
||||||
|
# include <sys/types.h>
|
||||||
|
# include <sys/time.h>
|
||||||
|
# include <arpa/inet.h>
|
||||||
|
# include <netdb.h>
|
||||||
|
# include <netinet/in.h>
|
||||||
|
# include <sys/ioctl.h>
|
||||||
|
# include <sys/socket.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
# include <assert.h>
|
||||||
|
# include <errno.h>
|
||||||
|
# include <fcntl.h>
|
||||||
|
|
||||||
|
#ifndef __sun__
|
||||||
|
# include <getopt.h>
|
||||||
|
# include <stdint.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#if !defined(WIN32)
|
||||||
|
# include <grp.h>
|
||||||
|
# include <pwd.h>
|
||||||
|
# include <sys/resource.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SSL_SUPPORT
|
||||||
|
# include <openssl/ssl.h>
|
||||||
|
# include <openssl/err.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
# define USE_EPOLL
|
||||||
|
# include <sys/epoll.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef BSD_LIKE
|
||||||
|
# define USE_KQUEUE
|
||||||
|
# include <sys/event.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define USE_SELECT
|
||||||
|
# ifndef WINSOCK
|
||||||
|
# include <sys/select.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(WIN32)
|
||||||
|
# define HAVE_STRNDUP
|
||||||
|
# define HAVE_GETRLIMIT
|
||||||
|
# if !defined(__HAIKU__)
|
||||||
|
# define HAVE_MEMMEM
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(BSD_LIKE) || defined(__sun__)
|
||||||
|
# undef HAVE_STRNDUP
|
||||||
|
# undef HAVE_MEMMEM
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(WIN32)
|
||||||
|
/* Windows uses %Iu for size_t */
|
||||||
|
#define PRINTF_SIZE_T "%Iu"
|
||||||
|
#else
|
||||||
|
/* NOTE: does not work for old versions of gcc (like 2.95) */
|
||||||
|
#define PRINTF_SIZE_T "%zu"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define uhub_assert assert
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* HAVE_UHUB_INCLUDES_H */
|
||||||
@@ -79,11 +79,8 @@ int net_backend_init()
|
|||||||
timeout_queue_initialize(&g_backend->timeout_queue, g_backend->now, 120); /* FIXME: max 120 secs! */
|
timeout_queue_initialize(&g_backend->timeout_queue, g_backend->now, 120); /* FIXME: max 120 secs! */
|
||||||
g_backend->cleaner = net_cleanup_initialize(g_backend->common.max);
|
g_backend->cleaner = net_cleanup_initialize(g_backend->common.max);
|
||||||
|
|
||||||
for (n = 0; n < sizeof(net_backend_init_funcs); n++)
|
for (n = 0; net_backend_init_funcs[n]; n++)
|
||||||
{
|
{
|
||||||
if (!net_backend_init_funcs[n])
|
|
||||||
break;
|
|
||||||
|
|
||||||
g_backend->data = net_backend_init_funcs[n](&g_backend->handler, &g_backend->common);
|
g_backend->data = net_backend_init_funcs[n](&g_backend->handler, &g_backend->common);
|
||||||
if (g_backend->data)
|
if (g_backend->data)
|
||||||
{
|
{
|
||||||
@@ -182,6 +179,14 @@ void net_con_close(struct net_connection* con)
|
|||||||
|
|
||||||
g_backend->handler.con_del(g_backend->data, con);
|
g_backend->handler.con_del(g_backend->data, con);
|
||||||
|
|
||||||
|
#ifdef SSL_SUPPORT
|
||||||
|
if (con->ssl)
|
||||||
|
{
|
||||||
|
SSL_shutdown(con->ssl);
|
||||||
|
SSL_clear(con->ssl);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
net_close(con->sd);
|
net_close(con->sd);
|
||||||
con->sd = -1;
|
con->sd = -1;
|
||||||
|
|
||||||
@@ -199,6 +204,7 @@ struct net_cleanup_handler* net_cleanup_initialize(size_t max)
|
|||||||
|
|
||||||
void net_cleanup_shutdown(struct net_cleanup_handler* handler)
|
void net_cleanup_shutdown(struct net_cleanup_handler* handler)
|
||||||
{
|
{
|
||||||
|
net_cleanup_process(handler);
|
||||||
hub_free(handler->queue);
|
hub_free(handler->queue);
|
||||||
hub_free(handler);
|
hub_free(handler);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ ssize_t net_con_send(struct net_connection* con, const void* buf, size_t len)
|
|||||||
LOG_PROTO("SSL_write(con=%p, buf=%p, len=" PRINTF_SIZE_T ") => %d", con, buf, len, ret);
|
LOG_PROTO("SSL_write(con=%p, buf=%p, len=" PRINTF_SIZE_T ") => %d", con, buf, len, ret);
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
{
|
{
|
||||||
return -handle_openssl_error(con, ret);
|
return handle_openssl_error(con, ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -201,7 +201,7 @@ ssize_t net_con_recv(struct net_connection* con, void* buf, size_t len)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return -handle_openssl_error(con, ret);
|
return handle_openssl_error(con, ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -251,6 +251,9 @@ void* net_con_get_ptr(struct net_connection* con)
|
|||||||
|
|
||||||
void net_con_destroy(struct net_connection* con)
|
void net_con_destroy(struct net_connection* con)
|
||||||
{
|
{
|
||||||
|
#ifdef SSL_SUPPORT
|
||||||
|
SSL_free(con->ssl);
|
||||||
|
#endif
|
||||||
hub_free(con);
|
hub_free(con);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,19 +32,29 @@ struct net_connection_kqueue
|
|||||||
NET_CON_STRUCT_COMMON
|
NET_CON_STRUCT_COMMON
|
||||||
struct kevent ev_r;
|
struct kevent ev_r;
|
||||||
struct kevent ev_w;
|
struct kevent ev_w;
|
||||||
|
int change;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct net_backend_kqueue
|
struct net_backend_kqueue
|
||||||
{
|
{
|
||||||
int kqfd;
|
int kqfd;
|
||||||
struct net_connection_kqueue** conns;
|
struct net_connection_kqueue** conns;
|
||||||
struct kevent** changes;
|
struct kevent* changes;
|
||||||
size_t nchanges;
|
int* change_list;
|
||||||
|
size_t change_list_len;
|
||||||
struct kevent events[KQUEUE_EVBUFFER];
|
struct kevent events[KQUEUE_EVBUFFER];
|
||||||
struct net_backend_common* common;
|
struct net_backend_common* common;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define CHANGE_ACTION_ADD 0x0001
|
||||||
|
#define CHANGE_ACTION_MOD 0x0002
|
||||||
|
#define CHANGE_ACTION_DEL 0x0004
|
||||||
|
#define CHANGE_OP_WANT_READ 0x0100
|
||||||
|
#define CHANGE_OP_WANT_WRITE 0x0200
|
||||||
|
|
||||||
static void net_backend_set_handlers(struct net_backend_handler* handler);
|
static void net_backend_set_handlers(struct net_backend_handler* handler);
|
||||||
|
static void add_change(struct net_backend_kqueue* backend, struct net_connection_kqueue* con, int actions);
|
||||||
|
static size_t create_change_list(struct net_backend_kqueue* backend);
|
||||||
|
|
||||||
const char* net_backend_name_kqueue()
|
const char* net_backend_name_kqueue()
|
||||||
{
|
{
|
||||||
@@ -56,12 +66,13 @@ int net_backend_poll_kqueue(struct net_backend* data, int ms)
|
|||||||
int res;
|
int res;
|
||||||
struct timespec tspec = { 0, };
|
struct timespec tspec = { 0, };
|
||||||
struct net_backend_kqueue* backend = (struct net_backend_kqueue*) data;
|
struct net_backend_kqueue* backend = (struct net_backend_kqueue*) data;
|
||||||
|
size_t changes;
|
||||||
|
|
||||||
tspec.tv_sec = (ms / 1000);
|
tspec.tv_sec = (ms / 1000);
|
||||||
tspec.tv_nsec = ((ms % 1000) * 1000000);
|
tspec.tv_nsec = ((ms % 1000) * 1000000);
|
||||||
|
|
||||||
res = kevent(backend->kqfd, *backend->changes, backend->nchanges, backend->events, KQUEUE_EVBUFFER, &tspec);
|
changes = create_change_list(backend);
|
||||||
backend->nchanges = 0;
|
res = kevent(backend->kqfd, backend->changes, changes, backend->events, KQUEUE_EVBUFFER, &tspec);
|
||||||
|
|
||||||
if (res == -1 && errno == EINTR)
|
if (res == -1 && errno == EINTR)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -76,13 +87,15 @@ void net_backend_process_kqueue(struct net_backend* data, int res)
|
|||||||
for (n = 0; n < res; n++)
|
for (n = 0; n < res; n++)
|
||||||
{
|
{
|
||||||
struct net_connection_kqueue* con = (struct net_connection_kqueue*) backend->events[n].udata;
|
struct net_connection_kqueue* con = (struct net_connection_kqueue*) backend->events[n].udata;
|
||||||
int ev = -1;
|
if (con && con->sd >= 0 && backend->conns[con->sd])
|
||||||
|
{
|
||||||
|
int ev = 0;
|
||||||
if (backend->events[n].filter == EVFILT_READ) ev = NET_EVENT_READ;
|
if (backend->events[n].filter == EVFILT_READ) ev = NET_EVENT_READ;
|
||||||
else if (backend->events[n].filter == EVFILT_WRITE) ev = NET_EVENT_WRITE;
|
else if (backend->events[n].filter == EVFILT_WRITE) ev = NET_EVENT_WRITE;
|
||||||
if (con)
|
|
||||||
net_con_callback((struct net_connection*) con, ev);
|
net_con_callback((struct net_connection*) con, ev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct net_connection* net_con_create_kqueue(struct net_backend* data)
|
struct net_connection* net_con_create_kqueue(struct net_backend* data)
|
||||||
{
|
{
|
||||||
@@ -102,58 +115,37 @@ void net_con_initialize_kqueue(struct net_backend* data, struct net_connection*
|
|||||||
|
|
||||||
void net_con_backend_add_kqueue(struct net_backend* data, struct net_connection* con_, int events)
|
void net_con_backend_add_kqueue(struct net_backend* data, struct net_connection* con_, int events)
|
||||||
{
|
{
|
||||||
unsigned short flags_r = EV_ADD;
|
|
||||||
unsigned short flags_w = EV_ADD;
|
|
||||||
struct net_backend_kqueue* backend = (struct net_backend_kqueue*) data;
|
struct net_backend_kqueue* backend = (struct net_backend_kqueue*) data;
|
||||||
struct net_connection_kqueue* con = (struct net_connection_kqueue*) con_;
|
struct net_connection_kqueue* con = (struct net_connection_kqueue*) con_;
|
||||||
|
int operation;
|
||||||
|
|
||||||
backend->conns[con->sd] = con;
|
backend->conns[con->sd] = con;
|
||||||
|
|
||||||
if (events & NET_EVENT_READ)
|
operation = CHANGE_ACTION_ADD;
|
||||||
flags_r |= EV_ENABLE;
|
|
||||||
else
|
|
||||||
flags_r |= EV_DISABLE;
|
|
||||||
|
|
||||||
EV_SET(&con->ev_r, con->sd, EVFILT_READ, flags_r, 0, 0, con);
|
if (events & NET_EVENT_READ)
|
||||||
backend->changes[backend->nchanges++] = &con->ev_r;
|
operation |= CHANGE_OP_WANT_READ;
|
||||||
|
|
||||||
if (events & NET_EVENT_WRITE)
|
if (events & NET_EVENT_WRITE)
|
||||||
flags_w |= EV_ENABLE;
|
operation |= CHANGE_OP_WANT_WRITE;
|
||||||
else
|
|
||||||
flags_w |= EV_DISABLE;
|
|
||||||
|
|
||||||
EV_SET(&con->ev_w, con->sd, EVFILT_WRITE, flags_w, 0, 0, con);
|
add_change(backend, con, operation);
|
||||||
backend->changes[backend->nchanges++] = &con->ev_w;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void net_con_backend_mod_kqueue(struct net_backend* data, struct net_connection* con_, int events)
|
void net_con_backend_mod_kqueue(struct net_backend* data, struct net_connection* con_, int events)
|
||||||
{
|
{
|
||||||
unsigned short flags_r = 0;
|
|
||||||
unsigned short flags_w = 0;
|
|
||||||
struct net_backend_kqueue* backend = (struct net_backend_kqueue*) data;
|
struct net_backend_kqueue* backend = (struct net_backend_kqueue*) data;
|
||||||
struct net_connection_kqueue* con = (struct net_connection_kqueue*) con_;
|
struct net_connection_kqueue* con = (struct net_connection_kqueue*) con_;
|
||||||
|
|
||||||
if (events & NET_EVENT_READ)
|
int operation = CHANGE_ACTION_ADD;
|
||||||
flags_r |= EV_ENABLE;
|
|
||||||
else
|
|
||||||
flags_r |= EV_DISABLE;
|
|
||||||
|
|
||||||
if (!(con->ev_r.flags & flags_r))
|
if (events & NET_EVENT_READ)
|
||||||
{
|
operation |= CHANGE_OP_WANT_READ;
|
||||||
EV_SET(&con->ev_r, con->sd, EVFILT_READ, flags_r, 0, 0, con);
|
|
||||||
backend->changes[backend->nchanges++] = &con->ev_r;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (events & NET_EVENT_WRITE)
|
if (events & NET_EVENT_WRITE)
|
||||||
flags_r |= EV_ENABLE;
|
operation |= CHANGE_OP_WANT_WRITE;
|
||||||
else
|
|
||||||
flags_r |= EV_DISABLE;
|
|
||||||
|
|
||||||
if (!(con->ev_w.flags & flags_w))
|
add_change(backend, con, operation);
|
||||||
{
|
|
||||||
EV_SET(&con->ev_w, con->sd, EVFILT_WRITE, flags_w, 0, 0, con);
|
|
||||||
backend->changes[backend->nchanges++] = &con->ev_w;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void net_con_backend_del_kqueue(struct net_backend* data, struct net_connection* con_)
|
void net_con_backend_del_kqueue(struct net_backend* data, struct net_connection* con_)
|
||||||
@@ -162,11 +154,8 @@ void net_con_backend_del_kqueue(struct net_backend* data, struct net_connection*
|
|||||||
struct net_connection_kqueue* con = (struct net_connection_kqueue*) con_;
|
struct net_connection_kqueue* con = (struct net_connection_kqueue*) con_;
|
||||||
|
|
||||||
/* No need to remove it from the kqueue filter, the kqueue man page says
|
/* No need to remove it from the kqueue filter, the kqueue man page says
|
||||||
it is automatically removed when the descriptor is closed. */
|
it is automatically removed when the descriptor is closed... */
|
||||||
EV_SET(&con->ev_r, con->sd, EVFILT_READ, EV_DELETE, 0, 0, 0);
|
add_change(backend, con, CHANGE_ACTION_DEL);
|
||||||
backend->changes[backend->nchanges++] = &con->ev_r;
|
|
||||||
EV_SET(&con->ev_w, con->sd, EVFILT_WRITE, EV_DELETE, 0, 0, 0);
|
|
||||||
backend->changes[backend->nchanges++] = &con->ev_w;
|
|
||||||
|
|
||||||
// Unmap the socket descriptor.
|
// Unmap the socket descriptor.
|
||||||
backend->conns[con->sd] = 0;
|
backend->conns[con->sd] = 0;
|
||||||
@@ -178,6 +167,7 @@ void net_backend_shutdown_kqueue(struct net_backend* data)
|
|||||||
close(backend->kqfd);
|
close(backend->kqfd);
|
||||||
hub_free(backend->conns);
|
hub_free(backend->conns);
|
||||||
hub_free(backend->changes);
|
hub_free(backend->changes);
|
||||||
|
hub_free(backend->change_list);
|
||||||
hub_free(backend);
|
hub_free(backend);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,8 +187,8 @@ struct net_backend* net_backend_init_kqueue(struct net_backend_handler* handler,
|
|||||||
}
|
}
|
||||||
|
|
||||||
backend->conns = hub_malloc_zero(sizeof(struct net_connection_kqueue*) * common->max);
|
backend->conns = hub_malloc_zero(sizeof(struct net_connection_kqueue*) * common->max);
|
||||||
backend->conns = hub_malloc_zero(sizeof(struct net_connection_kqueue*) * common->max);
|
backend->changes = hub_malloc_zero(sizeof(struct kevent) * common->max * 2);
|
||||||
backend->changes = hub_malloc_zero(sizeof(struct kevent*) * common->max * 2);
|
backend->change_list = hub_malloc_zero(sizeof(int) * common->max);
|
||||||
backend->common = common;
|
backend->common = common;
|
||||||
|
|
||||||
net_backend_set_handlers(handler);
|
net_backend_set_handlers(handler);
|
||||||
@@ -218,4 +208,71 @@ static void net_backend_set_handlers(struct net_backend_handler* handler)
|
|||||||
handler->con_del = net_con_backend_del_kqueue;
|
handler->con_del = net_con_backend_del_kqueue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void add_change(struct net_backend_kqueue* backend, struct net_connection_kqueue* con, int actions)
|
||||||
|
{
|
||||||
|
if (actions && !con->change)
|
||||||
|
{
|
||||||
|
backend->change_list[backend->change_list_len++] = con->sd;
|
||||||
|
con->change = actions;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static size_t create_change_list(struct net_backend_kqueue* backend)
|
||||||
|
{
|
||||||
|
size_t n = 0;
|
||||||
|
size_t changes = 0;
|
||||||
|
int sd;
|
||||||
|
struct net_connection_kqueue* con;
|
||||||
|
unsigned short flags_r = 0;
|
||||||
|
unsigned short flags_w = 0;
|
||||||
|
|
||||||
|
for (; n < backend->change_list_len; n++)
|
||||||
|
{
|
||||||
|
sd = backend->change_list[n];
|
||||||
|
con = backend->conns[sd];
|
||||||
|
if (con)
|
||||||
|
{
|
||||||
|
flags_r = 0;
|
||||||
|
flags_w = 0;
|
||||||
|
|
||||||
|
if (con->change & CHANGE_ACTION_ADD)
|
||||||
|
{
|
||||||
|
flags_r |= EV_ADD;
|
||||||
|
flags_w |= EV_ADD;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (con->change & CHANGE_OP_WANT_READ)
|
||||||
|
flags_r |= EV_ENABLE;
|
||||||
|
else
|
||||||
|
flags_r |= EV_DISABLE;
|
||||||
|
|
||||||
|
if (con->change & CHANGE_OP_WANT_WRITE)
|
||||||
|
flags_w |= EV_ENABLE;
|
||||||
|
else
|
||||||
|
flags_w |= EV_DISABLE;
|
||||||
|
|
||||||
|
if (con->ev_r.flags != flags_r)
|
||||||
|
{
|
||||||
|
EV_SET(&con->ev_r, sd, EVFILT_READ, flags_r, 0, 0, con);
|
||||||
|
memcpy(&backend->changes[changes++], &con->ev_r, sizeof(struct kevent));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (con->ev_w.flags != flags_w)
|
||||||
|
{
|
||||||
|
EV_SET(&con->ev_w, sd, EVFILT_WRITE, flags_w, 0, 0, con);
|
||||||
|
memcpy(&backend->changes[changes++], &con->ev_w, sizeof(struct kevent));
|
||||||
|
}
|
||||||
|
|
||||||
|
con->change = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EV_SET(&backend->changes[changes++], sd, EVFILT_READ, EV_DELETE, 0, 0, 0);
|
||||||
|
EV_SET(&backend->changes[changes++], sd, EVFILT_READ, EV_DELETE, 0, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
backend->change_list_len = 0;
|
||||||
|
return changes;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* USE_KQUEUE */
|
#endif /* USE_KQUEUE */
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ int net_initialize()
|
|||||||
LOG_TRACE("Initializing OpenSSL...");
|
LOG_TRACE("Initializing OpenSSL...");
|
||||||
SSL_library_init();
|
SSL_library_init();
|
||||||
SSL_load_error_strings();
|
SSL_load_error_strings();
|
||||||
OpenSSL_add_all_algorithms();
|
|
||||||
#endif /* SSL_SUPPORT */
|
#endif /* SSL_SUPPORT */
|
||||||
|
|
||||||
net_initialized = 1;
|
net_initialized = 1;
|
||||||
@@ -100,7 +99,9 @@ int net_destroy()
|
|||||||
net_backend_shutdown();
|
net_backend_shutdown();
|
||||||
|
|
||||||
#ifdef SSL_SUPPORT
|
#ifdef SSL_SUPPORT
|
||||||
/* FIXME: Shutdown OpenSSL here. */
|
ERR_free_strings();
|
||||||
|
EVP_cleanup();
|
||||||
|
CRYPTO_cleanup_all_ex_data();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WINSOCK
|
#ifdef WINSOCK
|
||||||
|
|||||||
110
src/system.h
110
src/system.h
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* uhub - A tiny ADC p2p connection hub
|
* uhub - A tiny ADC p2p connection hub
|
||||||
* Copyright (C) 2007-2009, Jan Vidar Krey
|
* Copyright (C) 2007-2010, Jan Vidar Krey
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -20,30 +20,6 @@
|
|||||||
#ifndef HAVE_UHUB_SYSTEM_H
|
#ifndef HAVE_UHUB_SYSTEM_H
|
||||||
#define HAVE_UHUB_SYSTEM_H
|
#define HAVE_UHUB_SYSTEM_H
|
||||||
|
|
||||||
#define _FILE_OFFSET_BITS 64
|
|
||||||
|
|
||||||
#if USE_REGPARM && __GNUC__ >= 3
|
|
||||||
#define REGPRM1 __attribute__((regparm(1)))
|
|
||||||
#define REGPRM2 __attribute__((regparm(2)))
|
|
||||||
#define REGPRM3 __attribute__((regparm(3)))
|
|
||||||
#else
|
|
||||||
#define REGPRM1
|
|
||||||
#define REGPRM2
|
|
||||||
#define REGPRM3
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef FORCEINLINE
|
|
||||||
#if __GNUC__ < 3
|
|
||||||
#define FORCEINLINE inline
|
|
||||||
#else
|
|
||||||
#define FORCEINLINE inline __attribute__((always_inline))
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _GNU_SOURCE
|
|
||||||
#define _GNU_SOURCE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || (defined(__APPLE__) && defined(__MACH__))
|
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || (defined(__APPLE__) && defined(__MACH__))
|
||||||
# define BSD_LIKE
|
# define BSD_LIKE
|
||||||
#endif
|
#endif
|
||||||
@@ -54,85 +30,6 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WINSOCK
|
|
||||||
#include <winsock2.h>
|
|
||||||
#include <ws2tcpip.h>
|
|
||||||
#else
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <netdb.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
|
|
||||||
#ifndef __sun__
|
|
||||||
#include <getopt.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <signal.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <time.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#if !defined(WIN32)
|
|
||||||
#include <grp.h>
|
|
||||||
#include <pwd.h>
|
|
||||||
#include <sys/resource.h>
|
|
||||||
#define HAVE_STRNDUP
|
|
||||||
#ifndef __HAIKU__
|
|
||||||
#define HAVE_MEMMEM
|
|
||||||
#endif
|
|
||||||
#define HAVE_GETRLIMIT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* printf and size_t support */
|
|
||||||
#if defined(WIN32)
|
|
||||||
/* Windows uses %Iu for size_t */
|
|
||||||
#define PRINTF_SIZE_T "%Iu"
|
|
||||||
#else
|
|
||||||
#define PRINTF_SIZE_T "%zu"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SSL_SUPPORT
|
|
||||||
#include <openssl/ssl.h>
|
|
||||||
#include <openssl/err.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "../version.h"
|
|
||||||
|
|
||||||
#define uhub_assert assert
|
|
||||||
|
|
||||||
#ifdef __linux__
|
|
||||||
#define USE_EPOLL
|
|
||||||
#include <sys/epoll.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef BSD_LIKE
|
|
||||||
#define USE_KQUEUE
|
|
||||||
#include <sys/event.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define USE_SELECT
|
|
||||||
#ifndef WINSOCK
|
|
||||||
#include <sys/select.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(BSD_LIKE) || defined(__sun__)
|
|
||||||
#undef HAVE_STRNDUP
|
|
||||||
#undef HAVE_MEMMEM
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Detect operating system info.
|
* Detect operating system info.
|
||||||
* See: http://predef.sourceforge.net/
|
* See: http://predef.sourceforge.net/
|
||||||
@@ -218,6 +115,11 @@
|
|||||||
# define CPUINFO "SuperH"
|
# define CPUINFO "SuperH"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* System includes */
|
||||||
|
#include "includes.h"
|
||||||
|
#include "../version.h"
|
||||||
|
|
||||||
|
|
||||||
/* Misc */
|
/* Misc */
|
||||||
#ifdef MSG_NOSIGNAL
|
#ifdef MSG_NOSIGNAL
|
||||||
# define UHUB_SEND_SIGNAL MSG_NOSIGNAL
|
# define UHUB_SEND_SIGNAL MSG_NOSIGNAL
|
||||||
|
|||||||
@@ -400,3 +400,72 @@ const char* get_timestamp(time_t now)
|
|||||||
sprintf(ts, "[%02d:%02d]", t->tm_hour, t->tm_min);
|
sprintf(ts, "[%02d:%02d]", t->tm_hour, t->tm_min);
|
||||||
return ts;
|
return ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void strip_off_ini_line_comments(char* line, int line_count)
|
||||||
|
{
|
||||||
|
char* p = line;
|
||||||
|
char* out = line;
|
||||||
|
int backslash = 0;
|
||||||
|
|
||||||
|
if (!*line)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (; *p; p++)
|
||||||
|
{
|
||||||
|
if (!backslash)
|
||||||
|
{
|
||||||
|
if (*p == '\\')
|
||||||
|
{
|
||||||
|
backslash = 1;
|
||||||
|
}
|
||||||
|
else if (*p == '#')
|
||||||
|
{
|
||||||
|
*out = '\0';
|
||||||
|
out++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*out = *p;
|
||||||
|
out++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (*p == '\\' || *p == '#' || *p == '\"')
|
||||||
|
{
|
||||||
|
*out = *p;
|
||||||
|
out++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG_WARN("Invalid backslash escape on line %d", line_count);
|
||||||
|
*out = *p;
|
||||||
|
out++;
|
||||||
|
}
|
||||||
|
backslash = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*out = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
char* strip_off_quotes(char* line)
|
||||||
|
{
|
||||||
|
size_t len;
|
||||||
|
|
||||||
|
if (!*line)
|
||||||
|
return line;
|
||||||
|
|
||||||
|
len = strlen(line);
|
||||||
|
if (len < 2)
|
||||||
|
return line;
|
||||||
|
|
||||||
|
if ((line[0] == '"' && line[len - 1] == '"') ||
|
||||||
|
(line[0] == '\'' && line[len - 1] == '\''))
|
||||||
|
{
|
||||||
|
line[len-1] = '\0';
|
||||||
|
return line + 1;
|
||||||
|
}
|
||||||
|
return line;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,10 +33,13 @@ extern int is_valid_base32_char(char c);
|
|||||||
extern void base32_encode(const unsigned char* buffer, size_t len, char* result);
|
extern void base32_encode(const unsigned char* buffer, size_t len, char* result);
|
||||||
extern void base32_decode(const char* src, unsigned char* dst, size_t len);
|
extern void base32_decode(const char* src, unsigned char* dst, size_t len);
|
||||||
extern char* strip_white_space(char* string);
|
extern char* strip_white_space(char* string);
|
||||||
|
extern void strip_off_ini_line_comments(char* line, int line_count);
|
||||||
|
extern char* strip_off_quotes(char* line);
|
||||||
|
|
||||||
extern int file_read_lines(const char* file, void* data, file_line_handler_t handler);
|
extern int file_read_lines(const char* file, void* data, file_line_handler_t handler);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern const char* uhub_itoa(int val);
|
extern const char* uhub_itoa(int val);
|
||||||
extern const char* uhub_ulltoa(uint64_t val);
|
extern const char* uhub_ulltoa(uint64_t val);
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef VERSION
|
#ifndef VERSION
|
||||||
#define VERSION "0.3.1"
|
#define VERSION "0.3.3"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef GIT_REVISION
|
#ifndef GIT_REVISION
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
#else
|
#else
|
||||||
#define REVISION "(git: " GIT_REVISION ")"
|
#define REVISION "(git: " GIT_REVISION ")"
|
||||||
#ifdef GIT_VERSION
|
#ifdef GIT_VERSION
|
||||||
#define PRODUCT_STRING PRODUCT "/" GIT_VERSION
|
#define PRODUCT_STRING PRODUCT "/" VERSION " (" GIT_VERSION ")"
|
||||||
#else
|
#else
|
||||||
#define PRODUCT_STRING PRODUCT "/" VERSION " " REVISION
|
#define PRODUCT_STRING PRODUCT "/" VERSION " " REVISION
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user