[srvx-commits] CVS: services/src opserv.c,1.247,1.248
Brought to you by:
entrope
|
From: Zoot <zo...@us...> - 2002-07-25 17:40:16
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv30244a/src
Modified Files:
opserv.c
Log Message:
Forward port the join flood countermeasures and gtrace ungline fix from 1.1.x.
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.247
retrieving revision 1.248
diff -C2 -r1.247 -r1.248
*** opserv.c 12 Jul 2002 17:05:55 -0000 1.247
--- opserv.c 25 Jul 2002 17:40:12 -0000 1.248
***************
*** 71,74 ****
--- 71,75 ----
#define KEY_UNTRUSTED_MAX "untrusted_max"
#define KEY_PURGE_LOCK_DELAY "purge_lock_delay"
+ #define KEY_JOIN_FLOOD_MODERATE "join_flood_moderate"
#define KEY_NICK "nick"
#define KEY_TRIGGER "trigger"
***************
*** 213,218 ****
#define OSMSG_ILLEGAL_KILL_REASON "Joined an illegal modeless channel - do not repeat."
#define OSMSG_ILLEGAL_CHANNEL "$b%s$b is an ILLEGAL channel. Do not re-join it."
! #define OSMSG_JOIN_FLOOD "Warning: Possible join flood in %s (currently %d users)."
#define OSMSG_NEW_USER_FLOOD "Warning: Possible new-user flood."
#define OSMSG_CLONE_WARNING "WARNING: You have connected the maximum permitted number of clients from one IP address (clones). If you connect any more, your host will be temporarily banned from the network."
#define OSMSG_TOO_MANY_CLONES "Excessive connections from a single host."
--- 214,220 ----
#define OSMSG_ILLEGAL_KILL_REASON "Joined an illegal modeless channel - do not repeat."
#define OSMSG_ILLEGAL_CHANNEL "$b%s$b is an ILLEGAL channel. Do not re-join it."
! #define OSMSG_JOIN_FLOOD "Warning: Possible join flood in %s (currently %d users%s)."
#define OSMSG_NEW_USER_FLOOD "Warning: Possible new-user flood."
+ #define OSMSG_FLOOD_MODERATE "This channel has been temporarily moderated due to a possible join flood attack detected in this channel; network staff have been notified and will investigate."
#define OSMSG_CLONE_WARNING "WARNING: You have connected the maximum permitted number of clients from one IP address (clones). If you connect any more, your host will be temporarily banned from the network."
#define OSMSG_TOO_MANY_CLONES "Excessive connections from a single host."
***************
*** 357,360 ****
--- 359,363 ----
unsigned long block_gline_duration;
unsigned long purge_lock_delay;
+ unsigned long join_flood_moderate;
unsigned char trigger_char;
} opserv_conf;
***************
*** 2318,2322 ****
opserv_join_check(struct userNode *user, struct chanNode *channel)
{
! if (channel->bad_channel && !IsService(user)) {
if (channel->name[0] == '#') {
if (!GetUserMode(channel, opserv)) {
--- 2321,2329 ----
opserv_join_check(struct userNode *user, struct chanNode *channel)
{
! if(IsService(user)) {
! return;
! }
!
! if (channel->bad_channel) {
if (channel->name[0] == '#') {
if (!GetUserMode(channel, opserv)) {
***************
*** 2334,2338 ****
if (!channel->join_flooded) {
channel->join_flooded = 1;
! opserv_alert(OSMSG_JOIN_FLOOD, channel->name, channel->members.used);
}
log(OS_LOG, LOG_INFO, "Join to %s during flood: "IDENT_FORMAT"\n", channel->name, IDENT_DATA(user));
--- 2341,2355 ----
if (!channel->join_flooded) {
channel->join_flooded = 1;
! if(opserv_conf.join_flood_moderate) {
! if(!GetUserMode(channel, opserv)) {
! AddChannelUser(opserv, channel);
! AddChannelOp(1, &opserv, channel, opserv, 1);
! }
! channel->modes |= MODE_MODERATED;
! irc_mode(opserv, channel, "+m");
!
! send_channel_notice(channel, opserv, OSMSG_FLOOD_MODERATE);
! }
! opserv_alert(OSMSG_JOIN_FLOOD, channel->name, channel->members.used, opserv_conf.join_flood_moderate ? "; channel moderated" : "");
}
log(OS_LOG, LOG_INFO, "Join to %s during flood: "IDENT_FORMAT"\n", channel->name, IDENT_DATA(user));
***************
*** 4254,4258 ****
if (action == gtrace_print_func) {
opserv_notice(user, MSG_SEARCH_RESULTS, "glines");
! } else if (action == gtrace_count_func || action == gtrace_ungline_func) {
discrim->limit = INT_MAX;
}
--- 4271,4275 ----
if (action == gtrace_print_func) {
opserv_notice(user, MSG_SEARCH_RESULTS, "glines");
! } else if (action == gtrace_count_func) {
discrim->limit = INT_MAX;
}
***************
*** 4776,4779 ****
--- 4793,4798 ----
str = database_get_data(conf_node, KEY_PURGE_LOCK_DELAY, RECDB_QSTRING);
opserv_conf.purge_lock_delay = str ? strtoul(str, NULL, 0) : 60;
+ str = database_get_data(conf_node, KEY_JOIN_FLOOD_MODERATE, RECDB_QSTRING);
+ opserv_conf.join_flood_moderate = str ? strtoul(str, NULL, 0) : 1;
str = database_get_data(conf_node, KEY_NICK, RECDB_QSTRING);
if (str) NickChange(opserv, str, 0);
|