projects
/
silc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
464ead5
)
Added channel_join_limit, default is 50.
author
Pekka Riikonen
<priikone@silcnet.org>
Mon, 2 May 2005 08:50:28 +0000
(08:50 +0000)
committer
Pekka Riikonen
<priikone@silcnet.org>
Mon, 2 May 2005 08:50:28 +0000
(08:50 +0000)
CHANGES
patch
|
blob
|
history
apps/silcd/command.c
patch
|
blob
|
history
apps/silcd/server.h
patch
|
blob
|
history
apps/silcd/serverconfig.c
patch
|
blob
|
history
apps/silcd/serverconfig.h
patch
|
blob
|
history
diff --git
a/CHANGES
b/CHANGES
index cb4b36e974eed9b04dc47ec1b0cb5add574e926a..0279f209b29fd91542ef1b286e9d1f348ec64d53 100644
(file)
--- a/
CHANGES
+++ b/
CHANGES
@@
-1,3
+1,10
@@
+Mon May 2 10:42:49 EEST 2005 Pekka Riikonen <priikone@silcnet.org>
+
+ * Added default limit how many channels client can join,
+ default is 50. Added 'channel_join_limit' configuration
+ option to server too. Affected files are apps/silcd/command.c
+ and serverconfig.[ch].
+
Sun May 1 17:42:55 EEST 2005 Pekka Riikonen <priikone@silcnet.org>
* --without-silc -> --with-silc, --without-irssi -> --with-irssi.
Sun May 1 17:42:55 EEST 2005 Pekka Riikonen <priikone@silcnet.org>
* --without-silc -> --with-silc, --without-irssi -> --with-irssi.
diff --git
a/apps/silcd/command.c
b/apps/silcd/command.c
index 927e14ccdb2200a9a02cf346df04b180c5256499..aab262247d44b2f90e2387d8c82823f6e63d8aa0 100644
(file)
--- a/
apps/silcd/command.c
+++ b/
apps/silcd/command.c
@@
-2417,6
+2417,17
@@
SILC_SERVER_CMD_FUNC(join)
goto out;
}
goto out;
}
+#ifndef SILC_DIST_INPLACE
+ /* Limit how many channels client can join */
+ if (entry->channels && silc_hash_table_count(entry->channels) >=
+ server->config->param.chlimit) {
+ silc_server_command_send_status_reply(cmd, SILC_COMMAND_JOIN,
+ SILC_STATUS_ERR_RESOURCE_LIMIT,
+ 0);
+ goto out;
+ }
+#endif /* SILC_DIST_INPLACE */
+
silc_free(client_id);
client_id = silc_id_dup(entry->id, SILC_ID_CLIENT);
silc_free(client_id);
client_id = silc_id_dup(entry->id, SILC_ID_CLIENT);
diff --git
a/apps/silcd/server.h
b/apps/silcd/server.h
index 55e5f1fc0f0e6e708d08b1c97f4a3faaaf9b7c78..07f5d63d24b468694a8046e1cfe692528404a4b5 100644
(file)
--- a/
apps/silcd/server.h
+++ b/
apps/silcd/server.h
@@
-86,6
+86,7
@@
typedef struct {
#define SILC_SERVER_QOS_BYTES_LIMIT 2048 /* Default QoS bytes limit */
#define SILC_SERVER_QOS_LIMIT_SEC 0 /* Default QoS limit sec */
#define SILC_SERVER_QOS_LIMIT_USEC 500000 /* Default QoS limit usec */
#define SILC_SERVER_QOS_BYTES_LIMIT 2048 /* Default QoS bytes limit */
#define SILC_SERVER_QOS_LIMIT_SEC 0 /* Default QoS limit sec */
#define SILC_SERVER_QOS_LIMIT_USEC 500000 /* Default QoS limit usec */
+#define SILC_SERVER_CH_JOIN_LIMIT 50 /* Default join limit */
/* Macros */
/* Macros */
diff --git
a/apps/silcd/serverconfig.c
b/apps/silcd/serverconfig.c
index 545a39ffc91396eeba5d85e8cd2fbdffbbfc9432..133b576ae6e6e3acf97e97c6e68938dc938ff4f0 100644
(file)
--- a/
apps/silcd/serverconfig.c
+++ b/
apps/silcd/serverconfig.c
@@
-4,12
+4,11
@@
Author: Giovanni Giacobbi <giovanni@giacobbi.net>
Author: Giovanni Giacobbi <giovanni@giacobbi.net>
- Copyright (C) 1997 - 200
4
Pekka Riikonen
+ Copyright (C) 1997 - 200
5
Pekka Riikonen
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
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 2 of the License, or
- (at your option) any later version.
+ the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@@
-97,6
+96,7
@@
my_set_param_defaults(SilcServerConfigConnParams *params,
SET_PARAM_DEFAULT(qos_bytes_limit, SILC_SERVER_QOS_BYTES_LIMIT);
SET_PARAM_DEFAULT(qos_limit_sec, SILC_SERVER_QOS_LIMIT_SEC);
SET_PARAM_DEFAULT(qos_limit_usec, SILC_SERVER_QOS_LIMIT_USEC);
SET_PARAM_DEFAULT(qos_bytes_limit, SILC_SERVER_QOS_BYTES_LIMIT);
SET_PARAM_DEFAULT(qos_limit_sec, SILC_SERVER_QOS_LIMIT_SEC);
SET_PARAM_DEFAULT(qos_limit_usec, SILC_SERVER_QOS_LIMIT_USEC);
+ SET_PARAM_DEFAULT(chlimit, SILC_SERVER_CH_JOIN_LIMIT);
#undef SET_PARAM_DEFAULT
}
#undef SET_PARAM_DEFAULT
}
@@
-305,6
+305,9
@@
SILC_CONFIG_CALLBACK(fetch_generic)
else if (!strcmp(name, "qos_limit_usec")) {
config->param.qos_limit_usec = *(SilcUInt32 *)val;
}
else if (!strcmp(name, "qos_limit_usec")) {
config->param.qos_limit_usec = *(SilcUInt32 *)val;
}
+ else if (!strcmp(name, "channel_join_limit")) {
+ config->param.chlimit = *(SilcUInt32 *)val;
+ }
else if (!strcmp(name, "debug_string")) {
CONFIG_IS_DOUBLE(config->debug_string);
config->debug_string = (*(char *)val ? strdup((char *) val) : NULL);
else if (!strcmp(name, "debug_string")) {
CONFIG_IS_DOUBLE(config->debug_string);
config->debug_string = (*(char *)val ? strdup((char *) val) : NULL);
@@
-1168,6
+1171,7
@@
static const SilcConfigTable table_general[] = {
{ "qos_bytes_limit", SILC_CONFIG_ARG_INT, fetch_generic, NULL },
{ "qos_limit_sec", SILC_CONFIG_ARG_INT, fetch_generic, NULL },
{ "qos_limit_usec", SILC_CONFIG_ARG_INT, fetch_generic, NULL },
{ "qos_bytes_limit", SILC_CONFIG_ARG_INT, fetch_generic, NULL },
{ "qos_limit_sec", SILC_CONFIG_ARG_INT, fetch_generic, NULL },
{ "qos_limit_usec", SILC_CONFIG_ARG_INT, fetch_generic, NULL },
+ { "channel_join_limit", SILC_CONFIG_ARG_INT, fetch_generic, NULL },
{ "debug_string", SILC_CONFIG_ARG_STR, fetch_generic, NULL },
{ 0, 0, 0, 0 }
};
{ "debug_string", SILC_CONFIG_ARG_STR, fetch_generic, NULL },
{ 0, 0, 0, 0 }
};
diff --git
a/apps/silcd/serverconfig.h
b/apps/silcd/serverconfig.h
index 2104976ed3e87275c5c485ab67a941d792cd930f..cc1ecb21bcd8268309cf3d7c4627bb4736348140 100644
(file)
--- a/
apps/silcd/serverconfig.h
+++ b/
apps/silcd/serverconfig.h
@@
-4,12
+4,11
@@
Author: Giovanni Giacobbi <giovanni@giacobbi.net>
Author: Giovanni Giacobbi <giovanni@giacobbi.net>
- Copyright (C) 1997 - 200
2
Pekka Riikonen
+ Copyright (C) 1997 - 200
5
Pekka Riikonen
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
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 2 of the License, or
- (at your option) any later version.
+ the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@@
-94,6
+93,7
@@
typedef struct SilcServerConfigConnParams {
SilcUInt32 qos_bytes_limit;
SilcUInt32 qos_limit_sec;
SilcUInt32 qos_limit_usec;
SilcUInt32 qos_bytes_limit;
SilcUInt32 qos_limit_sec;
SilcUInt32 qos_limit_usec;
+ SilcUInt32 chlimit;
unsigned int key_exchange_pfs : 1;
unsigned int reconnect_keep_trying : 1;
unsigned int anonymous : 1;
unsigned int key_exchange_pfs : 1;
unsigned int reconnect_keep_trying : 1;
unsigned int anonymous : 1;