Added fakechannels to /LIST
This commit is contained in:
parent
a034b14fbf
commit
a4e5c2fa61
9 changed files with 183 additions and 0 deletions
|
@ -451,6 +451,14 @@ alias "MS" {
|
||||||
target = "MemoServ";
|
target = "MemoServ";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
fakechannel "#honeypot" {
|
||||||
|
topic = "Come in";
|
||||||
|
users_min = 50;
|
||||||
|
users_max = 300;
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
general {
|
general {
|
||||||
hide_error_messages = opers;
|
hide_error_messages = opers;
|
||||||
hide_spoof_ips = yes;
|
hide_spoof_ips = yes;
|
||||||
|
@ -520,6 +528,7 @@ general {
|
||||||
caller_id_wait = 1 minute;
|
caller_id_wait = 1 minute;
|
||||||
pace_wait_simple = 1 second;
|
pace_wait_simple = 1 second;
|
||||||
pace_wait = 10 seconds;
|
pace_wait = 10 seconds;
|
||||||
|
listfake_wait = 180 seconds;
|
||||||
short_motd = no;
|
short_motd = no;
|
||||||
ping_cookie = no;
|
ping_cookie = no;
|
||||||
connect_timeout = 30 seconds;
|
connect_timeout = 30 seconds;
|
||||||
|
|
|
@ -927,6 +927,14 @@ alias "MS" {
|
||||||
target = "MemoServ";
|
target = "MemoServ";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
fakechannel "#honeypot" {
|
||||||
|
topic = "Come in";
|
||||||
|
users_min = 50;
|
||||||
|
users_max = 300;
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
/* The general block contains many of the options that were once compiled
|
/* The general block contains many of the options that were once compiled
|
||||||
* in options in config.h. The general block is read at start time.
|
* in options in config.h. The general block is read at start time.
|
||||||
*/
|
*/
|
||||||
|
@ -1181,6 +1189,9 @@ general {
|
||||||
*/
|
*/
|
||||||
pace_wait = 10 seconds;
|
pace_wait = 10 seconds;
|
||||||
|
|
||||||
|
/* listfake_wait: time until real list command can be used */
|
||||||
|
listfake_wait = 180 seconds;
|
||||||
|
|
||||||
/* short motd: send clients a notice telling them to read the motd
|
/* short motd: send clients a notice telling them to read the motd
|
||||||
* instead of forcing a motd to clients who may simply ignore it.
|
* instead of forcing a motd to clients who may simply ignore it.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -41,5 +41,6 @@ extern void mod_del_cmd(struct Message *msg);
|
||||||
extern void report_messages(struct Client *);
|
extern void report_messages(struct Client *);
|
||||||
|
|
||||||
extern struct Dictionary *alias_dict;
|
extern struct Dictionary *alias_dict;
|
||||||
|
extern struct Dictionary *fakechannel_dict;
|
||||||
|
|
||||||
#endif /* INCLUDED_parse_h_h */
|
#endif /* INCLUDED_parse_h_h */
|
||||||
|
|
|
@ -191,6 +191,7 @@ struct config_file_entry
|
||||||
int operspy_admin_only;
|
int operspy_admin_only;
|
||||||
int pace_wait;
|
int pace_wait;
|
||||||
int pace_wait_simple;
|
int pace_wait_simple;
|
||||||
|
int listfake_wait;
|
||||||
int short_motd;
|
int short_motd;
|
||||||
int no_oper_flood;
|
int no_oper_flood;
|
||||||
int hide_server;
|
int hide_server;
|
||||||
|
@ -309,6 +310,16 @@ struct alias_entry
|
||||||
int hits;
|
int hits;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct fakechannel_entry
|
||||||
|
{
|
||||||
|
char *name;
|
||||||
|
char *topic;
|
||||||
|
|
||||||
|
int users_min;
|
||||||
|
int users_max;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/* All variables are GLOBAL */
|
/* All variables are GLOBAL */
|
||||||
extern int specific_ipv4_vhost; /* used in s_bsd.c */
|
extern int specific_ipv4_vhost; /* used in s_bsd.c */
|
||||||
extern int specific_ipv6_vhost;
|
extern int specific_ipv6_vhost;
|
||||||
|
|
|
@ -398,6 +398,12 @@ static struct InfoStruct info_table[] = {
|
||||||
&ConfigFileEntry.pace_wait_simple,
|
&ConfigFileEntry.pace_wait_simple,
|
||||||
"Minimum delay between less intensive commands"
|
"Minimum delay between less intensive commands"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"listfake_wait",
|
||||||
|
OUTPUT_DECIMAL,
|
||||||
|
&ConfigFileEntry.listfake_wait,
|
||||||
|
"Time until real list command can be used"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"ping_cookie",
|
"ping_cookie",
|
||||||
OUTPUT_BOOLEAN,
|
OUTPUT_BOOLEAN,
|
||||||
|
|
|
@ -153,6 +153,32 @@ static int m_list(struct Client *client_p, struct Client *source_p, int parc, co
|
||||||
last_used = rb_current_time();
|
last_used = rb_current_time();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Disable LIST for a configured timespan after connect and send configured fake
|
||||||
|
* channels instead.
|
||||||
|
* Exempts: Opers, identifed users and users with spambot_exempt flag
|
||||||
|
*/
|
||||||
|
if (((source_p->localClient->firsttime + ConfigFileEntry.listfake_wait) > rb_current_time())
|
||||||
|
&& !IsOper(source_p) && !IsExemptSpambot(source_p) &&
|
||||||
|
!(source_p->user != NULL && !EmptyString(source_p->user->suser)))
|
||||||
|
{
|
||||||
|
struct fakechannel_entry *fakechannel;
|
||||||
|
struct DictionaryIter iter;
|
||||||
|
|
||||||
|
sendto_one(source_p, form_str(RPL_LISTSTART), me.name, source_p->name);
|
||||||
|
|
||||||
|
DICTIONARY_FOREACH(fakechannel, &iter, fakechannel_dict)
|
||||||
|
{
|
||||||
|
sendto_one(source_p, form_str(RPL_LIST), me.name, source_p->name,
|
||||||
|
"",
|
||||||
|
fakechannel->name,
|
||||||
|
(rand() % fakechannel->users_max + fakechannel->users_min),
|
||||||
|
fakechannel->topic);
|
||||||
|
}
|
||||||
|
|
||||||
|
sendto_one(source_p, form_str(RPL_LISTEND), me.name, source_p->name);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return mo_list(client_p, source_p, parc, parv);
|
return mo_list(client_p, source_p, parc, parv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ static rb_dlink_list yy_cluster_list;
|
||||||
static struct oper_conf *yy_oper = NULL;
|
static struct oper_conf *yy_oper = NULL;
|
||||||
|
|
||||||
static struct alias_entry *yy_alias = NULL;
|
static struct alias_entry *yy_alias = NULL;
|
||||||
|
static struct fakechannel_entry *yy_fakechannel = NULL;
|
||||||
|
|
||||||
static char *yy_blacklist_host = NULL;
|
static char *yy_blacklist_host = NULL;
|
||||||
static char *yy_blacklist_reason = NULL;
|
static char *yy_blacklist_reason = NULL;
|
||||||
|
@ -1802,6 +1803,92 @@ conf_set_alias_target(void *data)
|
||||||
yy_alias->target = rb_strdup(data);
|
yy_alias->target = rb_strdup(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
conf_begin_fakechannel(struct TopConf *tc)
|
||||||
|
{
|
||||||
|
yy_fakechannel = rb_malloc(sizeof(struct fakechannel_entry));
|
||||||
|
|
||||||
|
if (conf_cur_block_name != NULL)
|
||||||
|
yy_fakechannel->name = rb_strdup(conf_cur_block_name);
|
||||||
|
|
||||||
|
/* Set defaults */
|
||||||
|
yy_fakechannel->topic = "";
|
||||||
|
yy_fakechannel->users_min = 50;
|
||||||
|
yy_fakechannel->users_max = 300;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
conf_end_fakechannel(struct TopConf *tc)
|
||||||
|
{
|
||||||
|
if (yy_fakechannel == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (yy_fakechannel->name == NULL)
|
||||||
|
{
|
||||||
|
conf_report_error("Ignoring fakechannel -- must have a name.");
|
||||||
|
|
||||||
|
rb_free(yy_fakechannel);
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
irc_dictionary_add(fakechannel_dict, yy_fakechannel->name, yy_fakechannel);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
conf_set_fakechannel_name(void *data)
|
||||||
|
{
|
||||||
|
if (data == NULL || yy_fakechannel == NULL) /* this shouldn't ever happen */
|
||||||
|
return;
|
||||||
|
|
||||||
|
yy_fakechannel->name = rb_strdup(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
conf_set_fakechannel_topic(void *data)
|
||||||
|
{
|
||||||
|
if (data == NULL || yy_fakechannel == NULL) /* this shouldn't ever happen */
|
||||||
|
return;
|
||||||
|
|
||||||
|
yy_fakechannel->topic = rb_strdup(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
conf_set_fakechannel_users_min(void *data)
|
||||||
|
{
|
||||||
|
if (data == NULL || yy_fakechannel == NULL) /* this shouldn't ever happen */
|
||||||
|
return;
|
||||||
|
|
||||||
|
int users_min = *((int *)data);
|
||||||
|
if(users_min <= 0)
|
||||||
|
{
|
||||||
|
conf_report_error("fakechannel::users_min value %d is bogus, ignoring", users_min);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
yy_fakechannel->users_min = users_min;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
conf_set_fakechannel_users_max(void *data)
|
||||||
|
{
|
||||||
|
if (data == NULL || yy_fakechannel == NULL) /* this shouldn't ever happen */
|
||||||
|
return;
|
||||||
|
|
||||||
|
int users_max = *((int *)data);
|
||||||
|
if(users_max <= 0)
|
||||||
|
{
|
||||||
|
conf_report_error("fakechannel::users_max value %d is bogus, ignoring", users_max);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
yy_fakechannel->users_max = users_max;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
conf_set_channel_autochanmodes(void *data)
|
conf_set_channel_autochanmodes(void *data)
|
||||||
{
|
{
|
||||||
|
@ -2410,6 +2497,7 @@ static struct ConfEntry conf_general_table[] =
|
||||||
{ "operspy_dont_care_user_info", CF_YESNO, NULL, 0, &ConfigFileEntry.operspy_dont_care_user_info },
|
{ "operspy_dont_care_user_info", CF_YESNO, NULL, 0, &ConfigFileEntry.operspy_dont_care_user_info },
|
||||||
{ "pace_wait", CF_TIME, NULL, 0, &ConfigFileEntry.pace_wait },
|
{ "pace_wait", CF_TIME, NULL, 0, &ConfigFileEntry.pace_wait },
|
||||||
{ "pace_wait_simple", CF_TIME, NULL, 0, &ConfigFileEntry.pace_wait_simple },
|
{ "pace_wait_simple", CF_TIME, NULL, 0, &ConfigFileEntry.pace_wait_simple },
|
||||||
|
{ "listfake_wait", CF_TIME, NULL, 0, &ConfigFileEntry.listfake_wait },
|
||||||
{ "ping_cookie", CF_YESNO, NULL, 0, &ConfigFileEntry.ping_cookie },
|
{ "ping_cookie", CF_YESNO, NULL, 0, &ConfigFileEntry.ping_cookie },
|
||||||
{ "reject_after_count", CF_INT, NULL, 0, &ConfigFileEntry.reject_after_count },
|
{ "reject_after_count", CF_INT, NULL, 0, &ConfigFileEntry.reject_after_count },
|
||||||
{ "reject_ban_time", CF_TIME, NULL, 0, &ConfigFileEntry.reject_ban_time },
|
{ "reject_ban_time", CF_TIME, NULL, 0, &ConfigFileEntry.reject_ban_time },
|
||||||
|
@ -2523,6 +2611,12 @@ newconf_init()
|
||||||
add_conf_item("alias", "name", CF_QSTRING, conf_set_alias_name);
|
add_conf_item("alias", "name", CF_QSTRING, conf_set_alias_name);
|
||||||
add_conf_item("alias", "target", CF_QSTRING, conf_set_alias_target);
|
add_conf_item("alias", "target", CF_QSTRING, conf_set_alias_target);
|
||||||
|
|
||||||
|
add_top_conf("fakechannel", conf_begin_fakechannel, conf_end_fakechannel, NULL);
|
||||||
|
add_conf_item("fakechannel", "name", CF_QSTRING, conf_set_fakechannel_name);
|
||||||
|
add_conf_item("fakechannel", "topic", CF_QSTRING, conf_set_fakechannel_topic);
|
||||||
|
add_conf_item("fakechannel", "users_max", CF_INT, conf_set_fakechannel_users_max);
|
||||||
|
add_conf_item("fakechannel", "users_min", CF_INT, conf_set_fakechannel_users_min);
|
||||||
|
|
||||||
add_top_conf("blacklist", NULL, NULL, NULL);
|
add_top_conf("blacklist", NULL, NULL, NULL);
|
||||||
add_conf_item("blacklist", "host", CF_QSTRING, conf_set_blacklist_host);
|
add_conf_item("blacklist", "host", CF_QSTRING, conf_set_blacklist_host);
|
||||||
add_conf_item("blacklist", "type", CF_STRING | CF_FLIST, conf_set_blacklist_type);
|
add_conf_item("blacklist", "type", CF_STRING | CF_FLIST, conf_set_blacklist_type);
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
|
|
||||||
static struct Dictionary *cmd_dict = NULL;
|
static struct Dictionary *cmd_dict = NULL;
|
||||||
struct Dictionary *alias_dict = NULL;
|
struct Dictionary *alias_dict = NULL;
|
||||||
|
struct Dictionary *fakechannel_dict = NULL;
|
||||||
|
|
||||||
/* parv[0] is not used, and parv[LAST] == NULL */
|
/* parv[0] is not used, and parv[LAST] == NULL */
|
||||||
static char *para[MAXPARA + 2];
|
static char *para[MAXPARA + 2];
|
||||||
|
|
24
src/s_conf.c
24
src/s_conf.c
|
@ -738,6 +738,7 @@ set_default_conf(void)
|
||||||
ConfigFileEntry.pace_wait = 10;
|
ConfigFileEntry.pace_wait = 10;
|
||||||
ConfigFileEntry.caller_id_wait = 60;
|
ConfigFileEntry.caller_id_wait = 60;
|
||||||
ConfigFileEntry.pace_wait_simple = 1;
|
ConfigFileEntry.pace_wait_simple = 1;
|
||||||
|
ConfigFileEntry.listfake_wait = 180;
|
||||||
ConfigFileEntry.short_motd = NO;
|
ConfigFileEntry.short_motd = NO;
|
||||||
ConfigFileEntry.no_oper_flood = NO;
|
ConfigFileEntry.no_oper_flood = NO;
|
||||||
ConfigFileEntry.fname_userlog = NULL;
|
ConfigFileEntry.fname_userlog = NULL;
|
||||||
|
@ -826,6 +827,9 @@ set_default_conf(void)
|
||||||
|
|
||||||
if (!alias_dict)
|
if (!alias_dict)
|
||||||
alias_dict = irc_dictionary_create(strcasecmp);
|
alias_dict = irc_dictionary_create(strcasecmp);
|
||||||
|
|
||||||
|
if (!fakechannel_dict)
|
||||||
|
fakechannel_dict = irc_dictionary_create(strcasecmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef YES
|
#undef YES
|
||||||
|
@ -1434,6 +1438,19 @@ free_alias_cb(struct DictionaryElement *ptr, void *unused)
|
||||||
rb_free(aptr);
|
rb_free(aptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* free an fakechannel{} entry.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
free_fakechannel_cb(struct DictionaryElement *ptr, void *unused)
|
||||||
|
{
|
||||||
|
struct fakechannel_entry *aptr = ptr->data;
|
||||||
|
|
||||||
|
rb_free(aptr->name);
|
||||||
|
rb_free(aptr->topic);
|
||||||
|
rb_free(aptr);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* clear_out_old_conf
|
* clear_out_old_conf
|
||||||
*
|
*
|
||||||
|
@ -1537,6 +1554,13 @@ clear_out_old_conf(void)
|
||||||
alias_dict = NULL;
|
alias_dict = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* remove any fakechannels */
|
||||||
|
if (alias_dict != NULL)
|
||||||
|
{
|
||||||
|
irc_dictionary_destroy(fakechannel_dict, free_fakechannel_cb, NULL);
|
||||||
|
fakechannel_dict = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
destroy_blacklists();
|
destroy_blacklists();
|
||||||
|
|
||||||
privilegeset_mark_all_illegal();
|
privilegeset_mark_all_illegal();
|
||||||
|
|
Loading…
Reference in a new issue