1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-10 00:23:12 +02:00

Merge branch 'unreal60_dev' into unreal60_dev+watch

This commit is contained in:
k4be
2021-08-06 15:23:37 +02:00
79 changed files with 1368 additions and 1276 deletions
+8 -83
View File
@@ -22,17 +22,6 @@
#include "unrealircd.h"
/* You can change this '//#undef' into '#define' if you want to see quite
* a flood for every user that connects (and on-load if cfg.fullstatus_on_load).
* Obviously only recommended for testing, use with care!
*/
#undef DEBUGMODE
/** Change this 'undef' to 'define' to get performance information.
* This really only meant for debugging purposes.
*/
#undef TIMING
ModuleHeader MOD_HEADER
= {
"antirandom",
@@ -515,7 +504,6 @@ struct {
long ban_time;
int convert_to_lowercase;
int show_failedconnects;
int fullstatus_on_load;
ConfigItem_mask *except_hosts;
int except_webirc;
} cfg;
@@ -553,19 +541,14 @@ MOD_INIT()
HookAdd(modinfo->handle, HOOKTYPE_CONFIGRUN, 0, antirandom_config_run);
/* Some default values: */
cfg.fullstatus_on_load = 1;
cfg.convert_to_lowercase = 1;
cfg.except_webirc = 1;
return MOD_SUCCESS;
}
void check_all_users(void);
MOD_LOAD()
{
if (cfg.fullstatus_on_load)
check_all_users();
return MOD_SUCCESS;
}
@@ -644,9 +627,6 @@ int antirandom_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
if (!strcmp(cep->ce_varname, "convert-to-lowercase"))
{
} else
if (!strcmp(cep->ce_varname, "fullstatus-on-load"))
{
} else
if (!strcmp(cep->ce_varname, "show-failedconnects"))
{
} else
@@ -705,10 +685,6 @@ int antirandom_config_run(ConfigFile *cf, ConfigEntry *ce, int type)
if (!strcmp(cep->ce_varname, "show-failedconnects"))
{
cfg.show_failedconnects = config_checkval(cep->ce_vardata, CFG_YESNO);
} else
if (!strcmp(cep->ce_varname, "fullstatus-on-load"))
{
cfg.fullstatus_on_load = config_checkval(cep->ce_vardata, CFG_YESNO);
}
}
return 1;
@@ -821,23 +797,14 @@ static int internal_getscore(char *str)
if (digits >= 5)
{
score += 5 + (digits - 5);
#ifdef DEBUGMODE
sendto_ops_and_log("score@'%s': MATCH for digits check", str);
#endif
}
if (vowels >= 4)
{
score += 4 + (vowels - 4);
#ifdef DEBUGMODE
sendto_ops_and_log("score@'%s': MATCH for vowels check", str);
#endif
}
if (consonants >= 4)
{
score += 4 + (consonants - 4);
#ifdef DEBUGMODE
sendto_ops_and_log("score@'%s': MATCH for consonants check", str);
#endif
}
for (t=triples; t; t=t->next)
@@ -846,10 +813,6 @@ static int internal_getscore(char *str)
if ((t->two[0] == s[0]) && (t->two[1] == s[1]) && s[2] && strchr(t->rest, s[2]))
{
score++; /* OK */
#ifdef DEBUGMODE
sendto_ops_and_log("score@'%s': MATCH for '%s[%s]' %c/%c/%c", str, t->two, t->rest,
s[0], s[1], s[2]);
#endif
}
}
@@ -868,11 +831,6 @@ static int get_spam_score(Client *client)
char *gecos = client->info;
char nbuf[NICKLEN+1], ubuf[USERLEN+1], rbuf[REALLEN+1];
int nscore, uscore, gscore, score;
#ifdef TIMING
struct timeval tv_alpha, tv_beta;
gettimeofday(&tv_alpha, NULL);
#endif
if (cfg.convert_to_lowercase)
{
@@ -889,46 +847,9 @@ static int get_spam_score(Client *client)
gscore = internal_getscore(gecos);
score = nscore + uscore + gscore;
#ifdef TIMING
gettimeofday(&tv_beta, NULL);
ircd_log(LOG_ERROR, "AntiRandom Timing: %ld microseconds",
((tv_beta.tv_sec - tv_alpha.tv_sec) * 1000000) + (tv_beta.tv_usec - tv_alpha.tv_usec));
#endif
#ifdef DEBUGMODE
sendto_ops_and_log("got score: %d/%d/%d = %d",
nscore, uscore, gscore, score);
#endif
return score;
}
void check_all_users(void)
{
Client *client;
int matches=0, score;
list_for_each_entry(client, &lclient_list, lclient_node)
{
if (IsUser(client))
{
if (is_exempt(client))
continue;
score = get_spam_score(client);
if (score > cfg.threshold)
{
if (!matches)
sendto_realops("[antirandom] Full status report follows:");
sendto_realops("%d points: %s!%s@%s:%s",
score, client->name, client->user->username, client->user->realhost, client->info);
matches++;
}
}
}
if (matches)
sendto_realops("[antirandom] %d match%s", matches, matches == 1 ? "" : "es");
}
int antirandom_preconnect(Client *client)
{
int score;
@@ -941,13 +862,17 @@ int antirandom_preconnect(Client *client)
{
if (cfg.ban_action == BAN_ACT_WARN)
{
sendto_ops_and_log("[antirandom] would have denied access to user with score %d: %s!%s@%s:%s",
score, client->name, client->user->username, client->user->realhost, client->info);
unreal_log(LOG_INFO, "antirandom", "ANTIRANDOM_REJECTED_USER", client,
"[antirandom] would have denied access to user with score $score: $client:$client.info",
log_data_integer("score", score));
return HOOK_CONTINUE;
}
if (cfg.show_failedconnects)
sendto_ops_and_log("[antirandom] denied access to user with score %d: %s!%s@%s:%s",
score, client->name, client->user->username, client->user->realhost, client->info);
{
unreal_log(LOG_INFO, "antirandom", "ANTIRANDOM_REJECTED_USER", client,
"[antirandom] denied access to user with score $score: $client:$client.info",
log_data_integer("score", score));
}
place_host_ban(client, cfg.ban_action, cfg.ban_reason, cfg.ban_time);
return HOOK_DENY;
}
+10 -10
View File
@@ -104,7 +104,7 @@ void set_post_delayed(Channel *channel)
channel->mode.extmode |= EXTMODE_POST_DELAYED;
new_message(&me, NULL, &mtags);
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s +d", me.name, channel->chname);
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s +d", me.name, channel->name);
free_message_tags(mtags);
}
@@ -115,7 +115,7 @@ void clear_post_delayed(Channel *channel)
channel->mode.extmode &= ~EXTMODE_POST_DELAYED;
new_message(&me, NULL, &mtags);
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s -d", me.name, channel->chname);
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s -d", me.name, channel->name);
free_message_tags(mtags);
}
@@ -217,14 +217,14 @@ void clear_user_invisible_announce(Channel *channel, Client *client, MessageTag
clear_user_invisible(channel, client);
ircsnprintf(joinbuf, sizeof(joinbuf), ":%s!%s@%s JOIN %s",
client->name, client->user->username, GetHost(client), channel->chname);
client->name, client->user->username, GetHost(client), channel->name);
ircsnprintf(exjoinbuf, sizeof(exjoinbuf), ":%s!%s@%s JOIN %s %s :%s",
client->name, client->user->username, GetHost(client), channel->chname,
client->name, client->user->username, GetHost(client), channel->name,
IsLoggedIn(client) ? client->user->svid : "*",
client->info);
new_message_special(client, recv_mtags, &mtags, ":%s JOIN %s", client->name, channel->chname);
new_message_special(client, recv_mtags, &mtags, ":%s JOIN %s", client->name, channel->name);
for (i = channel->members; i; i = i->next)
{
Client *acptr = i->client;
@@ -337,16 +337,16 @@ int moded_chanmode(Client *client, Channel *channel, MessageTag *recv_mtags, cha
if (moded_user_invisible(i->client, channel))
{
MessageTag *mtags = NULL;
new_message_special(i->client, recv_mtags, &mtags, ":%s JOIN %s", i->client->name, channel->chname);
new_message_special(i->client, recv_mtags, &mtags, ":%s JOIN %s", i->client->name, channel->name);
if (HasCapabilityFast(user, CAP_EXTENDED_JOIN))
{
sendto_one(user, mtags, ":%s!%s@%s JOIN %s %s :%s",
i->client->name, i->client->user->username, GetHost(i->client),
channel->chname,
channel->name,
IsLoggedIn(i->client) ? i->client->user->svid : "*",
i->client->info);
} else {
sendto_one(user, mtags, ":%s!%s@%s JOIN :%s", i->client->name, i->client->user->username, GetHost(i->client), channel->chname);
sendto_one(user, mtags, ":%s!%s@%s JOIN :%s", i->client->name, i->client->user->username, GetHost(i->client), channel->name);
}
free_message_tags(mtags);
}
@@ -374,8 +374,8 @@ int moded_chanmode(Client *client, Channel *channel, MessageTag *recv_mtags, cha
if (moded_user_invisible(i->client, channel))
{
MessageTag *mtags = NULL;
new_message_special(i->client, recv_mtags, &mtags, ":%s PART %s", i->client->name, channel->chname);
sendto_one(user, mtags, ":%s!%s@%s PART :%s", i->client->name, i->client->user->username, GetHost(i->client), channel->chname);
new_message_special(i->client, recv_mtags, &mtags, ":%s PART %s", i->client->name, channel->name);
sendto_one(user, mtags, ":%s!%s@%s PART :%s", i->client->name, i->client->user->username, GetHost(i->client), channel->name);
free_message_tags(mtags);
}
}
+10 -10
View File
@@ -928,9 +928,9 @@ int floodprot_can_send_to_channel(Client *client, Channel *channel, Membership *
{
mtags = NULL;
new_message(&me, NULL, &mtags);
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s +b %s 0", me.id, channel->chname, mask);
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s +b %s 0", me.id, channel->name, mask);
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags,
":%s MODE %s +b %s", me.name, channel->chname, mask);
":%s MODE %s +b %s", me.name, channel->name, mask);
free_message_tags(mtags);
} /* else.. ban list is full */
}
@@ -1081,7 +1081,7 @@ void floodprottimer_add(Channel *channel, char mflag, time_t when)
if (strlen(chp->timers_running)+1 >= sizeof(chp->timers_running))
{
sendto_realops_and_log("floodprottimer_add: too many timers running for %s (%s)!!!",
channel->chname, chp->timers_running);
channel->name, chp->timers_running);
return;
}
strccat(chp->timers_running, mflag); /* bounds already checked ^^ */
@@ -1140,7 +1140,7 @@ EVENT(modef_event)
long mode = 0;
Cmode_t extmode = 0;
#ifdef NEWFLDDBG
sendto_realops("modef_event: chan %s mode -%c EXPIRED", e->channel->chname, e->m);
sendto_realops("modef_event: chan %s mode -%c EXPIRED", e->channel->name, e->m);
#endif
mode = get_mode_bitbychar(e->m);
if (mode == 0)
@@ -1152,10 +1152,10 @@ EVENT(modef_event)
MessageTag *mtags = NULL;
new_message(&me, NULL, &mtags);
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s -%c 0", me.id, e->channel->chname, e->m);
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s -%c 0", me.id, e->channel->name, e->m);
sendto_channel(e->channel, &me, NULL, 0, 0, SEND_LOCAL, mtags,
":%s MODE %s -%c",
me.name, e->channel->chname, e->m);
me.name, e->channel->name, e->m);
free_message_tags(mtags);
e->channel->mode.mode &= ~mode;
@@ -1168,7 +1168,7 @@ EVENT(modef_event)
} else {
#ifdef NEWFLDDBG
sendto_realops("modef_event: chan %s mode -%c about %d seconds",
e->channel->chname, e->m, e->when - now);
e->channel->name, e->m, e->when - now);
#endif
}
}
@@ -1258,7 +1258,7 @@ void do_floodprot_action(Channel *channel, int what)
new_message(&me, NULL, &mtags);
ircsnprintf(comment, sizeof(comment), "*** Channel %s detected (limit is %d per %d seconds), setting mode +%c",
text, chp->limit[what], chp->per, m);
ircsnprintf(target, sizeof(target), "%%%s", channel->chname);
ircsnprintf(target, sizeof(target), "%%%s", channel->name);
sendto_channel(channel, &me, NULL, PREFIX_HALFOP|PREFIX_OP|PREFIX_ADMIN|PREFIX_OWNER,
0, SEND_ALL, mtags,
":%s NOTICE %s :%s", me.name, target, comment);
@@ -1267,8 +1267,8 @@ void do_floodprot_action(Channel *channel, int what)
/* Then the MODE broadcast */
mtags = NULL;
new_message(&me, NULL, &mtags);
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s +%c 0", me.id, channel->chname, m);
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s +%c", me.name, channel->chname, m);
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s +%c 0", me.id, channel->name, m);
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s +%c", me.name, channel->name, m);
free_message_tags(mtags);
/* Actually set the mode internally */
+10 -10
View File
@@ -623,9 +623,9 @@ int history_chanmode_change(Client *client, Channel *channel, MessageTag *mtags,
/* If so, grab the settings, and communicate them */
settings = (HistoryChanMode *)GETPARASTRUCT(channel, 'H');
if (settings)
history_set_limit(channel->chname, settings->max_lines, settings->max_time);
history_set_limit(channel->name, settings->max_lines, settings->max_time);
else
history_destroy(channel->chname);
history_destroy(channel->name);
return 0;
}
@@ -636,7 +636,7 @@ int history_channel_destroy(Channel *channel, int *should_destroy)
if (*should_destroy == 0)
return 0; /* channel will not be destroyed */
history_destroy(channel->chname);
history_destroy(channel->name);
return 0;
}
@@ -672,10 +672,10 @@ int history_chanmsg(Client *client, Channel *channel, int sendflags, int prefix,
snprintf(buf, sizeof(buf), ":%s %s %s :%s",
source,
sendtype_to_cmd(sendtype),
channel->chname,
channel->name,
text);
history_add(channel->chname, mtags, buf);
history_add(channel->name, mtags, buf);
return 0;
}
@@ -700,7 +700,7 @@ int history_join(Client *client, Channel *channel, MessageTag *mtags, char *parv
filter.cmd = HFC_SIMPLE;
filter.last_lines = cfg.playback_on_join.lines;
filter.last_seconds = cfg.playback_on_join.time;
r = history_request(channel->chname, &filter);
r = history_request(channel->name, &filter);
if (r)
{
history_send_result(client, r);
@@ -727,7 +727,7 @@ CMD_OVERRIDE_FUNC(override_mode)
(IsUser(client) && client->srvptr && client->srvptr->local))
{
/* Now check if the channel is currently +r */
if ((parc >= 2) && !BadPtr(parv[1]) && ((channel = find_channel(parv[1], NULL))) &&
if ((parc >= 2) && !BadPtr(parv[1]) && ((channel = find_channel(parv[1]))) &&
has_channel_mode(channel, 'r'))
{
had_r = 1;
@@ -744,7 +744,7 @@ CMD_OVERRIDE_FUNC(override_mode)
* then...
*/
if (had_r &&
((channel = find_channel(parv[1], NULL))) &&
((channel = find_channel(parv[1]))) &&
!has_channel_mode(channel, 'r') &&
HistoryEnabled(channel))
{
@@ -782,9 +782,9 @@ CMD_OVERRIDE_FUNC(override_mode)
sendto_channel(channel, &me, &me, 0, 0, SEND_LOCAL, mtags,
":%s MODE %s %s %s",
me.name, channel->chname, modebuf, parabuf);
me.name, channel->name, modebuf, parabuf);
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s %s %s %lld",
me.id, channel->chname, modebuf, parabuf,
me.id, channel->name, modebuf, parabuf,
(long long)channel->creationtime);
/* Activate this hook just like cmd_mode.c */
+9 -9
View File
@@ -143,17 +143,17 @@ void issecure_unset(Channel *channel, Client *client, MessageTag *recv_mtags, in
if (notice)
{
mtags = NULL;
new_message_special(&me, recv_mtags, &mtags, "NOTICE %s :setting -Z", channel->chname);
new_message_special(&me, recv_mtags, &mtags, "NOTICE %s :setting -Z", channel->name);
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags,
":%s NOTICE %s :User '%s' joined and is not connected through SSL/TLS, setting channel -Z (insecure)",
me.id, channel->chname, client->name);
me.id, channel->name, client->name);
free_message_tags(mtags);
}
channel->mode.extmode &= ~EXTCMODE_ISSECURE;
mtags = NULL;
new_message_special(&me, recv_mtags, &mtags, "MODE %s -Z", channel->chname);
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s -Z", me.name, channel->chname);
new_message_special(&me, recv_mtags, &mtags, "MODE %s -Z", channel->name);
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s -Z", me.name, channel->name);
free_message_tags(mtags);
}
@@ -168,7 +168,7 @@ void issecure_set(Channel *channel, Client *client, MessageTag *recv_mtags, int
MessageTag *mtags;
mtags = NULL;
new_message_special(&me, recv_mtags, &mtags, "NOTICE %s :setting +Z", channel->chname);
new_message_special(&me, recv_mtags, &mtags, "NOTICE %s :setting +Z", channel->name);
if (notice && client)
{
/* note that we have to skip 'client', since when this call is being made
@@ -176,23 +176,23 @@ void issecure_set(Channel *channel, Client *client, MessageTag *recv_mtags, int
*/
sendto_channel(channel, &me, client, 0, 0, SEND_LOCAL, NULL,
":%s NOTICE %s :Now all users in the channel are connected through SSL/TLS, setting channel +Z (secure)",
me.name, channel->chname);
me.name, channel->name);
} else if (notice)
{
/* note the missing word 'now' in next line */
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, NULL,
":%s NOTICE %s :All users in the channel are connected through SSL/TLS, setting channel +Z (secure)",
me.name, channel->chname);
me.name, channel->name);
}
free_message_tags(mtags);
channel->mode.extmode |= EXTCMODE_ISSECURE;
mtags = NULL;
new_message_special(&me, recv_mtags, &mtags, "MODE %s +Z", channel->chname);
new_message_special(&me, recv_mtags, &mtags, "MODE %s +Z", channel->name);
sendto_channel(channel, &me, client, 0, 0, SEND_LOCAL, mtags,
":%s MODE %s +Z",
me.name, channel->chname);
me.name, channel->name);
free_message_tags(mtags);
}
+3 -3
View File
@@ -129,7 +129,7 @@ int cmodeL_is_ok(Client *client, Channel *channel, char mode, char *para, int ty
return EX_DENY;
}
if (find_channel(para, NULL) == channel)
if (find_channel(para) == channel)
{
if (MyUser(client))
sendnumeric(client, ERR_CANNOTCHANGECHANMODE, 'L',
@@ -335,8 +335,8 @@ int link_doforward(Client *client, Channel *channel, char *linked, linkType type
sendto_one(client, NULL,
":%s %d %s %s %s :[Link] Cannot join channel %s (%s) -- transferring you to %s",
me.name, ERR_LINKCHANNEL, client->name, channel->chname, linked,
channel->chname, desc, linked);
me.name, ERR_LINKCHANNEL, client->name, channel->name, linked,
channel->name, desc, linked);
parv[0] = client->name;
parv[1] = linked;
parv[2] = NULL;
+2 -2
View File
@@ -75,7 +75,7 @@ int noinvite_pre_knock(Client *client, Channel *channel)
if (MyUser(client) && IsNoInvite(channel))
{
sendnumeric(client, ERR_CANNOTKNOCK,
channel->chname, "The channel does not allow invites (+V)");
channel->name, "The channel does not allow invites (+V)");
return HOOK_DENY;
}
@@ -90,7 +90,7 @@ int noinvite_pre_invite(Client *client, Client *target, Channel *channel, int *o
{
*override = 1;
} else {
sendnumeric(client, ERR_NOINVITE, channel->chname);
sendnumeric(client, ERR_NOINVITE, channel->name);
return HOOK_DENY;
}
}
+1 -1
View File
@@ -74,7 +74,7 @@ int noknock_check (Client *client, Channel *channel)
{
if (MyUser(client) && IsNoKnock(channel))
{
sendnumeric(client, ERR_CANNOTKNOCK, channel->chname, "No knocks are allowed! (+K)");
sendnumeric(client, ERR_CANNOTKNOCK, channel->name, "No knocks are allowed! (+K)");
return HOOK_DENY;
}
+5 -5
View File
@@ -112,11 +112,11 @@ static int secureonly_kick_insecure_users(Channel *channel)
prefix, 0,
SEND_LOCAL, mtags,
":%s KICK %s %s :%s",
me.name, channel->chname, client->name, comment);
me.name, channel->name, client->name, comment);
sendto_prefix_one(client, &me, mtags, ":%s KICK %s %s :%s", me.name, channel->chname, client->name, comment);
sendto_prefix_one(client, &me, mtags, ":%s KICK %s %s :%s", me.name, channel->name, client->name, comment);
sendto_server(NULL, 0, 0, mtags, ":%s KICK %s %s :%s", me.id, channel->chname, client->id, comment);
sendto_server(NULL, 0, 0, mtags, ":%s KICK %s %s :%s", me.id, channel->name, client->id, comment);
free_message_tags(mtags);
@@ -168,7 +168,7 @@ int secureonly_check_sajoin(Client *target, Channel *channel, Client *requester)
if (IsSecureOnly(channel) && !IsSecure(target))
{
sendnotice(requester, "You cannot SAJOIN %s to %s because the channel is +z and the user is not connected via SSL/TLS",
target->name, channel->chname);
target->name, channel->name);
return HOOK_DENY;
}
@@ -182,7 +182,7 @@ int secureonly_specialcheck(Client *client, Channel *channel, char *parv[])
{
if ((channel->users == 0) && (iConf.modes_on_join.extmodes & EXTCMODE_SECUREONLY) && !IsSecure(client) && !IsOper(client))
{
sendnumeric(client, ERR_SECUREONLYCHAN, channel->chname);
sendnumeric(client, ERR_SECUREONLYCHAN, channel->name);
return HOOK_DENY;
}
return HOOK_CONTINUE;
+3 -5
View File
@@ -27,9 +27,7 @@ ModuleHeader MOD_HEADER = {
#define MAGIC_CHANNEL_START 0x11111111
#define MAGIC_CHANNEL_END 0x22222222
#ifdef DEBUGMODE
#define BENCHMARK
#endif
// #undef BENCHMARK
#define WARN_WRITE_ERROR(fname) \
do { \
@@ -335,7 +333,7 @@ int write_channel_entry(UnrealDB *db, const char *tmpfname, Channel *channel)
{
W_SAFE(unrealdb_write_int32(db, MAGIC_CHANNEL_START));
/* Channel name */
W_SAFE(unrealdb_write_str(db, channel->chname));
W_SAFE(unrealdb_write_str(db, channel->name));
/* Channel creation time */
W_SAFE(unrealdb_write_int64(db, channel->creationtime));
/* Topic (topic, setby, seton) */
@@ -506,7 +504,7 @@ int read_channeldb(void)
R_SAFE(unrealdb_read_str(db, &modes2));
R_SAFE(unrealdb_read_str(db, &mode_lock));
/* If we got this far, we can create/initialize the channel with the above */
channel = get_channel(&me, chname, CREATE);
channel = make_channel(chname);
channel->creationtime = creationtime;
safe_strdup(channel->topic, topic);
safe_strdup(channel->topic_nick, topic_nick);
+3 -3
View File
@@ -173,7 +173,7 @@ void chathistory_targets(Client *client, HistoryFilter *filter, int limit)
for (mp = client->user->channel; mp; mp = mp->next)
{
Channel *channel = mp->channel;
r = history_request(channel->chname, filter);
r = history_request(channel->name, filter);
if (r)
{
add_chathistory_target(&targets, r);
@@ -257,7 +257,7 @@ CMD_FUNC(cmd_chathistory)
goto end;
}
channel = find_channel(parv[2], NULL);
channel = find_channel(parv[2]);
if (!channel)
{
sendto_one(client, NULL, ":%s FAIL CHATHISTORY INVALID_TARGET %s %s :Messages could not be retrieved, not an existing channel",
@@ -369,7 +369,7 @@ CMD_FUNC(cmd_chathistory)
if (filter->limit > CHATHISTORY_LIMIT)
filter->limit = CHATHISTORY_LIMIT;
if ((r = history_request(channel->chname, filter)))
if ((r = history_request(channel->name, filter)))
history_send_result(client, r);
end:
+20 -18
View File
@@ -360,16 +360,18 @@ EVENT(connthrottle_evt)
if (ucounter->rejected_clients)
{
snprintf(buf, sizeof(buf),
"[ConnThrottle] Stats for this server past 60 secs: Connections rejected: %d. Accepted: %d known user(s), %d SASL, %d WEBIRC and %d new user(s).",
ucounter->rejected_clients,
ucounter->allowed_score,
ucounter->allowed_sasl,
ucounter->allowed_webirc,
ucounter->allowed_other);
sendto_realops("%s", buf);
ircd_log(LOG_ERROR, "%s", buf);
unreal_log(ULOG_INFO, "connthrottle", "CONNTHROTLE_REPORT", NULL,
"ConnThrottle] Stats for this server past 60 secs: "
"Connections rejected: $num_rejected. "
"Accepted: $num_accepted_known_users known user(s), "
"$num_accepted_sasl SASL, "
"$num_accepted_webirc WEBIRC and "
"$num_accepted_unknown_users new user(s).",
log_data_integer("num_rejected", ucounter->rejected_clients),
log_data_integer("num_accepted_known_users", ucounter->allowed_score),
log_data_integer("num_accepted_sasl", ucounter->allowed_sasl),
log_data_integer("num_accepted_webirc", ucounter->allowed_webirc),
log_data_integer("num_accepted_unknown_users", ucounter->allowed_other));
}
/* Reset stats for next message */
@@ -436,8 +438,8 @@ int ct_pre_lconnect(Client *client)
/* We send the LARGE banner if throttling was activated */
if (!ucounter->throttling_previous_minute && !ucounter->throttling_banner_displayed)
{
ircd_log(LOG_ERROR, "[ConnThrottle] Connection throttling has been ACTIVATED due to a HIGH CONNECTION RATE.");
sendto_realops("[ConnThrottle] Connection throttling has been ACTIVATED due to a HIGH CONNECTION RATE.");
unreal_log(ULOG_WARNING, "connthrottle", "CONNTHROTLE_ACTIVATED", NULL,
"[ConnThrottle] Connection throttling has been ACTIVATED due to a HIGH CONNECTION RATE.");
sendto_realops("[ConnThrottle] Users with IP addresses that have not been seen before will be rejected above the set connection rate. Known users can still get in.");
sendto_realops("[ConnThrottle] For more information see https://www.unrealircd.org/docs/ConnThrottle");
ucounter->throttling_banner_displayed = 1;
@@ -602,8 +604,8 @@ CMD_FUNC(ct_throttle)
return;
}
ucounter->disabled = 1;
sendto_realops("[connthrottle] %s (%s@%s) DISABLED the connthrottle module.",
client->name, client->user->username, client->user->realhost);
unreal_log(ULOG_WARNING, "connthrottle", "CONNTHROTLE_MODULE_DISABLED", client,
"[ConnThrottle] $client.nuh DISABLED the connthrottle module.");
} else
if (!strcasecmp(parv[1], "ON"))
{
@@ -612,15 +614,15 @@ CMD_FUNC(ct_throttle)
sendnotice(client, "Already ON");
return;
}
sendto_realops("[connthrottle] %s (%s@%s) ENABLED the connthrottle module.",
client->name, client->user->username, client->user->realhost);
unreal_log(ULOG_WARNING, "connthrottle", "CONNTHROTLE_MODULE_ENABLED", client,
"[ConnThrottle] $client.nuh ENABLED the connthrottle module.");
ucounter->disabled = 0;
} else
if (!strcasecmp(parv[1], "RESET"))
{
memset(ucounter, 0, sizeof(UCounter));
sendto_realops("[connthrottle] %s (%s@%s) did a RESET on the stats/counters!!",
client->name, client->user->username, client->user->realhost);
unreal_log(ULOG_WARNING, "connthrottle", "CONNTHROTLE_RESET", client,
"[ConnThrottle] $client.nuh did a RESET on the statistics/counters.");
} else
{
sendnotice(client, "Unknown option '%s'", parv[1]);
+1 -1
View File
@@ -515,7 +515,7 @@ int dccdeny_can_send_to_channel(Client *client, Channel *channel, Membership *lp
{
char *err = NULL;
char *filename = get_dcc_filename(*msg);
if (filename && !can_dcc(client, channel->chname, NULL, filename, &err))
if (filename && !can_dcc(client, channel->name, NULL, filename, &err))
{
if (!IsDead(client) && (sendtype != SEND_TYPE_NOTICE))
{
-4
View File
@@ -65,10 +65,6 @@ CMD_FUNC(cmd_eos)
return;
client->serv->flags.synced = 1;
/* pass it on ^_- */
#ifdef DEBUGMODE
ircd_log(LOG_ERROR, "[EOSDBG] cmd_eos: got sync from %s (path:%s)", client->name, client->direction->name);
ircd_log(LOG_ERROR, "[EOSDBG] cmd_eos: broadcasting it back to everyone except route from %s", client->direction->name);
#endif
sendto_server(client, 0, 0, NULL, ":%s EOS", client->id);
RunHook(HOOKTYPE_SERVER_SYNCED, client);
+1 -1
View File
@@ -146,7 +146,7 @@ int extban_inchannel_is_banned(Client *client, Channel *channel, char *ban, int
for (lp = client->user->channel; lp; lp = lp->next)
{
if (match_esc(p, lp->channel->chname))
if (match_esc(p, lp->channel->name))
{
/* Channel matched, check symbol if needed (+/%/@/etc) */
if (symbol)
+2 -2
View File
@@ -275,7 +275,7 @@ int extban_modeT_is_ok(Client *client, Channel *channel, char *para, int checkt,
((n = counttextbans(channel)) >= MAX_EXTBANT_PER_CHAN))
{
/* We check the # of bans in the channel, may not exceed MAX_EXTBANT_PER_CHAN */
sendnumeric(client, ERR_BANLISTFULL, channel->chname, para);
sendnumeric(client, ERR_BANLISTFULL, channel->name, para);
sendnotice(client, "Too many textbans for this channel");
return 0;
}
@@ -500,7 +500,7 @@ int textban_check_ban(Client *client, Channel *channel, char *ban, char **msg, c
gettimeofday(&tv_beta, NULL);
ircd_log(LOG_ERROR, "TextBan Timing: %ld microseconds (%s / %s / %d)",
((tv_beta.tv_sec - tv_alpha.tv_sec) * 1000000) + (tv_beta.tv_usec - tv_alpha.tv_usec),
client->name, channel->chname, strlen(*msg));
client->name, channel->name, strlen(*msg));
#endif
if (cleaned)
+5 -5
View File
@@ -398,7 +398,7 @@ EVENT(timedban_timeout)
* is too costly. So we stick with this. It should be
* good enough. Alternative would be some channel->id value.
*/
if (((unsigned int)channel->chname[1] % TIMEDBAN_TIMER_ITERATION_SPLIT) != current_iteration)
if (((unsigned int)channel->name[1] % TIMEDBAN_TIMER_ITERATION_SPLIT) != current_iteration)
continue; /* not this time, maybe next */
*mbuf = *pbuf = '\0';
@@ -433,8 +433,8 @@ EVENT(timedban_timeout)
{
MessageTag *mtags = NULL;
new_message(&me, NULL, &mtags);
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s %s %s", me.name, channel->chname, mbuf, pbuf);
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s %s %s 0", me.id, channel->chname, mbuf, pbuf);
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s %s %s", me.name, channel->name, mbuf, pbuf);
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s %s %s 0", me.id, channel->name, mbuf, pbuf);
free_message_tags(mtags);
*pbuf = 0;
}
@@ -484,8 +484,8 @@ void add_send_mode_param(Channel *channel, Client *from, char what, char mode, c
MessageTag *mtags = NULL;
new_message(&me, NULL, &mtags);
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s %s %s", me.name, channel->chname, mbuf, pbuf);
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s %s %s 0", me.id, channel->chname, mbuf, pbuf);
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s %s %s", me.name, channel->name, mbuf, pbuf);
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s %s %s 0", me.id, channel->name, mbuf, pbuf);
free_message_tags(mtags);
send = 0;
*pbuf = 0;
+4 -4
View File
@@ -82,7 +82,7 @@ CMD_FUNC(cmd_history)
return;
}
channel = find_channel(parv[1], NULL);
channel = find_channel(parv[1]);
if (!channel)
{
sendnumeric(client, ERR_NOSUCHCHANNEL, parv[1]);
@@ -91,13 +91,13 @@ CMD_FUNC(cmd_history)
if (!IsMember(client, channel))
{
sendnumeric(client, ERR_NOTONCHANNEL, channel->chname);
sendnumeric(client, ERR_NOTONCHANNEL, channel->name);
return;
}
if (!has_channel_mode(channel, 'H'))
{
sendnotice(client, "Channel %s does not have channel mode +H set", channel->chname);
sendnotice(client, "Channel %s does not have channel mode +H set", channel->name);
return;
}
@@ -125,7 +125,7 @@ CMD_FUNC(cmd_history)
filter.cmd = HFC_SIMPLE;
filter.last_lines = lines;
if ((r = history_request(channel->chname, &filter)))
if ((r = history_request(channel->name, &filter)))
{
history_send_result(client, r);
free_history_result(r);
+2 -2
View File
@@ -481,7 +481,7 @@ int hbm_modechar_del(Channel *channel, int modechar)
if (!cfg.persist)
return 0;
if ((modechar == 'P') && ((h = hbm_find_object(channel->chname))))
if ((modechar == 'P') && ((h = hbm_find_object(channel->name))))
{
/* Channel went from +P to -P and also has channel history: delete the history file */
hbm_delete_db(h);
@@ -1533,7 +1533,7 @@ static int hbm_write_db(HistoryLogObject *h)
if (!cfg.db_secret)
abort();
channel = find_channel(h->name, NULL);
channel = find_channel(h->name);
if (!channel || !has_channel_mode(channel, 'P'))
return 1; /* Don't save this channel, pretend success */
+22 -22
View File
@@ -198,7 +198,7 @@ void send_invite_list(Client *client)
for (inv = CLIENT_INVITES(client); inv; inv = inv->next)
{
sendnumeric(client, RPL_INVITELIST,
inv->value.channel->chname);
inv->value.channel->name);
}
sendnumeric(client, RPL_ENDOFINVITELIST);
}
@@ -226,7 +226,7 @@ void invite_process(Client *client, Client *target, Channel *channel, MessageTag
new_message(client, recv_mtags, &mtags);
/* broadcast to other servers */
sendto_server(client, 0, 0, mtags, ":%s INVITE %s %s %d", client->id, target->id, channel->chname, override);
sendto_server(client, 0, 0, mtags, ":%s INVITE %s %s %d", client->id, target->id, channel->name, override);
/* send chanops notifications */
if (IsUser(client) && (is_chan_op(client, channel)
@@ -240,20 +240,20 @@ void invite_process(Client *client, Client *target, Channel *channel, MessageTag
sendto_channel(channel, &me, NULL, PREFIX_OP|PREFIX_ADMIN|PREFIX_OWNER,
0, SEND_LOCAL, mtags,
":%s NOTICE @%s :OperOverride -- %s invited him/herself into the channel.",
me.name, channel->chname, client->name);
me.name, channel->name, client->name);
}
if (override == 0)
{
sendto_channel(channel, &me, NULL, PREFIX_OP|PREFIX_ADMIN|PREFIX_OWNER,
CAP_INVITE_NOTIFY | CAP_INVERT, SEND_LOCAL, mtags,
":%s NOTICE @%s :%s invited %s into the channel.",
me.name, channel->chname, client->name, target->name);
me.name, channel->name, client->name, target->name);
}
/* always send IRCv3 invite-notify if possible */
sendto_channel(channel, client, NULL, PREFIX_OP|PREFIX_ADMIN|PREFIX_OWNER,
CAP_INVITE_NOTIFY, SEND_LOCAL, mtags,
":%s INVITE %s %s",
client->name, target->name, channel->chname);
client->name, target->name, channel->name);
}
/* add to list and notify the person who got invited */
@@ -270,7 +270,7 @@ void invite_process(Client *client, Client *target, Channel *channel, MessageTag
if (!is_silenced(client, target))
{
sendto_prefix_one(target, client, mtags, ":%s INVITE %s :%s", client->name,
target->name, channel->chname);
target->name, channel->name);
}
}
free_message_tags(mtags);
@@ -295,7 +295,7 @@ CMD_FUNC(cmd_invite)
{
params_ok = 1;
target = find_person(parv[1], NULL);
channel = find_channel(parv[2], NULL);
channel = find_channel(parv[2]);
}
if (!MyConnect(client))
@@ -386,7 +386,7 @@ CMD_FUNC(cmd_invite)
{
override = 1;
} else {
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->chname);
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->name);
return;
}
}
@@ -396,17 +396,17 @@ CMD_FUNC(cmd_invite)
{
override = 1;
} else {
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->chname);
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->name);
return;
}
}
}
if (SPAMFILTER_VIRUSCHANDENY && SPAMFILTER_VIRUSCHAN &&
!strcasecmp(channel->chname, SPAMFILTER_VIRUSCHAN) &&
!strcasecmp(channel->name, SPAMFILTER_VIRUSCHAN) &&
!is_chan_op(client, channel) && !ValidatePermissionsForPath("immune:server-ban:viruschan",client,NULL,NULL,NULL))
{
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->chname);
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->name);
return;
}
@@ -422,7 +422,7 @@ CMD_FUNC(cmd_invite)
if (!override)
{
sendnumeric(client, RPL_INVITING, target->name, channel->chname);
sendnumeric(client, RPL_INVITING, target->name, channel->name);
if (target->user->away)
{
sendnumeric(client, RPL_AWAY, target->name, target->user->away);
@@ -435,33 +435,33 @@ CMD_FUNC(cmd_invite)
{
sendto_snomask_global(SNO_EYES,
"*** OperOverride -- %s (%s@%s) invited him/herself into %s (overriding +b).",
client->name, client->user->username, client->user->realhost, channel->chname);
client->name, client->user->username, client->user->realhost, channel->name);
/* Logging implementation added by XeRXeS */
ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) invited him/herself into %s (Overriding Ban).",
client->name, client->user->username, client->user->realhost, channel->chname);
client->name, client->user->username, client->user->realhost, channel->name);
}
else if (channel->mode.mode & MODE_INVITEONLY)
{
sendto_snomask_global(SNO_EYES,
"*** OperOverride -- %s (%s@%s) invited him/herself into %s (overriding +i).",
client->name, client->user->username, client->user->realhost, channel->chname);
client->name, client->user->username, client->user->realhost, channel->name);
/* Logging implementation added by XeRXeS */
ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) invited him/herself into %s (Overriding Invite Only)",
client->name, client->user->username, client->user->realhost, channel->chname);
client->name, client->user->username, client->user->realhost, channel->name);
}
else if (channel->mode.limit)
{
sendto_snomask_global(SNO_EYES,
"*** OperOverride -- %s (%s@%s) invited him/herself into %s (overriding +l).",
client->name, client->user->username, client->user->realhost, channel->chname);
client->name, client->user->username, client->user->realhost, channel->name);
/* Logging implementation added by XeRXeS */
ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) invited him/herself into %s (Overriding Limit)",
client->name, client->user->username, client->user->realhost, channel->chname);
client->name, client->user->username, client->user->realhost, channel->name);
}
@@ -469,22 +469,22 @@ CMD_FUNC(cmd_invite)
{
sendto_snomask_global(SNO_EYES,
"*** OperOverride -- %s (%s@%s) invited him/herself into %s (overriding +k).",
client->name, client->user->username, client->user->realhost, channel->chname);
client->name, client->user->username, client->user->realhost, channel->name);
/* Logging implementation added by XeRXeS */
ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) invited him/herself into %s (Overriding Key)",
client->name, client->user->username, client->user->realhost, channel->chname);
client->name, client->user->username, client->user->realhost, channel->name);
}
else if (has_channel_mode(channel, 'z'))
{
sendto_snomask_global(SNO_EYES,
"*** OperOverride -- %s (%s@%s) invited him/herself into %s (overriding +z).",
client->name, client->user->username, client->user->realhost, channel->chname);
client->name, client->user->username, client->user->realhost, channel->name);
/* Logging implementation added by XeRXeS */
ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) invited him/herself into %s (Overriding SSL/TLS-Only)",
client->name, client->user->username, client->user->realhost, channel->chname);
client->name, client->user->username, client->user->realhost, channel->name);
}
#ifdef OPEROVERRIDE_VERIFY
else if (channel->mode.mode & MODE_SECRET || channel->mode.mode & MODE_PRIVATE)
+21 -21
View File
@@ -146,7 +146,7 @@ int _can_join(Client *client, Channel *channel, char *key, char *parv[])
#ifndef NO_OPEROVERRIDE
#ifdef OPEROVERRIDE_VERIFY
if (ValidatePermissionsForPath("channel:override:privsecret",client,NULL,channel,NULL) && (channel->mode.mode & MODE_SECRET ||
channel->mode.mode & MODE_PRIVATE) && !is_autojoin_chan(channel->chname))
channel->mode.mode & MODE_PRIVATE) && !is_autojoin_chan(channel->name))
return (ERR_OPERSPVERIFY);
#endif
#endif
@@ -194,10 +194,10 @@ void _send_join_to_local_users(Client *client, Channel *channel, MessageTag *mta
long CAP_AWAY_NOTIFY = ClientCapabilityBit("away-notify");
ircsnprintf(joinbuf, sizeof(joinbuf), ":%s!%s@%s JOIN :%s",
client->name, client->user->username, GetHost(client), channel->chname);
client->name, client->user->username, GetHost(client), channel->name);
ircsnprintf(exjoinbuf, sizeof(exjoinbuf), ":%s!%s@%s JOIN %s %s :%s",
client->name, client->user->username, GetHost(client), channel->chname,
client->name, client->user->username, GetHost(client), channel->name,
IsLoggedIn(client) ? client->user->svid : "*",
client->info);
@@ -237,7 +237,7 @@ void _join_channel(Channel *channel, Client *client, MessageTag *recv_mtags, int
char *parv[] = { 0, 0 };
/* Same way as in SJOIN */
new_message_special(client, recv_mtags, &mtags, ":%s JOIN %s", client->name, channel->chname);
new_message_special(client, recv_mtags, &mtags, ":%s JOIN %s", client->name, channel->name);
new_message(&me, recv_mtags, &mtags_sjoin);
@@ -247,7 +247,7 @@ void _join_channel(Channel *channel, Client *client, MessageTag *recv_mtags, int
sendto_server(client, 0, 0, mtags_sjoin, ":%s SJOIN %lld %s :%s%s ",
me.id, (long long)channel->creationtime,
channel->chname, chfl_to_sjoin_symbol(flags), client->id);
channel->name, chfl_to_sjoin_symbol(flags), client->id);
if (MyUser(client))
{
@@ -260,13 +260,13 @@ void _join_channel(Channel *channel, Client *client, MessageTag *recv_mtags, int
{
channel->creationtime = TStime();
sendto_server(client, 0, 0, NULL, ":%s MODE %s + %lld",
me.id, channel->chname, (long long)channel->creationtime);
me.id, channel->name, (long long)channel->creationtime);
}
if (channel->topic)
{
sendnumeric(client, RPL_TOPIC, channel->chname, channel->topic);
sendnumeric(client, RPL_TOPICWHOTIME, channel->chname, channel->topic_nick,
sendnumeric(client, RPL_TOPIC, channel->name, channel->topic);
sendnumeric(client, RPL_TOPICWHOTIME, channel->name, channel->topic_nick,
channel->topic_time);
}
@@ -295,15 +295,15 @@ void _join_channel(Channel *channel, Client *client, MessageTag *recv_mtags, int
*modebuf = *parabuf = 0;
channel_modes(client, modebuf, parabuf, sizeof(modebuf), sizeof(parabuf), channel, 0);
/* This should probably be in the SJOIN stuff */
new_message_special(&me, recv_mtags, &mtags_mode, ":%s MODE %s %s %s", me.name, channel->chname, modebuf, parabuf);
new_message_special(&me, recv_mtags, &mtags_mode, ":%s MODE %s %s %s", me.name, channel->name, modebuf, parabuf);
sendto_server(NULL, 0, 0, mtags_mode, ":%s MODE %s %s %s %lld",
me.id, channel->chname, modebuf, parabuf, (long long)channel->creationtime);
sendto_one(client, mtags_mode, ":%s MODE %s %s %s", me.name, channel->chname, modebuf, parabuf);
me.id, channel->name, modebuf, parabuf, (long long)channel->creationtime);
sendto_one(client, mtags_mode, ":%s MODE %s %s %s", me.name, channel->name, modebuf, parabuf);
free_message_tags(mtags_mode);
}
parv[0] = client->name;
parv[1] = channel->chname;
parv[1] = channel->name;
do_cmd(client, NULL, "NAMES", 2, parv);
RunHook4(HOOKTYPE_LOCAL_JOIN, client, channel, mtags, parv);
@@ -383,7 +383,7 @@ void _do_join(Client *client, int parc, char *parv[])
if (MyConnect(client) && !valid_channelname(name))
{
send_invalid_channelname(client, name);
if (IsOper(client) && find_channel(name, NULL))
if (IsOper(client) && find_channel(name))
{
/* Give IRCOps a bit more information */
sendnotice(client, "Channel '%s' is unjoinable because it contains illegal characters. "
@@ -441,8 +441,8 @@ void _do_join(Client *client, int parc, char *parv[])
sendto_channel(channel, client, NULL, 0, 0, SEND_LOCAL, mtags,
":%s PART %s :%s",
client->name, channel->chname, "Left all channels");
sendto_server(client, 0, 0, mtags, ":%s PART %s :Left all channels", client->name, channel->chname);
client->name, channel->name, "Left all channels");
sendto_server(client, 0, 0, mtags, ":%s PART %s :Left all channels", client->name, channel->name);
if (MyConnect(client))
RunHook4(HOOKTYPE_LOCAL_PART, client, channel, mtags, "Left all channels");
@@ -513,7 +513,7 @@ void _do_join(Client *client, int parc, char *parv[])
!strcasecmp(name, SPAMFILTER_VIRUSCHAN) &&
!ValidatePermissionsForPath("immune:server-ban:viruschan",client,NULL,NULL,NULL) && !spamf_ugly_vchanoverride)
{
Channel *channel = find_channel(name, NULL);
Channel *channel = find_channel(name);
if (!channel || !is_invited(client, channel))
{
@@ -524,7 +524,7 @@ void _do_join(Client *client, int parc, char *parv[])
}
}
channel = get_channel(client, name, CREATE);
channel = make_channel(name);
if (channel && (lp = find_membership_link(client->user->channel, channel)))
continue;
@@ -713,20 +713,20 @@ void _userhost_changed(Client *client)
/* Prepare buffers for PART, JOIN, MODE */
ircsnprintf(partbuf, sizeof(partbuf), ":%s!%s@%s PART %s :%s",
remember_nick, remember_user, remember_host,
channel->chname,
channel->name,
"Changing host");
ircsnprintf(joinbuf, sizeof(joinbuf), ":%s!%s@%s JOIN %s",
client->name, client->user->username, GetHost(client), channel->chname);
client->name, client->user->username, GetHost(client), channel->name);
ircsnprintf(exjoinbuf, sizeof(exjoinbuf), ":%s!%s@%s JOIN %s %s :%s",
client->name, client->user->username, GetHost(client), channel->chname,
client->name, client->user->username, GetHost(client), channel->name,
IsLoggedIn(client) ? client->user->svid : "*",
client->info);
modes = get_chmodes_for_user(client, flags);
if (!BadPtr(modes))
ircsnprintf(modebuf, sizeof(modebuf), ":%s MODE %s %s", me.name, channel->chname, modes);
ircsnprintf(modebuf, sizeof(modebuf), ":%s MODE %s %s", me.name, channel->name, modes);
for (lp = channel->members; lp; lp = lp->next)
{
+6 -6
View File
@@ -40,7 +40,7 @@ typedef struct JoinFlood JoinFlood;
struct JoinFlood {
JoinFlood *prev, *next;
char chname[CHANNELLEN+1];
char name[CHANNELLEN+1];
time_t firstjoin;
unsigned short numjoins;
};
@@ -104,7 +104,7 @@ static int isjthrottled(Client *client, Channel *channel)
/* Grab user<->chan entry.. */
for (e = moddata_local_client(client, jointhrottle_md).ptr; e; e=e->next)
if (!strcasecmp(e->chname, channel->chname))
if (!strcasecmp(e->name, channel->name))
break;
if (!e)
@@ -129,7 +129,7 @@ static void jointhrottle_increase_usercounter(Client *client, Channel *channel)
/* Grab user<->chan entry.. */
for (e = moddata_local_client(client, jointhrottle_md).ptr; e; e=e->next)
if (!strcasecmp(e->chname, channel->chname))
if (!strcasecmp(e->name, channel->name))
break;
if (!e)
@@ -175,12 +175,12 @@ JoinFlood *jointhrottle_addentry(Client *client, Channel *channel)
abort();
for (e=moddata_local_client(client, jointhrottle_md).ptr; e; e=e->next)
if (!strcasecmp(e->chname, channel->chname))
if (!strcasecmp(e->name, channel->name))
abort(); /* already exists -- should never happen */
#endif
e = safe_alloc(sizeof(JoinFlood));
strlcpy(e->chname, channel->chname, sizeof(e->chname));
strlcpy(e->name, channel->name, sizeof(e->name));
/* Insert our new entry as (new) head */
if (moddata_local_client(client, jointhrottle_md).ptr)
@@ -213,7 +213,7 @@ EVENT(jointhrottle_cleanup_structs)
continue; /* still valid entry */
#ifdef DEBUGMODE
ircd_log(LOG_ERROR, "jointhrottle_cleanup_structs(): freeing %s/%s (%ld[%ld], %ld)",
client->name, jf->chname, jf->firstjoin, (long)(TStime() - jf->firstjoin),
client->name, jf->name, jf->firstjoin, (long)(TStime() - jf->firstjoin),
iConf.floodsettings->period[FLD_JOIN]);
#endif
if (moddata_local_client(client, jointhrottle_md).ptr == jf)
+13 -13
View File
@@ -84,7 +84,7 @@ void _kick_user(MessageTag *initial_mtags, Channel *channel, Client *client, Cli
new_message(client, NULL, &initial_mtags);
}
new_message_special(client, initial_mtags, &mtags, ":%s KICK %s %s", client->name, channel->chname, victim->name);
new_message_special(client, initial_mtags, &mtags, ":%s KICK %s %s", client->name, channel->name, victim->name);
/* The same message is actually sent at 5 places below (though max 4 at most) */
if (MyUser(client))
@@ -99,22 +99,22 @@ void _kick_user(MessageTag *initial_mtags, Channel *channel, Client *client, Cli
PREFIX_HALFOP|PREFIX_OP|PREFIX_OWNER|PREFIX_ADMIN, 0,
SEND_LOCAL, mtags,
":%s KICK %s %s :%s",
client->name, channel->chname, victim->name, comment);
client->name, channel->name, victim->name, comment);
if (MyUser(victim))
{
sendto_prefix_one(victim, client, mtags, ":%s KICK %s %s :%s",
client->name, channel->chname, victim->name, comment);
client->name, channel->name, victim->name, comment);
}
} else {
/* NORMAL */
sendto_channel(channel, client, NULL, 0, 0, SEND_LOCAL, mtags,
":%s KICK %s %s :%s",
client->name, channel->chname, victim->name, comment);
client->name, channel->name, victim->name, comment);
}
sendto_server(client, 0, 0, mtags, ":%s KICK %s %s :%s",
client->id, channel->chname, victim->id, comment);
client->id, channel->name, victim->id, comment);
free_message_tags(mtags);
if (initial_mtags_generated)
@@ -166,7 +166,7 @@ CMD_FUNC(cmd_kick)
for (; (name = strtoken(&p, parv[1], ",")); parv[1] = NULL)
{
long client_flags = 0;
channel = get_channel(client, name, !CREATE);
channel = find_channel(name);
if (!channel)
{
sendnumeric(client, ERR_NOSUCHCHANNEL, name);
@@ -178,7 +178,7 @@ CMD_FUNC(cmd_kick)
if (MyUser(client) && !IsULine(client) && !op_can_override("channel:override:kick:no-ops",client,channel,NULL)
&& !(client_flags & CHFL_ISOP) && !(client_flags & CHFL_HALFOP))
{
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->chname);
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->name);
continue;
}
@@ -250,10 +250,10 @@ CMD_FUNC(cmd_kick)
sendto_snomask(SNO_EYES,
"*** OperOverride -- %s (%s@%s) KICK %s %s (%s)",
client->name, client->user->username, client->user->realhost,
channel->chname, who->name, comment);
channel->name, who->name, comment);
ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) KICK %s %s (%s)",
client->name, client->user->username, client->user->realhost,
channel->chname, who->name, comment);
channel->name, who->name, comment);
goto attack; /* all other checks don't matter anymore (and could cause double msgs) */
} else {
/* Not an oper overriding */
@@ -277,12 +277,12 @@ CMD_FUNC(cmd_kick)
sendto_snomask(SNO_EYES,
"*** OperOverride -- %s (%s@%s) KICK %s %s (%s)",
client->name, client->user->username, client->user->realhost,
channel->chname, who->name, comment);
channel->name, who->name, comment);
/* Logging Implementation added by XeRXeS */
ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) KICK %s %s (%s)",
client->name, client->user->username, client->user->realhost,
channel->chname, who->name, comment);
channel->name, who->name, comment);
goto attack;
} /* is_chan_op */
@@ -299,12 +299,12 @@ CMD_FUNC(cmd_kick)
sendto_snomask(SNO_EYES,
"*** OperOverride -- %s (%s@%s) KICK %s %s (%s)",
client->name, client->user->username, client->user->realhost,
channel->chname, who->name, comment);
channel->name, who->name, comment);
/* Logging Implementation added by XeRXeS */
ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) KICK %s %s (%s)",
client->name, client->user->username, client->user->realhost,
channel->chname, who->name, comment);
channel->name, who->name, comment);
goto attack;
}
+7 -7
View File
@@ -97,7 +97,7 @@ CMD_FUNC(cmd_knock)
return;
}
if (!(channel = find_channel(parv[1], NULL)))
if (!(channel = find_channel(parv[1])))
{
sendnumeric(client, ERR_CANNOTKNOCK, parv[1], "Channel does not exist!");
return;
@@ -106,19 +106,19 @@ CMD_FUNC(cmd_knock)
/* IsMember bugfix by codemastr */
if (IsMember(client, channel) == 1)
{
sendnumeric(client, ERR_CANNOTKNOCK, channel->chname, "You're already there!");
sendnumeric(client, ERR_CANNOTKNOCK, channel->name, "You're already there!");
return;
}
if (!(channel->mode.mode & MODE_INVITEONLY))
{
sendnumeric(client, ERR_CANNOTKNOCK, channel->chname, "Channel is not invite only!");
sendnumeric(client, ERR_CANNOTKNOCK, channel->name, "Channel is not invite only!");
return;
}
if (is_banned(client, channel, BANCHK_JOIN, NULL, NULL))
{
sendnumeric(client, ERR_CANNOTKNOCK, channel->chname, "You're banned!");
sendnumeric(client, ERR_CANNOTKNOCK, channel->name, "You're banned!");
return;
}
@@ -145,14 +145,14 @@ CMD_FUNC(cmd_knock)
sendto_channel(channel, &me, NULL, PREFIX_OP|PREFIX_ADMIN|PREFIX_OWNER,
0, SEND_LOCAL, mtags,
":%s NOTICE @%s :[Knock] by %s!%s@%s (%s)",
me.name, channel->chname,
me.name, channel->name,
client->name, client->user->username, GetHost(client),
reason);
sendto_server(client, 0, 0, mtags, ":%s KNOCK %s :%s", client->id, channel->chname, reason);
sendto_server(client, 0, 0, mtags, ":%s KNOCK %s :%s", client->id, channel->name, reason);
if (MyUser(client))
sendnotice(client, "Knocked on %s", channel->chname);
sendnotice(client, "Knocked on %s", channel->name);
RunHook4(HOOKTYPE_KNOCK, client, channel, mtags, parv[2]);
+9 -9
View File
@@ -269,7 +269,7 @@ CMD_FUNC(cmd_list)
}
else /* Just a normal channel */
{
channel = find_channel(name, NULL);
channel = find_channel(name);
if (channel && (ShowChannel(client, channel) || ValidatePermissionsForPath("channel:see:list:secret",client,NULL,channel,NULL))) {
#ifdef LIST_SHOW_MODES
modebuf[0] = '[';
@@ -343,9 +343,9 @@ int send_list(Client *client)
ConfigItem_offchans *x;
for (x = conf_offchans; x; x = x->next)
{
if (find_channel(x->chname, NULL))
if (find_channel(x->name))
continue; /* exists, >0 users.. will be sent later */
sendnumeric(client, RPL_LIST, x->chname,
sendnumeric(client, RPL_LIST, x->name,
0,
#ifdef LIST_SHOW_MODES
"",
@@ -366,11 +366,11 @@ int send_list(Client *client)
continue;
/* set::hide-list { deny-channel } */
if (!IsOper(client) && iConf.hide_list && find_channel_allowed(client, channel->chname))
if (!IsOper(client) && iConf.hide_list && find_channel_allowed(client, channel->name))
continue;
/* Similarly, hide unjoinable channels for non-ircops since it would be confusing */
if (!IsOper(client) && !valid_channelname(channel->chname))
if (!IsOper(client) && !valid_channelname(channel->name))
continue;
/* Much more readable like this -- codemastr */
@@ -394,11 +394,11 @@ int send_list(Client *client)
continue;
/* Must not be on nolist (if it exists) */
if (lopt->nolist && find_name_list_match(lopt->nolist, channel->chname))
if (lopt->nolist && find_name_list_match(lopt->nolist, channel->name))
continue;
/* Must be on yeslist (if it exists) */
if (lopt->yeslist && !find_name_list_match(lopt->yeslist, channel->chname))
if (lopt->yeslist && !find_name_list_match(lopt->yeslist, channel->name))
continue;
}
#ifdef LIST_SHOW_MODES
@@ -412,7 +412,7 @@ int send_list(Client *client)
if (!ValidatePermissionsForPath("channel:see:list:secret",client,NULL,channel,NULL))
sendnumeric(client, RPL_LIST,
ShowChannel(client,
channel) ? channel->chname :
channel) ? channel->name :
"*", channel->users,
#ifdef LIST_SHOW_MODES
ShowChannel(client, channel) ?
@@ -422,7 +422,7 @@ int send_list(Client *client)
channel) ? (channel->topic ?
channel->topic : "") : "");
else
sendnumeric(client, RPL_LIST, channel->chname,
sendnumeric(client, RPL_LIST, channel->name,
channel->users,
#ifdef LIST_SHOW_MODES
modebuf,
+12 -12
View File
@@ -138,7 +138,7 @@ CMD_FUNC(cmd_md)
} else
if (!strcmp(type, "channel"))
{
Channel *channel = find_channel(objname, NULL);
Channel *channel = find_channel(objname);
md = findmoddata_byname(varname, MODDATATYPE_CHANNEL);
if (!md || !md->unserialize || !channel)
return;
@@ -166,7 +166,7 @@ CMD_FUNC(cmd_md)
return;
*p++ = '\0';
channel = find_channel(objname, NULL);
channel = find_channel(objname);
if (!channel)
return;
@@ -213,7 +213,7 @@ CMD_FUNC(cmd_md)
if (!target)
return;
channel = find_channel(p, NULL);
channel = find_channel(p);
if (!channel)
return;
@@ -276,10 +276,10 @@ void _broadcast_md_channel_cmd(Client *except, Client *sender, Channel *channel,
{
if (value)
sendto_server(except, 0, 0, NULL, ":%s MD %s %s %s :%s",
sender->id, "channel", channel->chname, varname, value);
sender->id, "channel", channel->name, varname, value);
else
sendto_server(except, 0, 0, NULL, ":%s MD %s %s %s",
sender->id, "channel", channel->chname, varname);
sender->id, "channel", channel->name, varname);
}
void _broadcast_md_member_cmd(Client *except, Client *sender, Channel *channel, Client *client, char *varname, char *value)
@@ -287,12 +287,12 @@ void _broadcast_md_member_cmd(Client *except, Client *sender, Channel *channel,
if (value)
{
sendto_server(except, 0, 0, NULL, ":%s MD %s %s:%s %s :%s",
sender->id, "member", channel->chname, client->id, varname, value);
sender->id, "member", channel->name, client->id, varname, value);
}
else
{
sendto_server(except, 0, 0, NULL, ":%s MD %s %s:%s %s",
sender->id, "member", channel->chname, client->id, varname);
sender->id, "member", channel->name, client->id, varname);
}
}
@@ -301,12 +301,12 @@ void _broadcast_md_membership_cmd(Client *except, Client *sender, Client *client
if (value)
{
sendto_server(except, 0, 0, NULL, ":%s MD %s %s:%s %s :%s",
sender->id, "membership", client->id, channel->chname, varname, value);
sender->id, "membership", client->id, channel->name, varname, value);
}
else
{
sendto_server(except, 0, 0, NULL, ":%s MD %s %s:%s %s",
sender->id, "membership", client->id, channel->chname, varname);
sender->id, "membership", client->id, channel->name, varname);
}
}
@@ -394,7 +394,7 @@ void _send_moddata_channel(Client *srv, Channel *channel)
char *value = mdi->serialize(&moddata_channel(channel, mdi));
if (value)
sendto_one(srv, NULL, ":%s MD %s %s %s :%s",
me.id, "channel", channel->chname, mdi->name, value);
me.id, "channel", channel->name, mdi->name, value);
}
}
}
@@ -421,7 +421,7 @@ void _send_moddata_members(Client *srv)
char *value = mdi->serialize(&moddata_member(m, mdi));
if (value)
sendto_one(srv, NULL, ":%s MD %s %s:%s %s :%s",
me.id, "member", channel->chname, client->id, mdi->name, value);
me.id, "member", channel->name, client->id, mdi->name, value);
}
}
}
@@ -445,7 +445,7 @@ void _send_moddata_members(Client *srv)
char *value = mdi->serialize(&moddata_membership(m, mdi));
if (value)
sendto_one(srv, NULL, ":%s MD %s %s:%s %s :%s",
me.id, "membership", client->id, m->channel->chname, mdi->name, value);
me.id, "membership", client->id, m->channel->name, mdi->name, value);
}
}
}
+6 -6
View File
@@ -104,7 +104,7 @@ CMD_FUNC(cmd_mdex)
} else
if (!strcmp(type, "channel"))
{
Channel *channel = find_channel(objname, NULL);
Channel *channel = find_channel(objname);
md = findmoddata_byname(varname, MODDATATYPE_CHANNEL);
if (!md || !md->unserialize || !md->free || !channel)
return 0;
@@ -130,7 +130,7 @@ CMD_FUNC(cmd_mdex)
return 0;
*p++ = '\0';
channel = find_channel(objname, NULL);
channel = find_channel(objname);
if (!channel)
return 0;
@@ -172,7 +172,7 @@ CMD_FUNC(cmd_mdex)
if (!target)
return 0;
channel = find_channel(p, NULL);
channel = find_channel(p);
if (!channel)
return 0;
@@ -212,7 +212,7 @@ CMD_FUNC(cmd_mdex)
} else
if (!strcmp(type, "channel"))
{
Channel *channel = find_channel(objname, NULL);
Channel *channel = find_channel(objname);
char *str;
md = findmoddata_byname(varname, MODDATATYPE_CHANNEL);
@@ -237,7 +237,7 @@ CMD_FUNC(cmd_mdex)
return 0;
*p++ = '\0';
channel = find_channel(objname, NULL);
channel = find_channel(objname);
if (!channel)
return 0;
@@ -276,7 +276,7 @@ CMD_FUNC(cmd_mdex)
if (!target)
return 0;
channel = find_channel(p, NULL);
channel = find_channel(p);
if (!channel)
return 0;
+8 -8
View File
@@ -244,14 +244,14 @@ int can_send_to_prefix(Client *client, Channel *channel, int prefix)
*/
if (!lp || !(lp->flags & (CHFL_VOICE|CHFL_HALFOP|CHFL_CHANOP|CHFL_CHANOWNER|CHFL_CHANADMIN)))
{
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->chname);
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->name);
return 0;
}
if (!(prefix & PREFIX_OP) && ((prefix & PREFIX_OWNER) || (prefix & PREFIX_ADMIN)) &&
!(lp->flags & (CHFL_CHANOP|CHFL_CHANOWNER|CHFL_CHANADMIN)))
{
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->chname);
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->name);
return 0;
}
@@ -334,7 +334,7 @@ void cmd_message(Client *client, MessageTag *recv_mtags, int parc, char *parv[],
prefix = 0;
/* Message to channel */
if (p2 && (channel = find_channel(p2, NULL)))
if (p2 && (channel = find_channel(p2)))
{
prefix = prefix_string_to_values(targetstr, p2);
if (prefix)
@@ -345,15 +345,15 @@ void cmd_message(Client *client, MessageTag *recv_mtags, int parc, char *parv[],
* Eg: @&~#chan becomes @#chan
*/
pfixchan[0] = prefix_values_to_char(prefix);
strlcpy(pfixchan+1, channel->chname, sizeof(pfixchan)-1);
strlcpy(pfixchan+1, channel->name, sizeof(pfixchan)-1);
targetstr = pfixchan;
} else {
/* Replace target so the privmsg always goes to the "official" channel name */
strlcpy(pfixchan, channel->chname, sizeof(pfixchan));
strlcpy(pfixchan, channel->name, sizeof(pfixchan));
targetstr = pfixchan;
}
if (IsVirus(client) && strcasecmp(channel->chname, SPAMFILTER_VIRUSCHAN))
if (IsVirus(client) && strcasecmp(channel->name, SPAMFILTER_VIRUSCHAN))
{
sendnotice(client, "You are only allowed to talk in '%s'", SPAMFILTER_VIRUSCHAN);
continue;
@@ -372,7 +372,7 @@ void cmd_message(Client *client, MessageTag *recv_mtags, int parc, char *parv[],
if (IsDead(client))
return;
if (!IsDead(client) && (sendtype != SEND_TYPE_NOTICE) && errmsg)
sendnumeric(client, ERR_CANNOTSENDTOCHAN, channel->chname, errmsg, p2);
sendnumeric(client, ERR_CANNOTSENDTOCHAN, channel->name, errmsg, p2);
continue; /* skip delivery to this target */
}
}
@@ -389,7 +389,7 @@ void cmd_message(Client *client, MessageTag *recv_mtags, int parc, char *parv[],
{
int spamtype = (sendtype == SEND_TYPE_NOTICE ? SPAMF_CHANNOTICE : SPAMF_CHANMSG);
if (match_spamfilter(client, text, spamtype, cmd, channel->chname, 0, NULL))
if (match_spamfilter(client, text, spamtype, cmd, channel->name, 0, NULL))
return;
}
+39 -39
View File
@@ -105,7 +105,7 @@ CMD_FUNC(cmd_mode)
{
if (*parv[1] == '#')
{
channel = find_channel(parv[1], NULL);
channel = find_channel(parv[1]);
if (!channel)
{
cmd_umode(client, recv_mtags, parc, parv);
@@ -134,8 +134,8 @@ CMD_FUNC(cmd_mode)
modebuf[1] = '\0';
channel_modes(client, modebuf, parabuf, sizeof(modebuf), sizeof(parabuf), channel, 0);
sendnumeric(client, RPL_CHANNELMODEIS, channel->chname, modebuf, parabuf);
sendnumeric(client, RPL_CREATIONTIME, channel->chname, channel->creationtime);
sendnumeric(client, RPL_CHANNELMODEIS, channel->name, modebuf, parabuf);
sendnumeric(client, RPL_CREATIONTIME, channel->name, channel->creationtime);
return;
}
@@ -154,8 +154,8 @@ CMD_FUNC(cmd_mode)
return;
/* send ban list */
for (ban = channel->banlist; ban; ban = ban->next)
sendnumeric(client, RPL_BANLIST, channel->chname, ban->banstr, ban->who, ban->when);
sendnumeric(client, RPL_ENDOFBANLIST, channel->chname);
sendnumeric(client, RPL_BANLIST, channel->name, ban->banstr, ban->who, ban->when);
sendnumeric(client, RPL_ENDOFBANLIST, channel->name);
return;
}
@@ -165,8 +165,8 @@ CMD_FUNC(cmd_mode)
return;
/* send exban list */
for (ban = channel->exlist; ban; ban = ban->next)
sendnumeric(client, RPL_EXLIST, channel->chname, ban->banstr, ban->who, ban->when);
sendnumeric(client, RPL_ENDOFEXLIST, channel->chname);
sendnumeric(client, RPL_EXLIST, channel->name, ban->banstr, ban->who, ban->when);
sendnumeric(client, RPL_ENDOFEXLIST, channel->name);
return;
}
@@ -175,8 +175,8 @@ CMD_FUNC(cmd_mode)
if (!IsMember(client, channel) && !ValidatePermissionsForPath("channel:see:mode:remoteinvexlist",client,NULL,channel,NULL))
return;
for (ban = channel->invexlist; ban; ban = ban->next)
sendnumeric(client, RPL_INVEXLIST, channel->chname, ban->banstr, ban->who, ban->when);
sendnumeric(client, RPL_ENDOFINVEXLIST, channel->chname);
sendnumeric(client, RPL_INVEXLIST, channel->name, ban->banstr, ban->who, ban->when);
sendnumeric(client, RPL_ENDOFINVEXLIST, channel->name);
return;
}
@@ -190,9 +190,9 @@ CMD_FUNC(cmd_mode)
for (member = channel->members; member; member = member->next)
{
if (is_chanowner(member->client, channel))
sendnumeric(client, RPL_QLIST, channel->chname, member->client->name);
sendnumeric(client, RPL_QLIST, channel->name, member->client->name);
}
sendnumeric(client, RPL_ENDOFQLIST, channel->chname);
sendnumeric(client, RPL_ENDOFQLIST, channel->name);
return;
}
@@ -206,9 +206,9 @@ CMD_FUNC(cmd_mode)
for (member = channel->members; member; member = member->next)
{
if (is_chanadmin(member->client, channel))
sendnumeric(client, RPL_ALIST, channel->chname, member->client->name);
sendnumeric(client, RPL_ALIST, channel->name, member->client->name);
}
sendnumeric(client, RPL_ENDOFALIST, channel->chname);
sendnumeric(client, RPL_ENDOFALIST, channel->name);
return;
}
}
@@ -239,11 +239,11 @@ CMD_FUNC(cmd_mode)
{
if (MyUser(client))
{
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->chname);
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->name);
return;
}
sendto_one(client, NULL, ":%s MODE %s -oh %s %s 0",
me.name, channel->chname, client->name, client->name);
me.name, channel->name, client->name, client->name);
/* Tell the other server that the user is
* de-opped. Fix op desyncs. */
bounce_mode(channel, client, parc - 2, parv + 2);
@@ -259,7 +259,7 @@ CMD_FUNC(cmd_mode)
/* !!! */
sendto_snomask(SNO_EYES,
"*** TS bounce for %s - %lld(ours) %lld(theirs)",
channel->chname, (long long)channel->creationtime,
channel->name, (long long)channel->creationtime,
(long long)sendts);
bounce_mode(channel, client, parc - 2, parv + 2);
}
@@ -317,7 +317,7 @@ static void mode_cutoff2(Client *client, Channel *channel, int *parc_out, char *
/* Calculate length of MODE if it would go through fully as-is */
/* :nick!user@host MODE #channel +something param1 param2 etc... */
len = strlen(client->name) + strlen(client->user->username) + strlen(GetHost(client)) +
strlen(channel->chname) + 11;
strlen(channel->name) + 11;
len += strlen(parv[2]);
@@ -376,9 +376,9 @@ static void bounce_mode(Channel *channel, Client *client, int parc, char *parv[]
if (channel->creationtime)
sendto_one(client, NULL, ":%s MODE %s &%s %s %lld", me.id,
channel->chname, modebuf, parabuf, (long long)channel->creationtime);
channel->name, modebuf, parabuf, (long long)channel->creationtime);
else
sendto_one(client, NULL, ":%s MODE %s &%s %s", me.id, channel->chname,
sendto_one(client, NULL, ":%s MODE %s &%s %s", me.id, channel->name,
modebuf, parabuf);
/* the '&' denotes a bounce so servers won't bounce a bounce */
@@ -424,9 +424,9 @@ void _do_mode(Channel *channel, Client *client, MessageTag *recv_mtags, int parc
{
sendto_realops(
"Warning! Possible desync: MODE for channel %s ('%s %s') has fishy timestamp (%lld) (from %s/%s)",
channel->chname, modebuf, parabuf, (long long)sendts, client->direction->name, client->name);
channel->name, modebuf, parabuf, (long long)sendts, client->direction->name, client->name);
ircd_log(LOG_ERROR, "Possible desync: MODE for channel %s ('%s %s') has fishy timestamp (%lld) (from %s/%s)",
channel->chname, modebuf, parabuf, (long long)sendts, client->direction->name, client->name);
channel->name, modebuf, parabuf, (long long)sendts, client->direction->name, client->name);
}
/* new chan or our timestamp is wrong */
/* now works for double-bounce prevention */
@@ -437,7 +437,7 @@ void _do_mode(Channel *channel, Client *client, MessageTag *recv_mtags, int parc
/* theirs is wrong but we let it pass anyway */
sendts = channel->creationtime;
sendto_one(client, NULL, ":%s MODE %s + %lld", me.name,
channel->chname, (long long)channel->creationtime);
channel->name, (long long)channel->creationtime);
}
}
if (sendts == -1 && channel->creationtime)
@@ -452,11 +452,11 @@ void _do_mode(Channel *channel, Client *client, MessageTag *recv_mtags, int parc
if (channel->creationtime)
{
sendto_server(client, 0, 0, NULL, ":%s MODE %s %s+ %lld",
me.id, channel->chname, isbounce ? "&" : "",
me.id, channel->name, isbounce ? "&" : "",
(long long)channel->creationtime);
} else {
sendto_server(client, 0, 0, NULL, ":%s MODE %s %s+",
me.id, channel->chname, isbounce ? "&" : "");
me.id, channel->name, isbounce ? "&" : "");
}
free_message_tags(mtags);
return; /* nothing to send */
@@ -472,12 +472,12 @@ void _do_mode(Channel *channel, Client *client, MessageTag *recv_mtags, int parc
sendto_snomask(SNO_EYES,
"*** OperOverride -- %s (%s@%s) MODE %s %s %s",
client->name, client->user->username, client->user->realhost,
channel->chname, modebuf, parabuf);
channel->name, modebuf, parabuf);
/* Logging Implementation added by XeRXeS */
ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) MODE %s %s %s",
client->name, client->user->username, client->user->realhost,
channel->chname, modebuf, parabuf);
channel->name, modebuf, parabuf);
}
sendts = 0;
@@ -495,7 +495,7 @@ void _do_mode(Channel *channel, Client *client, MessageTag *recv_mtags, int parc
{
if (!sajoinmode)
sendto_umode_global(UMODE_OPER, "%s used SAMODE %s (%s%s%s)",
client->name, channel->chname, modebuf, *parabuf ? " " : "", parabuf);
client->name, channel->name, modebuf, *parabuf ? " " : "", parabuf);
client = &me;
sendts = 0;
@@ -503,13 +503,13 @@ void _do_mode(Channel *channel, Client *client, MessageTag *recv_mtags, int parc
sendto_channel(channel, client, NULL, 0, 0, SEND_LOCAL, mtags,
":%s MODE %s %s %s",
client->name, channel->chname, modebuf, parabuf);
client->name, channel->name, modebuf, parabuf);
if (IsServer(client) && sendts != -1)
{
sendto_server(client, 0, 0, mtags,
":%s MODE %s %s%s %s %lld",
client->id, channel->chname,
client->id, channel->name,
isbounce ? "&" : "", modebuf, parabuf,
(long long)sendts);
} else
@@ -518,12 +518,12 @@ void _do_mode(Channel *channel, Client *client, MessageTag *recv_mtags, int parc
/* SAMODE is a special case: always send a TS of 0 (omitting TS==desync) */
sendto_server(client, 0, 0, mtags,
":%s MODE %s %s %s 0",
client->id, channel->chname, modebuf, parabuf);
client->id, channel->name, modebuf, parabuf);
} else
{
sendto_server(client, 0, 0, mtags,
":%s MODE %s %s%s %s",
client->id, channel->chname, isbounce ? "&" : "", modebuf, parabuf);
client->id, channel->name, isbounce ? "&" : "", modebuf, parabuf);
/* tell them it's not a timestamp, in case the last param
** is a number. */
}
@@ -778,7 +778,7 @@ int do_mode_char(Channel *channel, long modetype, char modechar, char *param,
case MODE_RGSTR:
if (!IsServer(client) && !IsULine(client))
{
sendnumeric(client, ERR_ONLYSERVERSCANCHANGE, channel->chname);
sendnumeric(client, ERR_ONLYSERVERSCANCHANGE, channel->name);
break;
}
goto setmode;
@@ -813,7 +813,7 @@ int do_mode_char(Channel *channel, long modetype, char modechar, char *param,
{
if (MyUser(client) && !op_can_override("channel:override:mode",client,channel,&modetype))
{
sendnumeric(client, ERR_CHANOWNPRIVNEEDED, channel->chname);
sendnumeric(client, ERR_CHANOWNPRIVNEEDED, channel->name);
break;
}
if (!is_half_op(client, channel)) /* htrig will take care of halfop override notices */
@@ -828,7 +828,7 @@ int do_mode_char(Channel *channel, long modetype, char modechar, char *param,
{
if (MyUser(client) && !op_can_override("channel:override:mode",client,channel,&modetype))
{
sendnumeric(client, ERR_CHANOWNPRIVNEEDED, channel->chname);
sendnumeric(client, ERR_CHANOWNPRIVNEEDED, channel->name);
break;
}
if (!is_half_op(client, channel)) /* htrig will take care of halfop override notices */
@@ -847,7 +847,7 @@ process_listmode:
break;
if (!(membership = find_membership_link(target->user->channel, channel)))
{
sendnumeric(client, ERR_USERNOTINCHANNEL, target->name, channel->chname);
sendnumeric(client, ERR_USERNOTINCHANNEL, target->name, channel->name);
break;
}
member = find_member_link(channel->members, target);
@@ -1458,7 +1458,7 @@ void _set_mode(Channel *channel, Client *client, int parc, char *parv[], u_int *
{
if (!sent_mlock_warning)
{
sendnumeric(client, ERR_MLOCKRESTRICTED, channel->chname, *curchr, channel->mode_lock);
sendnumeric(client, ERR_MLOCKRESTRICTED, channel->name, *curchr, channel->mode_lock);
sent_mlock_warning++;
}
continue;
@@ -1566,13 +1566,13 @@ void _set_mode(Channel *channel, Client *client, int parc, char *parv[], u_int *
{
sendto_snomask(SNO_EYES, "*** OperOverride -- %s (%s@%s) MODE %s %s %s",
client->name, client->user->username, client->user->realhost,
channel->chname, modebuf, parabuf);
channel->name, modebuf, parabuf);
}
/* Logging Implementation added by XeRXeS */
ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) MODE %s %s %s",
client->name, client->user->username, client->user->realhost,
channel->chname, modebuf, parabuf);
channel->name, modebuf, parabuf);
htrig = 0;
opermode = 0; /* stop double override notices... but is this ok??? -- Syzop */
@@ -1932,7 +1932,7 @@ CMD_FUNC(cmd_mlock)
t = (time_t) atol(parv[1]);
/* Now, try to find the channel in question */
channel = find_channel(parv[2], NULL);
channel = find_channel(parv[2]);
if (!channel)
return;
+2 -2
View File
@@ -97,7 +97,7 @@ CMD_FUNC(cmd_names)
}
}
channel = find_channel(para, NULL);
channel = find_channel(para);
if (!channel || (!ShowChannel(client, channel) && !ValidatePermissionsForPath("channel:see:names:secret",client,NULL,channel,NULL)))
{
@@ -117,7 +117,7 @@ CMD_FUNC(cmd_names)
idx = 1;
buf[idx++] = ' ';
for (s = channel->chname; *s; s++)
for (s = channel->name; *s; s++)
buf[idx++] = *s;
buf[idx++] = ' ';
buf[idx++] = ':';
+36 -43
View File
@@ -413,12 +413,12 @@ CMD_FUNC(cmd_nick_local)
if (!is_skochanop(client, mp->channel) && is_banned(client, mp->channel, BANCHK_NICK, NULL, NULL))
{
sendnumeric(client, ERR_BANNICKCHANGE,
mp->channel->chname);
mp->channel->name);
return;
}
if (CHECK_TARGET_NICK_BANS && !is_skochanop(client, mp->channel) && is_banned_with_nick(client, mp->channel, BANCHK_NICK, nick, NULL, NULL))
{
sendnumeric(client, ERR_BANNICKCHANGE, mp->channel->chname);
sendnumeric(client, ERR_BANNICKCHANGE, mp->channel->name);
return;
}
@@ -432,7 +432,7 @@ CMD_FUNC(cmd_nick_local)
if (i == HOOK_DENY)
{
sendnumeric(client, ERR_NONICKCHANGE,
mp->channel->chname);
mp->channel->name);
return;
}
}
@@ -734,7 +734,6 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char
userbad[USERLEN * 2 + 1], *ubad = userbad, noident = 0;
int i, xx;
Hook *h;
User *user = client->user;
char *tkllayer[9] = {
me.name, /*0 server.name */
"+", /*1 +|- */
@@ -773,18 +772,18 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char
/* if host contained invalid ASCII _OR_ the DNS reply is an IP-like reply
* (like: 1.2.3.4 or ::ffff:1.2.3.4), then reject it and use IP instead.
*/
if (*tmpstr || !*user->realhost || (isdigit(*client->local->sockhost) && (client->local->sockhost > tmpstr && isdigit(*(tmpstr - 1))) )
if (*tmpstr || !*client->user->realhost || (isdigit(*client->local->sockhost) && (client->local->sockhost > tmpstr && isdigit(*(tmpstr - 1))) )
|| (client->local->sockhost[0] == ':'))
strlcpy(client->local->sockhost, client->ip, sizeof(client->local->sockhost));
}
if (client->local->sockhost[0])
{
strlcpy(user->realhost, client->local->sockhost, sizeof(client->local->sockhost)); /* SET HOSTNAME */
strlcpy(client->user->realhost, client->local->sockhost, sizeof(client->local->sockhost)); /* SET HOSTNAME */
} else {
sendto_realops("[HOSTNAME BUG] client->local->sockhost is empty for user %s (%s, %s)",
client->name, client->ip ? client->ip : "<null>", user->realhost);
client->name, client->ip ? client->ip : "<null>", client->user->realhost);
ircd_log(LOG_ERROR, "[HOSTNAME BUG] client->local->sockhost is empty for user %s (%s, %s)",
client->name, client->ip ? client->ip : "<null>", user->realhost);
client->name, client->ip ? client->ip : "<null>", client->user->realhost);
}
/*
@@ -801,21 +800,21 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char
* Moved the noident stuff here. -OnyxDragon
*/
/* because username may point to user->username */
/* because username may point to client->user->username */
strlcpy(temp, username, USERLEN + 1);
if (!IsUseIdent(client))
strlcpy(user->username, temp, USERLEN + 1);
strlcpy(client->user->username, temp, USERLEN + 1);
else if (IsIdentSuccess(client))
strlcpy(user->username, client->ident, USERLEN+1);
strlcpy(client->user->username, client->ident, USERLEN+1);
else
{
if (IDENT_CHECK == 0) {
strlcpy(user->username, temp, USERLEN+1);
strlcpy(client->user->username, temp, USERLEN+1);
}
else {
*user->username = '~';
strlcpy((user->username + 1), temp, sizeof(user->username)-1);
*client->user->username = '~';
strlcpy((client->user->username + 1), temp, sizeof(client->user->username)-1);
noident = 1;
}
@@ -836,7 +835,7 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char
* problems so just ban them. (Using the nick could introduce
* hostile chars) -- codemastr
*/
for (u2 = user->username + noident; *u2; u2++)
for (u2 = client->user->username + noident; *u2; u2++)
{
if (isallowed(*u2))
*u1++ = *u2;
@@ -854,7 +853,7 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char
}
*u1 = '\0';
*ubad = '\0';
if (strlen(stripuser) != strlen(user->username + noident))
if (strlen(stripuser) != strlen(client->user->username + noident))
{
if (stripuser[0] == '\0')
{
@@ -862,10 +861,10 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char
return 0;
}
strlcpy(olduser, user->username + noident, USERLEN+1);
strlcpy(user->username + 1, stripuser, sizeof(user->username)-1);
user->username[0] = '~';
user->username[USERLEN] = '\0';
strlcpy(olduser, client->user->username + noident, USERLEN+1);
strlcpy(client->user->username + 1, stripuser, sizeof(client->user->username)-1);
client->user->username[0] = '~';
client->user->username[USERLEN] = '\0';
}
else
u1 = NULL;
@@ -929,15 +928,15 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char
}
else
{
strlcpy(user->username, username, USERLEN+1);
strlcpy(client->user->username, username, USERLEN+1);
}
SetUser(client);
irccounts.clients++;
if (client->srvptr && client->srvptr->serv)
client->srvptr->serv->users++;
make_cloakedhost(client, user->realhost, user->cloakedhost, sizeof(user->cloakedhost));
safe_strdup(user->virthost, user->cloakedhost);
make_cloakedhost(client, client->user->realhost, client->user->cloakedhost, sizeof(client->user->cloakedhost));
safe_strdup(client->user->virthost, client->user->cloakedhost);
if (MyConnect(client))
{
@@ -958,18 +957,12 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char
RunHook(HOOKTYPE_SECURE_CONNECT, client);
}
if (IsHidden(client))
{
ircd_log(LOG_CLIENT, "Connect - %s!%s@%s [%s] [vhost: %s] %s",
nick, user->username, user->realhost, GetIP(client), user->virthost, get_connect_extinfo(client));
} else
{
ircd_log(LOG_CLIENT, "Connect - %s!%s@%s [%s] %s",
nick, user->username, user->realhost, GetIP(client), get_connect_extinfo(client));
}
unreal_log(ULOG_INFO, "connect", "LOCAL_CLIENT_CONNECT", client,
"Client connecting: $client ($client.username@$client.hostname) [$client.ip] $extended_client_info",
log_data_string("extended_client_info", get_connect_extinfo(client)));
RunHook2(HOOKTYPE_WELCOME, client, 0);
sendnumeric(client, RPL_WELCOME, ircnetwork, nick, user->username, user->realhost);
sendnumeric(client, RPL_WELCOME, ircnetwork, nick, client->user->username, client->user->realhost);
RunHook2(HOOKTYPE_WELCOME, client, 1);
sendnumeric(client, RPL_YOURHOST, me.name, version);
@@ -988,7 +981,7 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char
if (IsHidden(client))
{
sendnumeric(client, RPL_HOSTHIDDEN, user->virthost);
sendnumeric(client, RPL_HOSTHIDDEN, client->user->virthost);
RunHook2(HOOKTYPE_WELCOME, client, 396);
}
@@ -1035,12 +1028,12 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char
/* Remote client */
/* The following two cases probably cannot happen anymore? at all? */
if (!(acptr = find_server_quick(user->server)))
if (!(acptr = find_server_quick(client->user->server)))
{
sendto_ops("Bad USER [%s] :%s USER %s %s : No such server",
client->name, nick, user->username, user->server);
client->name, nick, client->user->username, client->user->server);
sendto_one(client, NULL, ":%s KILL %s :No such server: %s",
me.id, client->id, user->server);
me.id, client->id, client->user->server);
SetKilled(client);
exit_client(client, NULL, "USER without prefix(2.8) or wrong prefix");
return 0;
@@ -1048,7 +1041,7 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char
else if (acptr->direction != client->direction)
{
sendto_ops("Bad User [%s] :%s USER %s %s, != %s[%s]",
client->name, nick, user->username, user->server,
client->name, nick, client->user->username, client->user->server,
acptr->name, acptr->direction->name);
sendto_one(client, NULL, ":%s KILL %s :Wrong user-server-direction",
me.id, client->id);
@@ -1088,8 +1081,8 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char
/* For remote clients we recalculate the cloakedhost here because
* it may depend on the IP address (bug #5064).
*/
make_cloakedhost(client, user->realhost, user->cloakedhost, sizeof(user->cloakedhost));
safe_strdup(user->virthost, user->cloakedhost);
make_cloakedhost(client, client->user->realhost, client->user->cloakedhost, sizeof(client->user->cloakedhost));
safe_strdup(client->user->virthost, client->user->cloakedhost);
/* Set the umodes */
tkllayer[0] = nick;
@@ -1112,12 +1105,12 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char
if (MyConnect(client))
{
broadcast_moddata_client(client);
sendto_connectnotice(client, 0, NULL); /* moved down, for modules. */
RunHook(HOOKTYPE_LOCAL_CONNECT, client);
if (buf[0] != '\0' && buf[1] != '\0')
sendto_one(client, NULL, ":%s MODE %s :%s", client->name,
client->name, buf);
if (user->snomask)
sendnumeric(client, RPL_SNOMASK, get_snomask_string_raw(user->snomask));
if (client->user->snomask)
sendnumeric(client, RPL_SNOMASK, get_snomask_string_raw(client->user->snomask));
if (!IsSecure(client) && !IsLocalhost(client) && (iConf.plaintext_policy_user == POLICY_WARN))
sendnotice_multiline(client, iConf.plaintext_policy_user_message);
+58 -58
View File
@@ -82,7 +82,7 @@ void set_oper_host(Client *client, char *host)
CMD_FUNC(cmd_oper)
{
ConfigItem_oper *operblock;
char *name, *password;
char *operblock_name, *password;
long old_umodes = client->umodes & ALL_UMODES;
if (!MyUser(client))
@@ -108,18 +108,18 @@ CMD_FUNC(cmd_oper)
return;
}
name = parv[1];
operblock_name = parv[1];
password = (parc > 2) ? parv[2] : "";
/* set::plaintext-policy::oper 'deny' */
if (!IsSecure(client) && !IsLocalhost(client) && (iConf.plaintext_policy_oper == POLICY_DENY))
{
sendnotice_multiline(client, iConf.plaintext_policy_oper_message);
sendto_snomask_global
(SNO_OPER, "Failed OPER attempt by %s (%s@%s) [not using SSL/TLS]",
client->name, client->user->username, client->local->sockhost);
ircd_log(LOG_OPER, "OPER NO-SSL/TLS (%s) by (%s!%s@%s)", name, client->name,
client->user->username, client->local->sockhost);
unreal_log(ULOG_WARNING, "oper", "OPER_FAILED", client,
"Failed OPER attempt by $client.nuh [reason: $reason] [oper-block: $oper_block]",
log_data_string("reason", "Not using TLS"),
log_data_string("fail_type", "NO_TLS"),
log_data_string("oper_block", parv[1]));
client->local->since += 7;
return;
}
@@ -128,35 +128,39 @@ CMD_FUNC(cmd_oper)
if (IsSecure(client) && (iConf.outdated_tls_policy_oper == POLICY_DENY) && outdated_tls_client(client))
{
sendnotice(client, "%s", outdated_tls_client_build_string(iConf.outdated_tls_policy_oper_message, client));
sendto_snomask_global
(SNO_OPER, "Failed OPER attempt by %s (%s@%s) [outdated SSL/TLS protocol or cipher]",
client->name, client->user->username, client->local->sockhost);
ircd_log(LOG_OPER, "OPER OUTDATED-SSL/TLS (%s) by (%s!%s@%s)", name, client->name,
client->user->username, client->local->sockhost);
unreal_log(ULOG_WARNING, "oper", "OPER_FAILED", client,
"Failed OPER attempt by $client.nuh [reason: $reason] [oper-block: $oper_block]",
log_data_string("reason", "Outdated TLS protocol or cipher"),
log_data_string("fail_type", "OUTDATED_TLS_PROTOCOL_OR_CIPHER"),
log_data_string("oper_block", parv[1]));
client->local->since += 7;
return;
}
if (!(operblock = find_oper(name)))
if (!(operblock = find_oper(operblock_name)))
{
sendnumeric(client, ERR_NOOPERHOST);
sendto_snomask_global
(SNO_OPER, "Failed OPER attempt by %s (%s@%s) [unknown oper]",
client->name, client->user->username, client->local->sockhost);
ircd_log(LOG_OPER, "OPER UNKNOWNOPER (%s) by (%s!%s@%s)", name, client->name,
client->user->username, client->local->sockhost);
unreal_log(ULOG_WARNING, "oper", "OPER_FAILED", client,
"Failed OPER attempt by $client.nuh [reason: $reason] [oper-block: $oper_block]",
log_data_string("reason", "Unknown oper operblock_name"),
log_data_string("fail_type", "UNKNOWN_OPER_NAME"),
log_data_string("oper_block", parv[1]));
client->local->since += 7;
return;
}
/* Below here, the oper block exists, any errors here we take (even)
* more seriously, they are logged as errors instead of warnings.
*/
if (!unreal_mask_match(client, operblock->mask))
{
sendnumeric(client, ERR_NOOPERHOST);
sendto_snomask_global
(SNO_OPER, "Failed OPER attempt by %s (%s@%s) using UID %s [host doesnt match]",
client->name, client->user->username, client->local->sockhost, name);
ircd_log(LOG_OPER, "OPER NOHOSTMATCH (%s) by (%s!%s@%s)", name, client->name,
client->user->username, client->local->sockhost);
unreal_log(ULOG_ERROR, "oper", "OPER_FAILED", client,
"Failed OPER attempt by $client.nuh [reason: $reason] [oper-block: $oper_block]",
log_data_string("reason", "Host does not match"),
log_data_string("fail_type", "NO_HOST_MATCH"),
log_data_string("oper_block", parv[1]));
client->local->since += 7;
return;
}
@@ -167,11 +171,11 @@ CMD_FUNC(cmd_oper)
if (FAILOPER_WARN)
sendnotice(client,
"*** Your attempt has been logged.");
ircd_log(LOG_OPER, "OPER FAILEDAUTH (%s) by (%s!%s@%s)", name, client->name,
client->user->username, client->local->sockhost);
sendto_snomask_global
(SNO_OPER, "Failed OPER attempt by %s (%s@%s) using UID %s [FAILEDAUTH]",
client->name, client->user->username, client->local->sockhost, name);
unreal_log(ULOG_ERROR, "oper", "OPER_FAILED", client,
"Failed OPER attempt by $client.nuh [reason: $reason] [oper-block: $oper_block]",
log_data_string("reason", "Authentication failed"),
log_data_string("fail_type", "AUTHENTICATION_FAILED"),
log_data_string("oper_block", parv[1]));
client->local->since += 7;
return;
}
@@ -185,12 +189,11 @@ CMD_FUNC(cmd_oper)
if (operblock->require_modes & ~client->umodes)
{
sendnumericfmt(client, ERR_NOOPERHOST, ":You are missing user modes required to OPER");
sendto_snomask_global
(SNO_OPER, "Failed OPER attempt by %s (%s@%s) [lacking modes '%s' in oper::require-modes]",
client->name, client->user->username, client->local->sockhost, get_usermode_string_raw(operblock->require_modes & ~client->umodes));
ircd_log(LOG_OPER, "OPER MISSINGMODES (%s) by (%s!%s@%s), needs modes=%s",
name, client->name, client->user->username, client->local->sockhost,
get_usermode_string_raw(operblock->require_modes & ~client->umodes));
unreal_log(ULOG_WARNING, "oper", "OPER_FAILED", client,
"Failed OPER attempt by $client.nuh [reason: $reason] [oper-block: $oper_block]",
log_data_string("reason", "Not matching oper::require-modes"),
log_data_string("fail_type", "REQUIRE_MODES_NOT_SATISFIED"),
log_data_string("oper_block", parv[1]));
client->local->since += 7;
return;
}
@@ -198,12 +201,11 @@ CMD_FUNC(cmd_oper)
if (!find_operclass(operblock->operclass))
{
sendnotice(client, "ERROR: There is a non-existant oper::operclass specified for your oper block");
ircd_log(LOG_ERROR, "OPER MISSINGOPERCLASS (%s) by (%s!%s@%s), oper::operclass does not exist: %s",
name, client->name, client->user->username, client->local->sockhost,
operblock->operclass);
sendto_snomask_global
(SNO_OPER, "Failed OPER attempt by %s (%s@%s) [oper::operclass does not exist: '%s']",
client->name, client->user->username, client->local->sockhost, operblock->operclass);
unreal_log(ULOG_WARNING, "oper", "OPER_FAILED", client,
"Failed OPER attempt by $client.nuh [reason: $reason] [oper-block: $oper_block]",
log_data_string("reason", "Config error: invalid oper::operclass"),
log_data_string("fail_type", "OPER_OPERCLASS_INVALID"),
log_data_string("oper_block", parv[1]));
return;
}
@@ -212,11 +214,11 @@ CMD_FUNC(cmd_oper)
sendnumeric(client, ERR_NOOPERHOST);
sendnotice(client, "Your maximum number of concurrent oper logins has been reached (%d)",
operblock->maxlogins);
sendto_snomask_global
(SNO_OPER, "Failed OPER attempt by %s (%s@%s) using UID %s [maxlogins reached]",
client->name, client->user->username, client->local->sockhost, name);
ircd_log(LOG_OPER, "OPER TOOMANYLOGINS (%s) by (%s!%s@%s)", name, client->name,
client->user->username, client->local->sockhost);
unreal_log(ULOG_WARNING, "oper", "OPER_FAILED", client,
"Failed OPER attempt by $client.nuh [reason: $reason] [oper-block: $oper_block]",
log_data_string("reason", "oper::maxlogins limit reached"),
log_data_string("fail_type", "OPER_MAXLOGINS_LIMIT"),
log_data_string("oper_block", parv[1]));
client->local->since += 4;
return;
}
@@ -258,13 +260,9 @@ CMD_FUNC(cmd_oper)
safe_strdup(client->user->virthost, client->user->cloakedhost);
}
sendto_snomask_global(SNO_OPER,
"%s (%s@%s) [%s] is now an operator",
client->name, client->user->username, client->local->sockhost,
parv[1]);
ircd_log(LOG_OPER, "OPER (%s) by (%s!%s@%s)", name, client->name, client->user->username,
client->local->sockhost);
unreal_log(ULOG_INFO, "oper", "OPER_SUCCESS", client,
"$client.nuh is now an IRC Operator [oper-block: $oper_block]",
log_data_string("oper_block", parv[1]));
/* set oper snomasks */
if (operblock->snomask)
@@ -316,17 +314,19 @@ CMD_FUNC(cmd_oper)
if (!IsSecure(client) && !IsLocalhost(client) && (iConf.plaintext_policy_oper == POLICY_WARN))
{
sendnotice_multiline(client, iConf.plaintext_policy_oper_message);
sendto_snomask_global
(SNO_OPER, "OPER %s [%s] used an insecure (non-SSL/TLS) connection to /OPER.",
client->name, name);
unreal_log(ULOG_WARNING, "oper", "OPER_UNSAFE", client,
"Insecure (non-TLS) connection used to OPER up by $client.nuh [oper-block: $oper_block]",
log_data_string("oper_block", parv[1]),
log_data_string("warn_type", "NO_TLS"));
}
/* set::outdated-tls-policy::oper 'warn' */
if (IsSecure(client) && (iConf.outdated_tls_policy_oper == POLICY_WARN) && outdated_tls_client(client))
{
sendnotice(client, "%s", outdated_tls_client_build_string(iConf.outdated_tls_policy_oper_message, client));
sendto_snomask_global
(SNO_OPER, "OPER %s [%s] used a connection with an outdated SSL/TLS protocol or cipher to /OPER.",
client->name, name);
unreal_log(ULOG_WARNING, "oper", "OPER_UNSAFE", client,
"Outdated TLS protocol/cipher used to OPER up by $client.nuh [oper-block: $oper_block]",
log_data_string("oper_block", parv[1]),
log_data_string("warn_type", "OUTDATED_TLS_PROTOCOL_OR_CIPHER"));
}
}
+9 -9
View File
@@ -106,7 +106,7 @@ CMD_FUNC(cmd_part)
break;
}
channel = get_channel(client, name, 0);
channel = find_channel(name);
if (!channel)
{
sendnumeric(client, ERR_NOSUCHCHANNEL, name);
@@ -155,11 +155,11 @@ CMD_FUNC(cmd_part)
}
/* Create a new message, this one is actually used by 8 calls (though at most 4 max) */
new_message_special(client, recv_mtags, &mtags, ":%s PART %s", client->name, channel->chname);
new_message_special(client, recv_mtags, &mtags, ":%s PART %s", client->name, channel->name);
/* Send to other servers... */
sendto_server(client, 0, 0, mtags, ":%s PART %s :%s",
client->id, channel->chname, comment ? comment : "");
client->id, channel->name, comment ? comment : "");
if (invisible_user_in_channel(client, channel))
{
@@ -170,11 +170,11 @@ CMD_FUNC(cmd_part)
PREFIX_HALFOP|PREFIX_OP|PREFIX_OWNER|PREFIX_ADMIN, 0,
SEND_LOCAL, mtags,
":%s PART %s",
client->name, channel->chname);
client->name, channel->name);
if (MyUser(client))
{
sendto_one(client, mtags, ":%s!%s@%s PART %s",
client->name, client->user->username, GetHost(client), channel->chname);
client->name, client->user->username, GetHost(client), channel->name);
}
}
else
@@ -183,13 +183,13 @@ CMD_FUNC(cmd_part)
PREFIX_HALFOP|PREFIX_OP|PREFIX_OWNER|PREFIX_ADMIN, 0,
SEND_LOCAL, mtags,
":%s PART %s %s",
client->name, channel->chname, comment);
client->name, channel->name, comment);
if (MyUser(client))
{
sendto_one(client, mtags,
":%s!%s@%s PART %s %s",
client->name, client->user->username, GetHost(client),
channel->chname, comment);
channel->name, comment);
}
}
}
@@ -200,11 +200,11 @@ CMD_FUNC(cmd_part)
{
sendto_channel(channel, client, NULL, 0, 0, SEND_LOCAL, mtags,
":%s PART %s",
client->name, channel->chname);
client->name, channel->name);
} else {
sendto_channel(channel, client, NULL, 0, 0, SEND_LOCAL, mtags,
":%s PART %s :%s",
client->name, channel->chname, comment);
client->name, channel->name, comment);
}
}
+1 -1
View File
@@ -124,7 +124,7 @@ CMD_FUNC(cmd_quit)
int ret;
parx[0] = NULL;
parx[1] = channel->chname;
parx[1] = channel->name;
parx[2] = newcomment;
parx[3] = NULL;
+48 -27
View File
@@ -81,9 +81,10 @@ ModuleHeader MOD_HEADER
#define WARN_WRITE_ERROR(fname) \
do { \
sendto_realops_and_log("[reputation] Error writing to temporary database file " \
"'%s': %s (DATABASE NOT SAVED)", \
fname, unrealdb_get_error_string()); \
unreal_log(ULOG_ERROR, "reputation", "REPUTATION_FILE_WRITE_ERROR", NULL, \
"[reputation] Error writing to temporary database file $filename: $system_error", \
log_data_string("filename", fname), \
log_data_string("system_error", unrealdb_get_error_string())); \
} while(0)
#define W_SAFE(x) \
@@ -465,8 +466,9 @@ void reputation_load_db_old(void)
#ifdef BENCHMARK
gettimeofday(&tv_beta, NULL);
ircd_log(LOG_ERROR, "Reputation benchmark: LOAD DB: %lld microseconds",
(long long)(((tv_beta.tv_sec - tv_alpha.tv_sec) * 1000000) + (tv_beta.tv_usec - tv_alpha.tv_usec)));
unreal_log(ULOG_DEBUG, "reputation", "REPUTATION_BENCHMARK", NULL,
"Reputation benchmark: LOAD DB: $time_msec microseconds",
log_data_integer("time_msec", ((tv_beta.tv_sec - tv_alpha.tv_sec) * 1000000) + (tv_beta.tv_usec - tv_alpha.tv_usec)));
#endif
}
@@ -529,8 +531,9 @@ int reputation_load_db_new(UnrealDB *db)
unrealdb_close(db);
#ifdef BENCHMARK
gettimeofday(&tv_beta, NULL);
ircd_log(LOG_ERROR, "Reputation benchmark: LOAD DB: %lld microseconds",
(long long)(((tv_beta.tv_sec - tv_alpha.tv_sec) * 1000000) + (tv_beta.tv_usec - tv_alpha.tv_usec)));
unreal_log(ULOG_DEBUG, "reputation", "REPUTATION_BENCHMARK", NULL,
"Reputation benchmark: LOAD DB: $time_msec microseconds",
log_data_integer("time_msec", ((tv_beta.tv_sec - tv_alpha.tv_sec) * 1000000) + (tv_beta.tv_usec - tv_alpha.tv_usec)));
#endif
return 1;
}
@@ -656,8 +659,9 @@ write_fail:
#ifdef BENCHMARK
gettimeofday(&tv_beta, NULL);
ircd_log(LOG_ERROR, "Reputation benchmark: SAVE DB: %lld microseconds",
(long long)(((tv_beta.tv_sec - tv_alpha.tv_sec) * 1000000) + (tv_beta.tv_usec - tv_alpha.tv_usec)));
unreal_log(ULOG_DEBUG, "reputation", "REPUTATION_BENCHMARK", NULL,
"Reputation benchmark: SAVE DB: $time_msec microseconds",
log_data_integer("time_msec", ((tv_beta.tv_sec - tv_alpha.tv_sec) * 1000000) + (tv_beta.tv_usec - tv_alpha.tv_usec)));
#endif
return 1;
@@ -677,7 +681,7 @@ int reputation_save_db(void)
#endif
#ifdef TEST
sendto_realops("REPUTATION IS RUNNING IN TEST MODE. SAVING DB'S...");
unreal_log(ULOG_DEBUG, "reputation", "REPUTATION_TEST", NULL, "Reputation in running in test mode. Saving DB's....");
#endif
/* Comment this out after one or more releases (means you cannot downgrade to <=5.0.9.1 anymore) */
@@ -741,8 +745,9 @@ int reputation_save_db(void)
#ifdef BENCHMARK
gettimeofday(&tv_beta, NULL);
ircd_log(LOG_ERROR, "Reputation benchmark: SAVE DB: %lld microseconds",
(long long)(((tv_beta.tv_sec - tv_alpha.tv_sec) * 1000000) + (tv_beta.tv_usec - tv_alpha.tv_usec)));
unreal_log(ULOG_DEBUG, "reputation", "REPUTATION_BENCHMARK", NULL,
"Reputation benchmark: SAVE DB: $time_msec microseconds",
log_data_integer("time_msec", ((tv_beta.tv_sec - tv_alpha.tv_sec) * 1000000) + (tv_beta.tv_usec - tv_alpha.tv_usec)));
#endif
return 1;
}
@@ -924,8 +929,11 @@ EVENT(delete_old_records)
if (is_reputation_expired(e))
{
#ifdef DEBUGMODE
ircd_log(LOG_ERROR, "Deleting expired entry for '%s' (score %hd, last seen %lld seconds ago)",
e->ip, e->score, (long long)(TStime() - e->last_seen));
unreal_log(ULOG_INFO, "reputation", "REPUTATION_EXPIRY", NULL,
"Deleting expired entry for $ip (score $score, last seen $time_delta seconds ago)",
log_data_string("ip", e->ip),
log_data_integer("score", e->score),
log_data_integer("time_delta", TStime() - e->last_seen));
#endif
DelListItem(e, ReputationHashTable[i]);
safe_free(e);
@@ -935,8 +943,9 @@ EVENT(delete_old_records)
#ifdef BENCHMARK
gettimeofday(&tv_beta, NULL);
ircd_log(LOG_ERROR, "Reputation benchmark: EXPIRY IN MEM: %lld microseconds",
(long long)(((tv_beta.tv_sec - tv_alpha.tv_sec) * 1000000) + (tv_beta.tv_usec - tv_alpha.tv_usec)));
unreal_log(ULOG_DEBUG, "reputation", "REPUTATION_BENCHMARK", NULL,
"Reputation benchmark: EXPIRY IN MEM: $time_msec microseconds",
log_data_integer("time_msec", ((tv_beta.tv_sec - tv_alpha.tv_sec) * 1000000) + (tv_beta.tv_usec - tv_alpha.tv_usec)));
#endif
}
@@ -989,7 +998,7 @@ void reputation_channel_query(Client *client, Channel *channel)
int cnt = 0, i, j;
ReputationEntry *e;
sendtxtnumeric(client, "Users and reputation scores for %s:", channel->chname);
sendtxtnumeric(client, "Users and reputation scores for %s:", channel->name);
/* Step 1: build a list of nicks and their reputation */
nicks = safe_alloc((channel->users+1) * sizeof(char *));
@@ -1005,8 +1014,11 @@ void reputation_channel_query(Client *client, Channel *channel)
}
if (++cnt > channel->users)
{
sendto_ops("[BUG] reputation_channel_query() expected %d users but %d (or more) were present in %s",
channel->users, cnt, channel->chname);
unreal_log(ULOG_WARNING, "bug", "REPUTATION_CHANNEL_QUERY_BUG", client,
"[BUG] reputation_channel_query() expected $expected_users users, but $found_users (or more) users were present in $channel",
log_data_integer("expected_users", channel->users),
log_data_integer("found_users", cnt),
log_data_string("channel", channel->name));
#ifdef DEBUGMODE
abort();
#endif
@@ -1121,7 +1133,7 @@ CMD_FUNC(reputation_user_cmd)
} else
if (parv[1][0] == '#')
{
Channel *channel = find_channel(parv[1], NULL);
Channel *channel = find_channel(parv[1]);
if (!channel)
{
sendnumeric(client, ERR_NOSUCHCHANNEL, parv[1]);
@@ -1130,7 +1142,7 @@ CMD_FUNC(reputation_user_cmd)
/* corner case: ircop without proper permissions and not in channel */
if (!ValidatePermissionsForPath("channel:see:names:invisible",client,NULL,NULL,NULL) && !get_access(client,channel))
{
sendnumeric(client, ERR_NOTONCHANNEL, channel->chname);
sendnumeric(client, ERR_NOTONCHANNEL, channel->name);
return;
}
reputation_channel_query(client, channel);
@@ -1239,8 +1251,11 @@ CMD_FUNC(reputation_server_cmd)
*/
sendto_one(client, NULL, ":%s REPUTATION %s *%d", me.id, parv[1], e->score);
#ifdef DEBUGMODE
ircd_log(LOG_ERROR, "[reputation] Score for '%s' from %s is %d, but we have %d, sending back %d",
ip, client->name, score, e->score, e->score);
unreal_log(ULOG_INFO, "reputation", "REPUTATION_DIFFERS", client,
"Reputation score for for $ip from $client is $their_score, but we have $score, sending back $score",
log_data_string("ip", e->ip),
log_data_integer("their_score", score),
log_data_integer("score", e->score));
#endif
score = e->score; /* Update for propagation in the non-client direction */
}
@@ -1249,8 +1264,11 @@ CMD_FUNC(reputation_server_cmd)
if (e && (score > e->score))
{
#ifdef DEBUGMODE
ircd_log(LOG_ERROR, "[reputation] Score for '%s' from %s is %d, but we have %d, updating our score to %d",
ip, client->name, score, e->score, score);
unreal_log(ULOG_INFO, "reputation", "REPUTATION_DIFFERS", client,
"Reputation score for for $ip from $client is $their_score, but we have $score, updating our score to $score",
log_data_string("ip", e->ip),
log_data_integer("their_score", score),
log_data_integer("score", e->score));
#endif
e->score = score;
}
@@ -1259,8 +1277,11 @@ CMD_FUNC(reputation_server_cmd)
if (!e && (score > 0))
{
#ifdef DEBUGMODE
ircd_log(LOG_ERROR, "[reputation] Score for '%s' from %s is %d, we had no entry, adding it",
ip, client->name, score);
unreal_log(ULOG_INFO, "reputation", "REPUTATION_NEW", client,
"Reputation score for for $ip from $client is $their_score, we had no entry, adding it",
log_data_string("ip", e->ip),
log_data_integer("their_score", score),
log_data_integer("score", e->score));
#endif
e = safe_alloc(sizeof(ReputationEntry)+strlen(ip));
strcpy(e->ip, ip); /* safe, see alloc above */
+18 -26
View File
@@ -52,6 +52,13 @@ MOD_UNLOAD()
return MOD_SUCCESS;
}
static void log_sajoin(Client *client, Client *target, char *channels)
{
unreal_log(ULOG_INFO, "sacmds", "SAJOIN_COMMAND", client, "SAJOIN: $client used SAJOIN to make $target join $channels",
log_data_client("target", target),
log_data_string("channels", channels));
}
/* cmd_sajoin() - Lamego - Wed Jul 21 20:04:48 1999
Copied off PTlink IRCd (C) PTlink coders team.
Coded for Sadmin by Stskeeps
@@ -89,20 +96,18 @@ CMD_FUNC(cmd_sajoin)
return;
}
/* Broadcast so other servers can log it appropriately as an SAJOIN */
sendto_server(client, 0, 0, recv_mtags, ":%s SAPART %s %s", client->id, target->id, parv[2]);
/* If it's not for our client, then simply pass on the message... */
if (!MyUser(target))
{
sendto_one(target, NULL, ":%s SAJOIN %s %s", client->id, target->id, parv[2]);
/* Logging function added by XeRXeS */
ircd_log(LOG_SACMDS,"SAJOIN: %s used SAJOIN to make %s join %s",
client->name, target->name, parv[2]);
unreal_log(ULOG_INFO, "sacmds", "SAJOIN_COMMAND", client, "SAJOIN: %s used SAJOIN to make %s join %s",
log_data_client("target", target),
log_data_string("channel", parv[2]));
log_sajoin(client, target, parv[2]);
return;
}
/* 'target' is our client... */
/* Can't this just use do_join() or something with a parameter to bypass some checks?
* This duplicate code is damn ugly. Ah well..
*/
@@ -178,7 +183,7 @@ CMD_FUNC(cmd_sajoin)
continue;
}
channel = get_channel(target, name, 0);
channel = make_channel(name);
/* If this _specific_ channel is not permitted, skip it */
if (!IsULine(client) && !ValidatePermissionsForPath("sacmd:sajoin",client,target,channel,NULL))
@@ -225,8 +230,8 @@ CMD_FUNC(cmd_sajoin)
new_message(target, NULL, &mtags);
sendto_channel(channel, target, NULL, 0, 0, SEND_LOCAL, mtags,
":%s PART %s :%s",
target->name, channel->chname, "Left all channels");
sendto_server(NULL, 0, 0, mtags, ":%s PART %s :Left all channels", target->name, channel->chname);
target->name, channel->name, "Left all channels");
sendto_server(NULL, 0, 0, mtags, ":%s PART %s :Left all channels", target->name, channel->name);
if (MyConnect(target))
RunHook4(HOOKTYPE_LOCAL_PART, target, channel, mtags, "Left all channels");
free_message_tags(mtags);
@@ -236,7 +241,7 @@ CMD_FUNC(cmd_sajoin)
continue;
}
flags = (ChannelExists(name)) ? CHFL_DEOPPED : LEVEL_ON_JOIN;
channel = get_channel(target, name, CREATE);
channel = make_channel(name);
if (channel && (lp = find_membership_link(target->user->channel, channel)))
continue;
@@ -281,23 +286,10 @@ CMD_FUNC(cmd_sajoin)
if (did_anything)
{
if (!sjmode)
{
sendnotice(target, "*** You were forced to join %s", jbuf);
sendto_umode_global(UMODE_OPER, "%s used SAJOIN to make %s join %s", client->name, target->name, jbuf);
/* Logging function added by XeRXeS */
ircd_log(LOG_SACMDS,"SAJOIN: %s used SAJOIN to make %s join %s",
client->name, target->name, jbuf);
}
else
{
sendnotice(target, "*** You were forced to join %s with '%c'", jbuf, sjmode);
sendto_umode_global(UMODE_OPER, "%s used SAJOIN to make %s join %c%s", client->name, target->name, sjmode, jbuf);
ircd_log(LOG_SACMDS,"SAJOIN: %s used SAJOIN to make %s join %c%s",
client->name, target->name, sjmode, jbuf);
}
unreal_log(ULOG_INFO, "sacmds", "SAJOIN_COMMAND", client, "SAJOIN: $client used SAJOIN to make $target join $channel",
log_data_client("target", target),
log_data_string("channel", jbuf));
log_sajoin(client, target, jbuf);
}
}
}
+1 -1
View File
@@ -68,7 +68,7 @@ CMD_FUNC(cmd_samode)
return;
}
channel = find_channel(parv[1], NULL);
channel = find_channel(parv[1]);
if (!channel)
{
sendnumeric(client, ERR_NOSUCHCHANNEL, parv[1]);
+41 -34
View File
@@ -52,6 +52,24 @@ MOD_UNLOAD()
return MOD_SUCCESS;
}
static void log_sapart(Client *client, Client *target, char *channels, char *comment)
{
if (comment)
{
unreal_log(ULOG_INFO, "sacmds", "SAPART_COMMAND", client, "SAPART: $client used SAPART to make $target join $channels ($reason)",
log_data_client("target", target),
log_data_string("channels", channels),
log_data_string("reason", comment));
}
else
{
unreal_log(ULOG_INFO, "sacmds", "SAPART_COMMAND", client, "SAPART: $client used SAPART to make $target join $channels",
log_data_client("target", target),
log_data_string("channels", channels));
}
}
/* cmd_sapart() - Lamego - Wed Jul 21 20:04:48 1999
Copied off PTlink IRCd (C) PTlink coders team.
Coded for Sadmin by Stskeeps
@@ -93,25 +111,20 @@ CMD_FUNC(cmd_sapart)
return;
}
/* Relay it on, if it's not my target */
/* Broadcast so other servers can log it appropriately as an SAPART */
if (parv[3])
sendto_server(client, 0, 0, recv_mtags, ":%s SAPART %s %s :%s", client->id, target->id, parv[2], comment);
else
sendto_server(client, 0, 0, recv_mtags, ":%s SAPART %s %s", client->id, target->id, parv[2]);
if (!MyUser(target))
{
if (comment)
{
sendto_one(target, NULL, ":%s SAPART %s %s :%s", client->id, target->id, parv[2], comment);
ircd_log(LOG_SACMDS,"SAPART: %s used SAPART to make %s part %s (%s)",
client->name, target->name, parv[2], comment);
}
else
{
sendto_one(target, NULL, ":%s SAPART %s %s", client->id, target->id, parv[2]);
ircd_log(LOG_SACMDS,"SAPART: %s used SAPART to make %s part %s",
client->name, target->name, parv[2]);
}
log_sapart(client, target, parv[2], comment);
return;
}
/* Now works like cmd_join */
/* 'target' is our client... */
*jbuf = 0;
for (i = 0, name = strtoken(&p, parv[2], ","); name; name = strtoken(&p, NULL, ","))
{
@@ -120,10 +133,10 @@ CMD_FUNC(cmd_sapart)
sendnumeric(client, ERR_TOOMANYTARGETS, name, maxtargets, "SAPART");
break;
}
if (!(channel = get_channel(target, name, 0)))
if (!(channel = find_channel(name)))
{
sendnumeric(client, ERR_NOSUCHCHANNEL,
name);
sendnumeric(client, ERR_NOSUCHCHANNEL, name);
continue;
}
@@ -156,25 +169,19 @@ CMD_FUNC(cmd_sapart)
strlcat(commentx, comment, 512);
}
log_sapart(client, target, parv[2], comment);
if (comment)
sendnotice(target, "*** You were forced to part %s (%s)", parv[2], commentx);
else
sendnotice(target, "*** You were forced to part %s", parv[2]);
parv[0] = target->name; // nick
parv[1] = parv[2]; // chan
parv[2] = comment ? commentx : NULL; // comment
if (comment)
{
sendnotice(target, "*** You were forced to part %s (%s)", parv[1], commentx);
sendto_umode_global(UMODE_OPER, "%s used SAPART to make %s part %s (%s)",
client->name, target->name, parv[1], comment);
ircd_log(LOG_SACMDS,"SAPART: %s used SAPART to make %s part %s (%s)",
client->name, target->name, parv[1], comment);
}
else
{
sendnotice(target, "*** You were forced to part %s", parv[1]);
sendto_umode_global(UMODE_OPER, "%s used SAPART to make %s part %s",
client->name, target->name, parv[1]);
ircd_log(LOG_SACMDS,"SAPART: %s used SAPART to make %s part %s",
client->name, target->name, parv[1]);
}
/* Now, do the actual parting: */
do_cmd(target, NULL, "PART", comment ? 3 : 2, parv);
/* target may be killed now due to the part reason @ spamfilter */
/* NOTE: target may be killed now due to the part reason @ spamfilter */
}
+249 -245
View File
@@ -51,7 +51,8 @@ void _send_server_message(Client *client);
void _introduce_user(Client *to, Client *acptr);
int _check_deny_version(Client *cptr, char *software, int protocol, char *flags);
void _broadcast_sinfo(Client *acptr, Client *to, Client *except);
int server_sync(Client *cptr, ConfigItem_link *conf);
int server_sync(Client *cptr, ConfigItem_link *conf, int incoming);
void tls_link_notification_verify(Client *acptr, ConfigItem_link *aconf);
void server_generic_free(ModData *m);
int server_post_connect(Client *client);
@@ -463,8 +464,8 @@ EVENT(server_handshake_timeout)
((TStime() - client->local->firsttime) >= cfg.connect_timeout))
{
/* If this is a connect timeout to an outgoing server then notify ops & log it */
sendto_ops_and_log("Connect timeout while trying to link to server '%s' (%s)",
client->name, client->ip?client->ip:"<unknown ip>");
unreal_log(ULOG_INFO, "link", "LINK_CONNECT_TIMEOUT", client,
"Connect timeout while trying to link to server '$client' ($client.ip)");
exit_client(client, NULL, "Connection timeout");
continue;
@@ -474,8 +475,8 @@ EVENT(server_handshake_timeout)
if ((TStime() - client->local->firsttime) >= cfg.handshake_timeout)
{
/* If this is a handshake timeout to an outgoing server then notify ops & log it */
sendto_ops_and_log("Connection handshake timeout while trying to link to server '%s' (%s)",
client->name, client->ip?client->ip:"<unknown ip>");
unreal_log(ULOG_INFO, "link", "LINK_HANDSHAKE_TIMEOUT", client,
"Connect handshake timeout while trying to link to server '$client' ($client.ip)");
exit_client(client, NULL, "Handshake Timeout");
continue;
@@ -880,6 +881,7 @@ CMD_FUNC(cmd_server)
ConfigItem_link *aconf = NULL;
ConfigItem_deny_link *deny;
char *flags = NULL, *protocol = NULL, *inf = NULL, *num = NULL;
int incoming;
if (IsUser(client))
{
@@ -943,11 +945,10 @@ CMD_FUNC(cmd_server)
if (strlen(client->id) != 3)
{
sendto_umode_global(UMODE_OPER, "Server %s is using old unsupported protocol from UnrealIRCd 3.2.x or earlier. "
"See https://www.unrealircd.org/docs/FAQ#old-server-protocol",
servername);
ircd_log(LOG_ERROR, "Server using old unsupported protocol from UnrealIRCd 3.2.x or earlier. "
"See https://www.unrealircd.org/docs/FAQ#old-server-protocol");
unreal_log(ULOG_ERROR, "link", "LINK_OLD_PROTOCOL", client,
"Server link $servername rejected. Server is using an old and unsupported protocol from UnrealIRCd 3.2.x or earlier. "
"See https://www.unrealircd.org/docs/FAQ#old-server-protocol",
log_data_string("servername", servername));
exit_client(client, NULL, "Server using old unsupported protocol from UnrealIRCd 3.2.x or earlier. "
"See https://www.unrealircd.org/docs/FAQ#old-server-protocol");
return;
@@ -956,8 +957,10 @@ CMD_FUNC(cmd_server)
hop = atol(parv[2]);
if (hop != 1)
{
sendto_umode_global(UMODE_OPER, "Directly linked server %s provided a hopcount of %d, while 1 was expected",
servername, hop);
unreal_log(ULOG_ERROR, "link", "LINK_REJECTED_INVALID_HOPCOUNT", client,
"Server link $servername rejected. Directly linked server provided a hopcount of $hopcount, while 1 was expected.",
log_data_string("servername", servername),
log_data_integer("hopcount", hop));
exit_client(client, NULL, "Invalid SERVER message, hop count must be 1");
return;
}
@@ -1002,8 +1005,9 @@ CMD_FUNC(cmd_server)
if (deny->flag.type == CRULE_ALL && unreal_mask_match_string(servername, deny->mask)
&& crule_eval(deny->rule))
{
sendto_ops_and_log("Refused connection from %s. Rejected by deny link { } block.",
get_client_host(client));
unreal_log(ULOG_ERROR, "link", "LINK_REJECTED_DENY_LINK_BLOCK", client,
"Server link $servername rejected by deny link { } block.",
log_data_string("servername", servername));
exit_client(client, NULL, "Disallowed by connection rule");
return;
}
@@ -1015,7 +1019,81 @@ CMD_FUNC(cmd_server)
ircsnprintf(descbuf, sizeof descbuf, "Server: %s", servername);
fd_desc(client->local->fd, descbuf);
server_sync(client, aconf);
incoming = IsUnknown(client) ? 1 : 0;
if (client->local->passwd)
safe_free(client->local->passwd);
/* Set up server structure */
free_pending_net(client);
SetServer(client);
irccounts.me_servers++;
irccounts.servers++;
irccounts.unknown--;
list_move(&client->client_node, &global_server_list);
list_move(&client->lclient_node, &lclient_list);
list_add(&client->special_node, &server_list);
if (find_uline(client->name))
{
if (client->serv && client->serv->features.software && !strncmp(client->serv->features.software, "UnrealIRCd-", 11))
{
unreal_log(ULOG_ERROR, "link", "BAD_ULINES", client,
"Bad ulines! Server $client matches your ulines { } block, but this server "
"is an UnrealIRCd server. UnrealIRCd servers should never be ulined as it "
"causes security issues. Ulines should only be added for services! "
"See https://www.unrealircd.org/docs/FAQ#bad-ulines.");
exit_client(client, NULL, "Bad ulines. See https://www.unrealircd.org/docs/FAQ#bad-ulines");
}
SetULine(client);
}
find_or_add(client->name);
if (IsSecure(client))
{
unreal_log(ULOG_INFO, "link", "SERVER_LINKED", client,
"Server linked: $me -> $client [secure: $tls_cipher]",
log_data_string("tls_cipher", tls_get_cipher(client->local->ssl)),
log_data_client("me", &me));
tls_link_notification_verify(client, aconf);
}
else
{
unreal_log(ULOG_INFO, "link", "SERVER_LINKED", client,
"Server linked: $me -> $client",
log_data_client("me", &me));
/* Print out a warning if linking to a non-TLS server unless it's localhost.
* Yeah.. there are still other cases when non-TLS links are fine (eg: local IP
* of the same machine), we won't bother with detecting that. -- Syzop
*/
if (!IsLocalhost(client) && (iConf.plaintext_policy_server == POLICY_WARN))
{
sendto_realops("\002WARNING:\002 This link is unencrypted (not SSL/TLS). We highly recommend to use "
"SSL/TLS for server linking. See https://www.unrealircd.org/docs/Linking_servers");
}
if (IsSecure(client) && (iConf.outdated_tls_policy_server == POLICY_WARN) && outdated_tls_client(client))
{
sendto_realops("\002WARNING:\002 This link is using an outdated SSL/TLS protocol or cipher (%s).",
tls_get_cipher(client->local->ssl));
}
}
add_to_client_hash_table(client->name, client);
/* doesnt duplicate client->serv if allocted this struct already */
make_server(client);
client->serv->up = me.name;
client->srvptr = &me;
if (!client->serv->conf)
client->serv->conf = aconf; /* Only set serv->conf to aconf if not set already! Bug #0003913 */
if (incoming)
client->serv->conf->refcount++;
client->serv->conf->class->clients++;
client->local->class = client->serv->conf->class;
RunHook(HOOKTYPE_SERVER_CONNECT, client);
server_sync(client, aconf, incoming);
}
/** Remote server command (SID).
@@ -1165,7 +1243,6 @@ CMD_FUNC(cmd_sid)
make_server(acptr);
acptr->serv->up = find_or_add(acptr->srvptr->name);
SetServer(acptr);
ircd_log(LOG_SERVER, "SERVER %s (from %s)", acptr->name, acptr->srvptr->name);
/* If this server is U-lined, or the parent is, then mark it as U-lined */
if (IsULine(client) || find_uline(acptr->name))
SetULine(acptr);
@@ -1176,6 +1253,8 @@ CMD_FUNC(cmd_sid)
add_to_id_hash_table(acptr->id, acptr);
list_move(&acptr->client_node, &global_server_list);
unreal_log(ULOG_INFO, "link", "SERVER_LINKED", acptr, "Server linked: $client (via $client.server)");
RunHook(HOOKTYPE_SERVER_CONNECT, acptr);
sendto_server(client, 0, 0, NULL, ":%s SID %s %d %s :%s",
@@ -1213,6 +1292,156 @@ void _introduce_user(Client *to, Client *acptr)
}
}
#define SafeStr(x) ((x && *(x)) ? (x) : "*")
/** Broadcast SINFO.
* @param cptr The server to send the information about.
* @param to The server to send the information TO (NULL for broadcast).
* @param except The direction NOT to send to.
* This function takes into account that the server may not
* provide all of the detailed info. If any information is
* absent we will send 0 for numbers and * for NULL strings.
*/
void _broadcast_sinfo(Client *acptr, Client *to, Client *except)
{
char chanmodes[128], buf[512];
if (acptr->serv->features.chanmodes[0])
{
snprintf(chanmodes, sizeof(chanmodes), "%s,%s,%s,%s",
acptr->serv->features.chanmodes[0],
acptr->serv->features.chanmodes[1],
acptr->serv->features.chanmodes[2],
acptr->serv->features.chanmodes[3]);
} else {
strlcpy(chanmodes, "*", sizeof(chanmodes));
}
snprintf(buf, sizeof(buf), "%lld %d %s %s %s :%s",
(long long)acptr->serv->boottime,
acptr->serv->features.protocol,
SafeStr(acptr->serv->features.usermodes),
chanmodes,
SafeStr(acptr->serv->features.nickchars),
SafeStr(acptr->serv->features.software));
if (to)
{
/* Targetted to one server */
sendto_one(to, NULL, ":%s SINFO %s", acptr->id, buf);
} else {
/* Broadcast (except one side...) */
sendto_server(except, 0, 0, NULL, ":%s SINFO %s", acptr->id, buf);
}
}
/** Sync all information with server 'client'.
* Eg: users, channels, everything.
* @param client The newly linked in server
* @param aconf The link block that belongs to this server
* @note This function (via cmd_server) is called from both sides, so
* from the incoming side and the outgoing side.
*/
int server_sync(Client *client, ConfigItem_link *aconf, int incoming)
{
Client *acptr;
if (incoming)
{
/* If this is an incomming connection, then we have just received
* their stuff and now send our PASS, PROTOCTL and SERVER messages back.
*/
if (!IsEAuth(client)) /* if eauth'd then we already sent the passwd */
sendto_one(client, NULL, "PASS :%s", (aconf->auth->type == AUTHTYPE_PLAINTEXT) ? aconf->auth->data : "*");
send_proto(client, aconf);
send_server_message(client);
}
/* Broadcast new server to the rest of the network */
sendto_server(client, 0, 0, NULL, ":%s SID %s 2 %s :%s",
client->srvptr->id, client->name, client->id, client->info);
/* Broadcast the just-linked-in featureset to other servers on our side */
broadcast_sinfo(client, NULL, client);
/* Send moddata of &me (if any, likely minimal) */
send_moddata_client(client, &me);
list_for_each_entry_reverse(acptr, &global_server_list, client_node)
{
/* acptr->direction == acptr for acptr == client */
if (acptr->direction == client)
continue;
if (IsServer(acptr))
{
sendto_one(client, NULL, ":%s SID %s %d %s :%s",
acptr->srvptr->id,
acptr->name, acptr->hopcount + 1,
acptr->id, acptr->info);
/* Also signal to the just-linked server which
* servers are fully linked.
* Now you might ask yourself "Why don't we just
* assume every server you get during link phase
* is fully linked?", well.. there's a race condition
* if 2 servers link (almost) at the same time,
* then you would think the other one is fully linked
* while in fact he was not.. -- Syzop.
*/
if (acptr->serv->flags.synced)
sendto_one(client, NULL, ":%s EOS", acptr->id);
/* Send SINFO of our servers to their side */
broadcast_sinfo(acptr, client, NULL);
send_moddata_client(client, acptr); /* send moddata of server 'acptr' (if any, likely minimal) */
}
}
/* Synching nick information */
list_for_each_entry_reverse(acptr, &client_list, client_node)
{
/* acptr->direction == acptr for acptr == client */
if (acptr->direction == client)
continue;
if (IsUser(acptr))
introduce_user(client, acptr);
}
/*
** Last, pass all channels plus statuses
*/
{
Channel *channel;
for (channel = channels; channel; channel = channel->nextch)
{
send_channel_modes_sjoin3(client, channel);
if (channel->topic_time)
sendto_one(client, NULL, "TOPIC %s %s %lld :%s",
channel->name, channel->topic_nick,
(long long)channel->topic_time, channel->topic);
send_moddata_channel(client, channel);
}
}
/* Send ModData for all member(ship) structs */
send_moddata_members(client);
/* pass on TKLs */
tkl_sync(client);
RunHook(HOOKTYPE_SERVER_SYNC, client);
sendto_one(client, NULL, "NETINFO %i %lld %i %s 0 0 0 :%s",
irccounts.global_max, (long long)TStime(), UnrealProtocol,
CLOAK_KEYCRC,
ircnetwork);
/* Send EOS (End Of Sync) to the just linked server... */
sendto_one(client, NULL, ":%s EOS", me.id);
RunHook(HOOKTYPE_POST_SERVER_CONNECT, client);
return 0;
}
void tls_link_notification_verify(Client *acptr, ConfigItem_link *aconf)
{
char *spki_fp;
@@ -1272,231 +1501,6 @@ void tls_link_notification_verify(Client *acptr, ConfigItem_link *aconf)
}
}
#define SafeStr(x) ((x && *(x)) ? (x) : "*")
/** Broadcast SINFO.
* @param cptr The server to send the information about.
* @param to The server to send the information TO (NULL for broadcast).
* @param except The direction NOT to send to.
* This function takes into account that the server may not
* provide all of the detailed info. If any information is
* absent we will send 0 for numbers and * for NULL strings.
*/
void _broadcast_sinfo(Client *acptr, Client *to, Client *except)
{
char chanmodes[128], buf[512];
if (acptr->serv->features.chanmodes[0])
{
snprintf(chanmodes, sizeof(chanmodes), "%s,%s,%s,%s",
acptr->serv->features.chanmodes[0],
acptr->serv->features.chanmodes[1],
acptr->serv->features.chanmodes[2],
acptr->serv->features.chanmodes[3]);
} else {
strlcpy(chanmodes, "*", sizeof(chanmodes));
}
snprintf(buf, sizeof(buf), "%lld %d %s %s %s :%s",
(long long)acptr->serv->boottime,
acptr->serv->features.protocol,
SafeStr(acptr->serv->features.usermodes),
chanmodes,
SafeStr(acptr->serv->features.nickchars),
SafeStr(acptr->serv->features.software));
if (to)
{
/* Targetted to one server */
sendto_one(to, NULL, ":%s SINFO %s", acptr->id, buf);
} else {
/* Broadcast (except one side...) */
sendto_server(except, 0, 0, NULL, ":%s SINFO %s", acptr->id, buf);
}
}
int server_sync(Client *cptr, ConfigItem_link *aconf)
{
char *inpath = get_client_name(cptr, TRUE);
Client *acptr;
int incoming = IsUnknown(cptr) ? 1 : 0;
ircd_log(LOG_SERVER, "SERVER %s", cptr->name);
if (cptr->local->passwd)
{
safe_free(cptr->local->passwd);
cptr->local->passwd = NULL;
}
if (incoming)
{
/* If this is an incomming connection, then we have just received
* their stuff and now send our stuff back.
*/
if (!IsEAuth(cptr)) /* if eauth'd then we already sent the passwd */
sendto_one(cptr, NULL, "PASS :%s", (aconf->auth->type == AUTHTYPE_PLAINTEXT) ? aconf->auth->data : "*");
send_proto(cptr, aconf);
send_server_message(cptr);
}
/* Set up server structure */
free_pending_net(cptr);
SetServer(cptr);
irccounts.me_servers++;
irccounts.servers++;
irccounts.unknown--;
list_move(&cptr->client_node, &global_server_list);
list_move(&cptr->lclient_node, &lclient_list);
list_add(&cptr->special_node, &server_list);
if (find_uline(cptr->name))
{
if (cptr->serv && cptr->serv->features.software && !strncmp(cptr->serv->features.software, "UnrealIRCd-", 11))
{
sendto_realops("\002WARNING:\002 Bad ulines! It seems your server is misconfigured: "
"your ulines { } block is matching an UnrealIRCd server (%s). "
"This is not correct and will cause security issues. "
"ULines should only be added for services! "
"See https://www.unrealircd.org/docs/FAQ#bad-ulines",
cptr->name);
}
SetULine(cptr);
}
find_or_add(cptr->name);
if (IsSecure(cptr))
{
sendto_umode_global(UMODE_OPER,
"(\2link\2) Secure link %s -> %s established (%s)",
me.name, inpath, tls_get_cipher(cptr->local->ssl));
tls_link_notification_verify(cptr, aconf);
}
else
{
sendto_umode_global(UMODE_OPER,
"(\2link\2) Link %s -> %s established",
me.name, inpath);
/* Print out a warning if linking to a non-TLS server unless it's localhost.
* Yeah.. there are still other cases when non-TLS links are fine (eg: local IP
* of the same machine), we won't bother with detecting that. -- Syzop
*/
if (!IsLocalhost(cptr) && (iConf.plaintext_policy_server == POLICY_WARN))
{
sendto_realops("\002WARNING:\002 This link is unencrypted (not SSL/TLS). We highly recommend to use "
"SSL/TLS for server linking. See https://www.unrealircd.org/docs/Linking_servers");
}
if (IsSecure(cptr) && (iConf.outdated_tls_policy_server == POLICY_WARN) && outdated_tls_client(cptr))
{
sendto_realops("\002WARNING:\002 This link is using an outdated SSL/TLS protocol or cipher (%s).",
tls_get_cipher(cptr->local->ssl));
}
}
add_to_client_hash_table(cptr->name, cptr);
/* doesnt duplicate cptr->serv if allocted this struct already */
make_server(cptr);
cptr->serv->up = me.name;
cptr->srvptr = &me;
if (!cptr->serv->conf)
cptr->serv->conf = aconf; /* Only set serv->conf to aconf if not set already! Bug #0003913 */
if (incoming)
cptr->serv->conf->refcount++;
cptr->serv->conf->class->clients++;
cptr->local->class = cptr->serv->conf->class;
RunHook(HOOKTYPE_SERVER_CONNECT, cptr);
/* Broadcast new server to the rest of the network */
sendto_server(cptr, 0, 0, NULL, ":%s SID %s 2 %s :%s",
cptr->srvptr->id, cptr->name, cptr->id, cptr->info);
/* Broadcast the just-linked-in featureset to other servers on our side */
broadcast_sinfo(cptr, NULL, cptr);
/* Send moddata of &me (if any, likely minimal) */
send_moddata_client(cptr, &me);
list_for_each_entry_reverse(acptr, &global_server_list, client_node)
{
/* acptr->direction == acptr for acptr == cptr */
if (acptr->direction == cptr)
continue;
if (IsServer(acptr))
{
sendto_one(cptr, NULL, ":%s SID %s %d %s :%s",
acptr->srvptr->id,
acptr->name, acptr->hopcount + 1,
acptr->id, acptr->info);
/* Also signal to the just-linked server which
* servers are fully linked.
* Now you might ask yourself "Why don't we just
* assume every server you get during link phase
* is fully linked?", well.. there's a race condition
* if 2 servers link (almost) at the same time,
* then you would think the other one is fully linked
* while in fact he was not.. -- Syzop.
*/
if (acptr->serv->flags.synced)
{
sendto_one(cptr, NULL, ":%s EOS", acptr->id);
#ifdef DEBUGMODE
ircd_log(LOG_ERROR, "[EOSDBG] server_sync: sending to uplink '%s' with src %s...",
cptr->name, acptr->name);
#endif
}
/* Send SINFO of our servers to their side */
broadcast_sinfo(acptr, cptr, NULL);
send_moddata_client(cptr, acptr); /* send moddata of server 'acptr' (if any, likely minimal) */
}
}
/* Synching nick information */
list_for_each_entry_reverse(acptr, &client_list, client_node)
{
/* acptr->direction == acptr for acptr == cptr */
if (acptr->direction == cptr)
continue;
if (IsUser(acptr))
introduce_user(cptr, acptr);
}
/*
** Last, pass all channels plus statuses
*/
{
Channel *channel;
for (channel = channels; channel; channel = channel->nextch)
{
send_channel_modes_sjoin3(cptr, channel);
if (channel->topic_time)
sendto_one(cptr, NULL, "TOPIC %s %s %lld :%s",
channel->chname, channel->topic_nick,
(long long)channel->topic_time, channel->topic);
send_moddata_channel(cptr, channel);
}
}
/* Send ModData for all member(ship) structs */
send_moddata_members(cptr);
/* pass on TKLs */
tkl_sync(cptr);
RunHook(HOOKTYPE_SERVER_SYNC, cptr);
sendto_one(cptr, NULL, "NETINFO %i %lld %i %s 0 0 0 :%s",
irccounts.global_max, (long long)TStime(), UnrealProtocol,
CLOAK_KEYCRC,
ircnetwork);
/* Send EOS (End Of Sync) to the just linked server... */
sendto_one(cptr, NULL, ":%s EOS", me.id);
#ifdef DEBUGMODE
ircd_log(LOG_ERROR, "[EOSDBG] server_sync: sending to justlinked '%s' with src ME...",
cptr->name);
#endif
RunHook(HOOKTYPE_POST_SERVER_CONNECT, cptr);
return 0;
}
/** This will send "to" a full list of the modes for channel channel,
*
* Half of it recoded by Syzop: the whole buffering and size checking stuff
@@ -1517,7 +1521,7 @@ void send_channel_modes_sjoin3(Client *to, Channel *channel)
int prebuflen = 0; /* points to after the <sjointoken> <TS> <chan> <fixmodes> <fixparas <..>> : part */
int sent = 0; /* we need this so we send at least 1 message about the channel (eg if +P and no members, no bans, #4459) */
if (*channel->chname != '#')
if (*channel->name != '#')
return;
nomode = 0;
@@ -1546,19 +1550,19 @@ void send_channel_modes_sjoin3(Client *to, Channel *channel)
{
ircsnprintf(buf, sizeof(buf),
":%s SJOIN %lld %s :", me.id,
(long long)channel->creationtime, channel->chname);
(long long)channel->creationtime, channel->name);
}
if (nopara && !nomode)
{
ircsnprintf(buf, sizeof(buf),
":%s SJOIN %lld %s %s :", me.id,
(long long)channel->creationtime, channel->chname, modebuf);
(long long)channel->creationtime, channel->name, modebuf);
}
if (!nopara && !nomode)
{
ircsnprintf(buf, sizeof(buf),
":%s SJOIN %lld %s %s %s :", me.id,
(long long)channel->creationtime, channel->chname, modebuf, parabuf);
(long long)channel->creationtime, channel->name, modebuf, parabuf);
}
prebuflen = strlen(buf);
+22 -21
View File
@@ -82,9 +82,9 @@ void send_local_chan_mode(MessageTag *recv_mtags, Client *client, Channel *chann
{
MessageTag *mtags = NULL;
new_message_special(client, recv_mtags, &mtags, ":%s MODE %s %s %s", client->name, channel->chname, modebuf, parabuf);
new_message_special(client, recv_mtags, &mtags, ":%s MODE %s %s %s", client->name, channel->name, modebuf, parabuf);
sendto_channel(channel, client, NULL, 0, 0, SEND_LOCAL, mtags,
":%s MODE %s %s %s", client->name, channel->chname, modebuf, parabuf);
":%s MODE %s %s %s", client->name, channel->name, modebuf, parabuf);
if (MyConnect(client))
RunHook7(HOOKTYPE_LOCAL_CHANMODE, client, channel, mtags, modebuf, parabuf, 0, -1);
else
@@ -178,10 +178,16 @@ CMD_FUNC(cmd_sjoin)
if (parc < 5)
nomode = 1;
channel = get_channel(client, parv[2], CREATE);
ts = (time_t)atol(parv[1]);
channel = find_channel(parv[2]);
if (!channel)
{
channel = make_channel(parv[2]);
channel->creationtime = ts;
oldts = -1;
}
if (channel->creationtime > ts)
{
removeours = 1;
@@ -197,12 +203,7 @@ CMD_FUNC(cmd_sjoin)
merge = 1;
}
if (channel->creationtime == 0)
{
oldts = -1;
channel->creationtime = ts;
}
else
if (channel->creationtime > 0)
{
oldts = channel->creationtime;
}
@@ -213,7 +214,7 @@ CMD_FUNC(cmd_sjoin)
if (ts != 0)
sendto_ops
("Warning! Possible desync: SJOIN for channel %s has a fishy timestamp (%lld) [%s/%s]",
channel->chname, (long long)ts, client->name, client->direction->name);
channel->name, (long long)ts, client->name, client->direction->name);
}
parabuf[0] = '\0';
@@ -366,7 +367,7 @@ CMD_FUNC(cmd_sjoin)
{
/* this obviously should never happen */
sendto_ops("Malformed SJOIN piece from %s for channel %s: %s",
client->name, channel->chname, tp);
client->name, channel->name, tp);
continue;
}
*end++ = '\0';
@@ -376,7 +377,7 @@ CMD_FUNC(cmd_sjoin)
{
/* missing setby parameter */
sendto_ops("Malformed SJOIN piece from %s for channel %s: %s",
client->name, channel->chname, tp);
client->name, channel->name, tp);
continue;
}
*p++ = '\0';
@@ -485,11 +486,11 @@ getnick:
sendto_one(client, NULL,
":%s KICK %s %s :Fake direction",
me.id, channel->chname, acptr->name);
me.id, channel->name, acptr->name);
sendto_realops
("Fake direction from user %s in SJOIN from %s(%s) at %s",
nick, client->srvptr->name,
client->name, channel->chname);
client->name, channel->name);
continue;
}
@@ -506,7 +507,7 @@ getnick:
add_user_to_channel(channel, acptr, modeflags);
RunHook4(HOOKTYPE_REMOTE_JOIN, acptr, channel, recv_mtags, NULL);
new_message_special(acptr, recv_mtags, &mtags, ":%s JOIN %s", acptr->name, channel->chname);
new_message_special(acptr, recv_mtags, &mtags, ":%s JOIN %s", acptr->name, channel->name);
send_join_to_local_users(acptr, channel, mtags);
free_message_tags(mtags);
}
@@ -527,7 +528,7 @@ getnick:
{
ircd_log(LOG_ERROR, "Oversized SJOIN: '%s' + '%s%s'",
uid_buf, prefix, acptr->id);
sendto_realops("Oversized SJOIN for %s -- see ircd log", channel->chname);
sendto_realops("Oversized SJOIN for %s -- see ircd log", channel->name);
continue;
}
}
@@ -543,7 +544,7 @@ getnick:
{
ircd_log(LOG_ERROR, "Oversized SJOIN: '%s' + '%s%s'",
uid_sjsby_buf, prefix, acptr->id);
sendto_realops("Oversized SJOIN for %s -- see ircd log", channel->chname);
sendto_realops("Oversized SJOIN for %s -- see ircd log", channel->name);
continue;
}
}
@@ -602,7 +603,7 @@ getnick:
{
ircd_log(LOG_ERROR, "Oversized SJOIN: '%s' + '%s%s'",
uid_buf, prefix, nick);
sendto_realops("Oversized SJOIN for %s -- see ircd log", channel->chname);
sendto_realops("Oversized SJOIN for %s -- see ircd log", channel->name);
continue;
}
}
@@ -623,7 +624,7 @@ getnick:
if (strlen(uid_sjsby_buf) + strlen(scratch_buf) > BUFSIZE - 5)
{
ircd_log(LOG_ERROR, "Oversized SJOIN: '%s' + '%s'", uid_sjsby_buf, scratch_buf);
sendto_realops("Oversized SJOIN for %s -- see ircd log", channel->chname);
sendto_realops("Oversized SJOIN for %s -- see ircd log", channel->name);
continue;
}
}
@@ -886,7 +887,7 @@ getnick:
new_message(client, NULL, &mtags);
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, NULL,
":%s NOTICE %s :*** TS for %s changed from %lld to %lld",
me.name, channel->chname, channel->chname,
me.name, channel->name, channel->name,
(long long)oldts, (long long)channel->creationtime);
free_message_tags(mtags);
}
+1 -1
View File
@@ -776,7 +776,7 @@ int stats_officialchannels(Client *client, char *para)
for (x = conf_offchans; x; x = x->next)
{
sendtxtnumeric(client, "%s %s", x->chname, x->topic ? x->topic : "");
sendtxtnumeric(client, "%s %s", x->name, x->topic ? x->topic : "");
}
return 0;
}
+7 -7
View File
@@ -210,7 +210,7 @@ void channel_svsmode(Client *client, int parc, char *parv[])
if ((parc < 3) || BadPtr(parv[2]))
return;
if (!(channel = find_channel(parv[1], NULL)))
if (!(channel = find_channel(parv[1])))
return;
for(m = parv[2]; *m; m++)
@@ -231,7 +231,7 @@ void channel_svsmode(Client *client, int parc, char *parv[])
if (what != MODE_DEL)
{
sendto_realops("Warning! Received SVS(2)MODE with +%c for %s from %s, which is invalid!!",
*m, channel->chname, client->name);
*m, channel->name, client->name);
continue;
}
channel_flags = char_to_channelflag(*m);
@@ -268,7 +268,7 @@ void channel_svsmode(Client *client, int parc, char *parv[])
break;
default:
sendto_realops("Warning! Invalid mode `%c' used with 'SVSMODE %s %s %s' (from %s %s)",
*m, channel->chname, parv[2], parv[3] ? parv[3] : "",
*m, channel->name, parv[2], parv[3] ? parv[3] : "",
client->direction->name, client->name);
break;
}
@@ -283,8 +283,8 @@ void channel_svsmode(Client *client, int parc, char *parv[])
sendto_channel(channel, client, client, 0, 0, SEND_LOCAL, mtags,
":%s MODE %s %s %s",
client->name, channel->chname, modebuf, parabuf);
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s %s %s", client->id, channel->chname, modebuf, parabuf);
client->name, channel->name, modebuf, parabuf);
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s %s %s", client->id, channel->name, modebuf, parabuf);
/* Activate this hook just like cmd_mode.c */
RunHook7(HOOKTYPE_REMOTE_CHANMODE, client, channel, mtags, modebuf, parabuf, 0, 0);
@@ -598,8 +598,8 @@ void add_send_mode_param(Channel *channel, Client *from, char what, char mode, c
new_message(from, NULL, &mtags);
sendto_channel(channel, from, from, 0, 0, SEND_LOCAL, mtags,
":%s MODE %s %s %s",
from->name, channel->chname, modebuf, parabuf);
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s %s %s", from->id, channel->chname, modebuf, parabuf);
from->name, channel->name, modebuf, parabuf);
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s %s %s", from->id, channel->name, modebuf, parabuf);
free_message_tags(mtags);
send = 0;
*parabuf = 0;
+86 -162
View File
@@ -55,6 +55,7 @@ char _tkl_typetochar(int type);
int _tkl_chartotype(char c);
int tkl_banexception_chartotype(char c);
char *_tkl_type_string(TKL *tk);
char *_tkl_type_config_string(TKL *tk);
char *tkl_banexception_configname_to_chars(char *name);
TKL *_tkl_add_serverban(int type, char *usermask, char *hostmask, char *reason, char *set_by,
time_t expire_at, time_t set_at, int soft, int flags);
@@ -71,6 +72,7 @@ void _sendnotice_tkl_add(TKL *tkl);
void _free_tkl(TKL *tkl);
void _tkl_del_line(TKL *tkl);
static void _tkl_check_local_remove_shun(TKL *tmp);
char *_tkl_uhost(TKL *tkl, char *buf, size_t buflen, int options);
void tkl_expire_entry(TKL * tmp);
EVENT(tkl_check_expire);
int _find_tkline_match(Client *client, int skip_soft);
@@ -161,6 +163,7 @@ MOD_TEST()
EfunctionAdd(modinfo->handle, EFUNC_TKL_TYPETOCHAR, TO_INTFUNC(_tkl_typetochar));
EfunctionAdd(modinfo->handle, EFUNC_TKL_CHARTOTYPE, TO_INTFUNC(_tkl_chartotype));
EfunctionAddPChar(modinfo->handle, EFUNC_TKL_TYPE_STRING, _tkl_type_string);
EfunctionAddPChar(modinfo->handle, EFUNC_TKL_TYPE_CONFIG_STRING, _tkl_type_config_string);
EfunctionAddPVoid(modinfo->handle, EFUNC_TKL_ADD_SERVERBAN, TO_PVOIDFUNC(_tkl_add_serverban));
EfunctionAddPVoid(modinfo->handle, EFUNC_TKL_ADD_BANEXCEPTION, TO_PVOIDFUNC(_tkl_add_banexception));
EfunctionAddPVoid(modinfo->handle, EFUNC_TKL_ADD_NAMEBAN, TO_PVOIDFUNC(_tkl_add_nameban));
@@ -191,6 +194,7 @@ MOD_TEST()
EfunctionAddVoid(modinfo->handle, EFUNC_SENDNOTICE_TKL_ADD, _sendnotice_tkl_add);
EfunctionAddVoid(modinfo->handle, EFUNC_SENDNOTICE_TKL_DEL, _sendnotice_tkl_del);
EfunctionAdd(modinfo->handle, EFUNC_FIND_TKL_EXCEPTION, _find_tkl_exception);
EfunctionAddPChar(modinfo->handle, EFUNC_TKL_UHOST, _tkl_uhost);
return MOD_SUCCESS;
}
@@ -2123,8 +2127,9 @@ int _tkl_hash(unsigned int c)
else if ((c >= 'A') && (c <= 'Z'))
return c-'A';
else {
sendto_realops("[BUG] tkl_hash() called with out of range parameter (c = '%c') !!!", c);
ircd_log(LOG_ERROR, "[BUG] tkl_hash() called with out of range parameter (c = '%c') !!!", c);
unreal_log(ULOG_ERROR, "bug", "TKL_HASH_INVALID", NULL,
"tkl_hash() called with out of range parameter (c = '$tkl_char') !!!",
log_data_char("tkl_char", c));
return 0;
}
#else
@@ -2141,8 +2146,9 @@ char _tkl_typetochar(int type)
for (i=0; tkl_types[i].config_name; i++)
if ((tkl_types[i].type == type) && tkl_types[i].tkltype)
return tkl_types[i].letter;
sendto_realops("[BUG]: tkl_typetochar(): unknown type 0x%x !!!", type);
ircd_log(LOG_ERROR, "[BUG] tkl_typetochar(): unknown type 0x%x !!!", type);
unreal_log(ULOG_ERROR, "bug", "TKL_TYPETOCHAR_INVALID", NULL,
"tkl_typetochar(): unknown type $tkl_type!!!",
log_data_integer("tkl_type", type));
return 0;
}
@@ -2201,13 +2207,13 @@ char *tkl_banexception_configname_to_chars(char *name)
char *_tkl_type_string(TKL *tkl)
{
static char txt[256];
int i;
*txt = '\0';
if (TKLIsServerBan(tkl) && (tkl->ptr.serverban->subtype == TKL_SUBTYPE_SOFT))
strlcpy(txt, "Soft ", sizeof(txt));
int i;
for (i=0; tkl_types[i].config_name; i++)
{
if ((tkl_types[i].type == tkl->type) && tkl_types[i].tkltype)
@@ -2221,6 +2227,18 @@ char *_tkl_type_string(TKL *tkl)
return txt;
}
/** Short config string, lowercase alnum with possibly hyphens (eg: 'kline') */
char *_tkl_type_config_string(TKL *tkl)
{
int i;
for (i=0; tkl_types[i].config_name; i++)
if ((tkl_types[i].type == tkl->type) && tkl_types[i].tkltype)
return tkl_types[i].config_name;
return "???";
}
int tkl_banexception_matches_type(TKL *except, int bantype)
{
char *p;
@@ -2746,7 +2764,7 @@ void _tkl_check_local_remove_shun(TKL *tmp)
* that can be used in oper notices like expiring kline, added kline, etc.
*/
#define NO_SOFT_PREFIX 1
char *tkl_uhost(TKL *tkl, char *buf, size_t buflen, int options)
char *_tkl_uhost(TKL *tkl, char *buf, size_t buflen, int options)
{
if (TKLIsServerBan(tkl))
{
@@ -2784,56 +2802,29 @@ char *tkl_uhost(TKL *tkl, char *buf, size_t buflen, int options)
*/
void tkl_expire_entry(TKL *tkl)
{
char *whattype = tkl_type_string(tkl);
if (!tkl)
return;
if (tkl->type & TKL_SPAMF)
{
/* Impossible */
} else
if (TKLIsServerBan(tkl))
{
char uhostbuf[BUFSIZE];
char *uhost = tkl_uhost(tkl, uhostbuf, sizeof(uhostbuf), 0);
sendto_snomask(SNO_TKL,
"*** Expiring %s (%s) made by %s (Reason: %s) set %lld seconds ago",
whattype, uhost, tkl->set_by, tkl->ptr.serverban->reason,
(long long)(TStime() - tkl->set_at));
ircd_log
(LOG_TKL, "Expiring %s (%s) made by %s (Reason: %s) set %lld seconds ago",
whattype, uhost, tkl->set_by, tkl->ptr.serverban->reason,
(long long)(TStime() - tkl->set_at));
unreal_log(ULOG_INFO, "tkl", "TKL_EXPIRE", NULL,
"Expiring $tkl.type_string '$tkl' [reason: $tkl.reason] [by: $tkl.set_by] set $tkl.set_at_delta seconds ago",
log_data_tkl("tkl", tkl));
}
else if (TKLIsNameBan(tkl))
{
if (!tkl->ptr.nameban->hold)
{
sendto_snomask(SNO_TKL,
"*** Expiring %s (%s) made by %s (Reason: %s) set %lld seconds ago",
whattype, tkl->ptr.nameban->name, tkl->set_by, tkl->ptr.nameban->reason,
(long long)(TStime() - tkl->set_at));
ircd_log
(LOG_TKL, "Expiring %s (%s) made by %s (Reason: %s) set %lld seconds ago",
whattype, tkl->ptr.nameban->name, tkl->set_by, tkl->ptr.nameban->reason,
(long long)(TStime() - tkl->set_at));
unreal_log(ULOG_INFO, "tkl", "TKL_EXPIRE", NULL,
"Expiring $tkl.type_string '$tkl' [reason: $tkl.reason] [by: $tkl.set_by] set $tkl.set_at_delta seconds ago",
log_data_tkl("tkl", tkl));
}
}
else if (TKLIsBanException(tkl))
{
char uhostbuf[BUFSIZE];
char *uhost = tkl_uhost(tkl, uhostbuf, sizeof(uhostbuf), 0);
sendto_snomask(SNO_TKL,
"*** Expiring %s (%s) for types '%s' made by %s (Reason: %s) set %lld seconds ago",
whattype, uhost, tkl->ptr.banexception->bantypes, tkl->set_by, tkl->ptr.banexception->reason,
(long long)(TStime() - tkl->set_at));
ircd_log
(LOG_TKL, "Expiring %s (%s) for types '%s' made by %s (Reason: %s) set %lld seconds ago",
whattype, uhost, tkl->ptr.banexception->bantypes, tkl->set_by, tkl->ptr.banexception->reason,
(long long)(TStime() - tkl->set_at));
unreal_log(ULOG_INFO, "tkl", "TKL_EXPIRE", NULL,
"Expiring $tkl.type_string '$tkl' [type: $tkl.exception_types] [reason: $tkl.reason] [by: $tkl.set_by] set $tkl.set_at_delta seconds ago",
log_data_tkl("tkl", tkl));
}
// FIXME: so.. this isn't logged? or what?
if (tkl->type & TKL_SHUN)
tkl_check_local_remove_shun(tkl);
@@ -3161,14 +3152,12 @@ int spamfilter_check_users(TKL *tkl)
continue; /* No match */
/* matched! */
ircsnprintf(buf, sizeof(buf), "[Spamfilter] %s!%s@%s matches filter '%s': [%s: '%s'] [%s]",
client->name, client->user->username, client->user->realhost,
tkl->ptr.spamfilter->match->str,
"user", spamfilter_user,
unreal_decodespace(tkl->ptr.spamfilter->tkl_reason));
unreal_log(ULOG_INFO, "tkl", "SPAMFILTER_MATCH", client,
"[Spamfilter] $client.nuh matches filter '$tkl': [cmd: $command: '$str'] [reason: $tkl.reason] [action: $tkl.ban_action]",
log_data_tkl("tkl", tkl),
log_data_string("command", "USER"),
log_data_string("str", spamfilter_user));
sendto_snomask_global(SNO_SPAMF, "%s", buf);
ircd_log(LOG_SPAMFILTER, "%s", buf);
RunHook6(HOOKTYPE_LOCAL_SPAMFILTER, client, spamfilter_user, spamfilter_user, SPAMF_USER, NULL, tkl);
matches++;
}
@@ -3177,36 +3166,6 @@ int spamfilter_check_users(TKL *tkl)
return matches;
}
/** Similarly to previous, but match against all global users.
* FUNCTION IS UNUSED !!
*/
int spamfilter_check_all_users(Client *from, TKL *tkl)
{
char spamfilter_user[NICKLEN + USERLEN + HOSTLEN + REALLEN + 64]; /* n!u@h:r */
int matches = 0;
Client *acptr;
list_for_each_entry(acptr, &client_list, client_node)
{
if (IsUser(acptr))
{
spamfilter_build_user_string(spamfilter_user, acptr->name, acptr);
if (!unreal_match(tkl->ptr.spamfilter->match, spamfilter_user))
continue; /* No match */
/* matched! */
sendnotice(from, "[Spamfilter] %s!%s@%s matches filter '%s': [%s: '%s'] [%s]",
acptr->name, acptr->user->username, acptr->user->realhost,
tkl->ptr.spamfilter->match->str,
"user", spamfilter_user,
unreal_decodespace(tkl->ptr.spamfilter->tkl_reason));
matches++;
}
}
return matches;
}
/** Check if the nick or channel name is banned (Q-Line).
* @param client The possibly affected user.
* @param name The nick or channel to check.
@@ -3827,66 +3786,32 @@ void _sendnotice_tkl_add(TKL *tkl)
if (TKLIsServerBan(tkl))
{
char uhostbuf[BUFSIZE];
char *uhost = tkl_uhost(tkl, uhostbuf, sizeof(uhostbuf), 0);
if (tkl->expire_at != 0)
{
ircsnprintf(buf, sizeof(buf), "%s added for %s on %s GMT (from %s to expire at %s GMT: %s)",
tkl_type_str, uhost,
set_at, tkl->set_by, expire_at, tkl->ptr.serverban->reason);
} else {
ircsnprintf(buf, sizeof(buf), "Permanent %s added for %s on %s GMT (from %s: %s)",
tkl_type_str, uhost,
set_at, tkl->set_by, tkl->ptr.serverban->reason);
}
unreal_log(ULOG_INFO, "tkl", "TKL_ADD", NULL,
"$tkl.type_string added: '$tkl' [reason: $tkl.reason] [by: $tkl.set_by] [expires: $tkl.expire_at_string]",
log_data_tkl("tkl", tkl));
} else
if (TKLIsNameBan(tkl))
{
if (tkl->expire_at > 0)
{
ircsnprintf(buf, sizeof(buf), "%s added for %s on %s GMT (from %s to expire at %s GMT: %s)",
tkl_type_str, tkl->ptr.nameban->name, set_at, tkl->set_by, expire_at, tkl->ptr.nameban->reason);
} else {
ircsnprintf(buf, sizeof(buf), "Permanent %s added for %s on %s GMT (from %s: %s)",
tkl_type_str, tkl->ptr.nameban->name, set_at, tkl->set_by, tkl->ptr.nameban->reason);
}
unreal_log(ULOG_INFO, "tkl", "TKL_ADD", NULL,
"$tkl.type_string added: '$tkl' [reason: $tkl.reason] [by: $tkl.set_by] [expires: $tkl.expire_at_string]",
log_data_tkl("tkl", tkl));
} else
if (TKLIsSpamfilter(tkl))
{
/* Spamfilter */
ircsnprintf(buf, sizeof(buf),
"Spamfilter added: '%s' [type: %s] [target: %s] [action: %s] [reason: %s] on %s GMT (from %s)",
tkl->ptr.spamfilter->match->str,
unreal_match_method_valtostr(tkl->ptr.spamfilter->match->type),
spamfilter_target_inttostring(tkl->ptr.spamfilter->target),
banact_valtostring(tkl->ptr.spamfilter->action),
unreal_decodespace(tkl->ptr.spamfilter->tkl_reason),
set_at,
tkl->set_by);
unreal_log(ULOG_INFO, "tkl", "TKL_ADD", NULL,
"Spamfilter added: '$tkl' [type: $tkl.match_type] [targets: $tkl.spamfilter_targets] "
"[action: $tkl.ban_action] [reason: $tkl.reason] [by: $tkl.set_by]",
log_data_tkl("tkl", tkl));
} else
if (TKLIsBanException(tkl))
{
char uhostbuf[BUFSIZE];
char *uhost = tkl_uhost(tkl, uhostbuf, sizeof(uhostbuf), 0);
if (tkl->expire_at != 0)
{
ircsnprintf(buf, sizeof(buf), "%s added for %s for types '%s' on %s GMT (from %s to expire at %s GMT: %s)",
tkl_type_str, uhost,
tkl->ptr.banexception->bantypes,
set_at, tkl->set_by, expire_at, tkl->ptr.banexception->reason);
} else {
ircsnprintf(buf, sizeof(buf), "Permanent %s added for %s for types '%s' on %s GMT (from %s: %s)",
tkl_type_str, uhost,
tkl->ptr.banexception->bantypes,
set_at, tkl->set_by, tkl->ptr.banexception->reason);
}
unreal_log(ULOG_INFO, "tkl", "TKL_ADD", NULL,
"$tkl.type_string added: '$tkl' [types: $tkl.exception_types] [by: $tkl.set_by] [expires: $tkl.expire_at_string]",
log_data_tkl("tkl", tkl));
} else
{
ircsnprintf(buf, sizeof(buf), "[BUG] %s added but type unhandled in sendnotice_tkl_add()!!!", tkl_type_str);
}
sendto_snomask(SNO_TKL, "*** %s", buf);
ircd_log(LOG_TKL, "%s", buf);
}
/** Send a notice to opers about the TKL that is being deleted */
@@ -3907,40 +3832,36 @@ void _sendnotice_tkl_del(char *removed_by, TKL *tkl)
if (TKLIsServerBan(tkl))
{
char uhostbuf[BUFSIZE];
char *uhost = tkl_uhost(tkl, uhostbuf, sizeof(uhostbuf), 0);
ircsnprintf(buf, sizeof(buf),
"%s removed %s %s (set at %s - reason: %s)",
removed_by, tkl_type_str, uhost,
set_at, tkl->ptr.serverban->reason);
unreal_log(ULOG_INFO, "tkl", "TKL_DEL", NULL,
"$tkl.type_string removed: '$tkl' [reason: $tkl.reason] [by: $removed_by] [set at: $tkl.set_at_string]",
log_data_tkl("tkl", tkl),
log_data_string("removed_by", removed_by));
} else
if (TKLIsNameBan(tkl))
{
ircsnprintf(buf, sizeof(buf),
"%s removed %s %s (set at %s - reason: %s)",
removed_by, tkl_type_str, tkl->ptr.nameban->name, set_at, tkl->ptr.nameban->reason);
unreal_log(ULOG_INFO, "tkl", "TKL_DEL", NULL,
"$tkl.type_string removed: '$tkl' [reason: $tkl.reason] [by: $removed_by] [set at: $tkl.set_at_string]",
log_data_tkl("tkl", tkl),
log_data_string("removed_by", removed_by));
} else
if (TKLIsSpamfilter(tkl))
{
ircsnprintf(buf, sizeof(buf),
"%s removed Spamfilter '%s' (set at %s)",
removed_by, tkl->ptr.spamfilter->match->str, set_at);
unreal_log(ULOG_INFO, "tkl", "TKL_DEL", NULL,
"Spamfilter removed: '$tkl' [type: $tkl.match_type] [targets: $tkl.spamfilter_targets] "
"[action: $tkl.ban_action] [reason: $tkl.reason] [by: $removed_by] [set at: $tkl.set_at_string]",
log_data_tkl("tkl", tkl),
log_data_string("removed_by", removed_by));
} else
if (TKLIsBanException(tkl))
{
char uhostbuf[BUFSIZE];
char *uhost = tkl_uhost(tkl, uhostbuf, sizeof(uhostbuf), 0);
ircsnprintf(buf, sizeof(buf),
"%s removed exception on %s (set at %s - reason: %s)",
removed_by, uhost,
set_at, tkl->ptr.banexception->reason);
unreal_log(ULOG_INFO, "tkl", "TKL_DEL", NULL,
"$tkl.type_string removed: '$tkl' [types: $tkl.exception_types] [by: $removed_by] [set at: $tkl.set_at_string]",
log_data_tkl("tkl", tkl),
log_data_string("removed_by", removed_by));
} else
{
ircsnprintf(buf, sizeof(buf), "[BUG] %s added but type unhandled in sendnotice_tkl_del()!!!!!", tkl_type_str);
}
sendto_snomask(SNO_TKL, "*** %s", buf);
ircd_log(LOG_TKL, "%s", buf);
}
/** Add a TKL using the TKL layer. See cmd_tkl for parv[] and protocol documentation. */
@@ -4656,11 +4577,11 @@ int _join_viruschan(Client *client, TKL *tkl, int type)
sendnotice(client, "You are now restricted to talking in %s: %s",
SPAMFILTER_VIRUSCHAN, unreal_decodespace(tkl->ptr.spamfilter->tkl_reason));
channel = find_channel(SPAMFILTER_VIRUSCHAN, NULL);
channel = find_channel(SPAMFILTER_VIRUSCHAN);
if (channel)
{
MessageTag *mtags = NULL;
ircsnprintf(chbuf, sizeof(chbuf), "@%s", channel->chname);
ircsnprintf(chbuf, sizeof(chbuf), "@%s", channel->name);
ircsnprintf(buf, sizeof(buf), "[Spamfilter] %s matched filter '%s' [%s] [%s]",
client->name, tkl->ptr.spamfilter->match->str, cmdname_by_spamftarget(type),
unreal_decodespace(tkl->ptr.spamfilter->tkl_reason));
@@ -4751,22 +4672,26 @@ int _match_spamfilter(Client *client, char *str_in, int target, char *cmd, char
if ((SPAMFILTER_DETECTSLOW_FATAL > 0) && (ms_past > SPAMFILTER_DETECTSLOW_FATAL))
{
sendto_realops("[Spamfilter] WARNING: Too slow spamfilter detected (took %ld msec to execute) "
"-- spamfilter will be \002REMOVED!\002: %s", ms_past, tkl->ptr.spamfilter->match->str);
unreal_log(ULOG_ERROR, "tkl", "SPAMFILTER_SLOW_FATAL", NULL,
"[Spamfilter] WARNING: Too slow spamfilter detected (took $msec_time msec to execute) "
"-- spamfilter will be \002REMOVED!\002: $tkl",
log_data_tkl("tkl", tkl),
log_data_integer("msec_time", ms_past));
tkl_del_line(tkl);
return 0; /* Act as if it didn't match, even if it did.. it's gone now anyway.. */
} else
if ((SPAMFILTER_DETECTSLOW_WARN > 0) && (ms_past > SPAMFILTER_DETECTSLOW_WARN))
{
sendto_realops("[Spamfilter] WARNING: SLOW Spamfilter detected (took %ld msec to execute): %s",
ms_past, tkl->ptr.spamfilter->match->str);
unreal_log(ULOG_WARNING, "tkl", "SPAMFILTER_SLOW_WARN", NULL,
"[Spamfilter] WARNING: Slow spamfilter detected (took $msec_time msec to execute): $tkl",
log_data_tkl("tkl", tkl),
log_data_integer("msec_time", ms_past));
}
#endif
if (ret)
{
/* We have a match! */
char buf[1024];
char destinationbuf[48];
if (destination) {
@@ -4779,14 +4704,13 @@ int _match_spamfilter(Client *client, char *str_in, int target, char *cmd, char
if (!winner_tkl && destination && target_is_spamexcept(destination))
return 0; /* No problem! */
ircsnprintf(buf, sizeof(buf), "[Spamfilter] %s!%s@%s matches filter '%s': [%s%s: '%s'] [%s]",
client->name, client->user->username, client->user->realhost,
tkl->ptr.spamfilter->match->str,
cmd, destinationbuf, str,
unreal_decodespace(tkl->ptr.spamfilter->tkl_reason));
unreal_log(ULOG_INFO, "tkl", "SPAMFILTER_MATCH", client,
"[Spamfilter] $client.nuh matches filter '$tkl': [cmd: $command$destination: '$str'] [reason: $tkl.reason] [action: $tkl.ban_action]",
log_data_tkl("tkl", tkl),
log_data_string("command", cmd),
log_data_string("destination", destinationbuf),
log_data_string("str", str));
sendto_snomask_global(SNO_SPAMF, "%s", buf);
ircd_log(LOG_SPAMFILTER, "%s", buf);
RunHook6(HOOKTYPE_LOCAL_SPAMFILTER, client, str, str_in, target, destination, tkl);
/* If we should stop after the first match, we end here... */
+1 -3
View File
@@ -38,8 +38,7 @@ ModuleHeader MOD_HEADER = {
*/
#define TKLDB_SAVE_EVERY_DELTA +15
#ifdef DEBUGMODE
#define BENCHMARK
// #undef BENCHMARK
/* Benchmark results (2GHz Xeon Skylake, compiled with -O2, Linux):
* 100,000 zlines:
* - load db: 510 ms
@@ -48,7 +47,6 @@ ModuleHeader MOD_HEADER = {
* which executes every 5 minutes.
* Of course, exact figures will depend on the machine.
*/
#endif
#define FreeTKLRead() \
do { \
+1 -2
View File
@@ -81,8 +81,7 @@ void ssl_info_callback(const SSL *ssl, int where, int ret)
e->n++;
if (e->n >= HANDSHAKE_LIMIT_COUNT)
{
ircd_log(LOG_ERROR, "TLS Handshake flood detected from %s -- killed", get_client_name(client, TRUE));
sendto_realops("TLS Handshake flood detected from %s -- killed", get_client_name(client, TRUE));
unreal_log(LOG_INFO, "flood", "TLS_HANDSHAKE_FLOOD", client, "TLS Handshake flood detected from $client -- killed");
dead_socket(client, "TLS Handshake flood detected");
}
}
+14 -14
View File
@@ -57,12 +57,12 @@ void topicoverride(Client *client, Channel *channel, char *topic)
sendto_snomask(SNO_EYES,
"*** OperOverride -- %s (%s@%s) TOPIC %s \'%s\'",
client->name, client->user->username, client->user->realhost,
channel->chname, topic);
channel->name, topic);
/* Logging implementation added by XeRXeS */
ircd_log(LOG_OVERRIDE, "OVERRIDE: %s (%s@%s) TOPIC %s \'%s\'",
client->name, client->user->username, client->user->realhost,
channel->chname, topic);
channel->name, topic);
}
/** Query or change the channel topic.
@@ -97,7 +97,7 @@ CMD_FUNC(cmd_topic)
name = parv[1];
channel = find_channel(parv[1], NULL);
channel = find_channel(parv[1]);
if (!channel)
{
sendnumeric(client, ERR_NOSUCHCHANNEL, name);
@@ -149,12 +149,12 @@ CMD_FUNC(cmd_topic)
}
if (!channel->topic)
sendnumeric(client, RPL_NOTOPIC, channel->chname);
sendnumeric(client, RPL_NOTOPIC, channel->name);
else
{
sendnumeric(client, RPL_TOPIC,
channel->chname, channel->topic);
sendnumeric(client, RPL_TOPICWHOTIME, channel->chname,
channel->name, channel->topic);
sendnumeric(client, RPL_TOPICWHOTIME, channel->name,
channel->topic_nick, channel->topic_time);
}
return;
@@ -175,11 +175,11 @@ CMD_FUNC(cmd_topic)
new_message(client, recv_mtags, &mtags);
RunHook4(HOOKTYPE_TOPIC, client, channel, mtags, topic);
sendto_server(client, 0, 0, mtags, ":%s TOPIC %s %s %lld :%s",
client->id, channel->chname, channel->topic_nick,
client->id, channel->name, channel->topic_nick,
(long long)channel->topic_time, channel->topic);
sendto_channel(channel, client, NULL, 0, 0, SEND_LOCAL, mtags,
":%s TOPIC %s :%s",
client->name, channel->chname, channel->topic);
client->name, channel->name, channel->topic);
free_message_tags(mtags);
}
return;
@@ -196,7 +196,7 @@ CMD_FUNC(cmd_topic)
{
if (MyUser(client) && !ValidatePermissionsForPath("channel:override:topic", client, NULL, channel, NULL))
{
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->chname);
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->name);
return;
}
topicoverride(client, channel, topic);
@@ -211,7 +211,7 @@ CMD_FUNC(cmd_topic)
if (MyUser(client) && !ValidatePermissionsForPath("channel:override:topic", client, NULL, channel, NULL))
{
ircsnprintf(buf, sizeof(buf), "You cannot change the topic on %s while being banned", channel->chname);
ircsnprintf(buf, sizeof(buf), "You cannot change the topic on %s while being banned", channel->name);
sendnumeric(client, ERR_CANNOTDOCOMMAND, "TOPIC", buf);
return;
}
@@ -230,7 +230,7 @@ CMD_FUNC(cmd_topic)
topicoverride(client, channel, topic);
} else {
/* With +m and -t, only voice and higher may change the topic */
ircsnprintf(buf, sizeof(buf), "Voice (+v) or higher is required in order to change the topic on %s (channel is +m)", channel->chname);
ircsnprintf(buf, sizeof(buf), "Voice (+v) or higher is required in order to change the topic on %s (channel is +m)", channel->name);
sendnumeric(client, ERR_CANNOTDOCOMMAND, "TOPIC", buf);
return;
}
@@ -242,7 +242,7 @@ CMD_FUNC(cmd_topic)
Hook *tmphook;
int n;
if (match_spamfilter(client, topic, SPAMF_TOPIC, "TOPIC", channel->chname, 0, NULL))
if (match_spamfilter(client, topic, SPAMF_TOPIC, "TOPIC", channel->name, 0, NULL))
return;
for (tmphook = Hooks[HOOKTYPE_PRE_LOCAL_TOPIC]; tmphook; tmphook = tmphook->next) {
@@ -272,10 +272,10 @@ CMD_FUNC(cmd_topic)
new_message(client, recv_mtags, &mtags);
RunHook4(HOOKTYPE_TOPIC, client, channel, mtags, topic);
sendto_server(client, 0, 0, mtags, ":%s TOPIC %s %s %lld :%s",
client->id, channel->chname, channel->topic_nick,
client->id, channel->name, channel->topic_nick,
(long long)channel->topic_time, channel->topic);
sendto_channel(channel, client, NULL, 0, 0, SEND_LOCAL, mtags,
":%s TOPIC %s :%s",
client->name, channel->chname, channel->topic);
client->name, channel->name, channel->topic);
free_message_tags(mtags);
}
+1 -1
View File
@@ -91,7 +91,7 @@ int nokick_can_kick(Client *client, Client *target, Channel *channel, char *comm
sendnotice(target,
"*** umode q: %s tried to kick you from channel %s (%s)",
client->name, channel->chname, comment);
client->name, channel->name, comment);
return EX_ALWAYS_DENY;
}
+5 -5
View File
@@ -155,7 +155,7 @@ CMD_FUNC(cmd_who)
return;
}
if ((target_channel = find_channel(mask, NULL)) != NULL)
if ((target_channel = find_channel(mask)) != NULL)
{
do_channel_who(client, target_channel, mask);
sendnumeric(client, RPL_ENDOFWHO, mask);
@@ -163,7 +163,7 @@ CMD_FUNC(cmd_who)
}
if (wfl.channel && wfl.want_channel == WHO_WANT &&
(target_channel = find_channel(wfl.channel, NULL)) != NULL)
(target_channel = find_channel(wfl.channel)) != NULL)
{
do_channel_who(client, target_channel, mask);
sendnumeric(client, RPL_ENDOFWHO, mask);
@@ -418,7 +418,7 @@ static int can_see(Client *requester, Client *target, Channel *channel)
/* if they only want people on a certain channel. */
if (wfl.want_channel != WHO_DONTCARE)
{
Channel *chan = find_channel(wfl.channel, NULL);
Channel *chan = find_channel(wfl.channel);
if (!chan && wfl.want_channel == WHO_WANT)
return WHO_CANTSEE;
if ((wfl.want_channel == WHO_WANT) && !IsMember(target, chan))
@@ -602,7 +602,7 @@ static void do_channel_who(Client *client, Channel *channel, char *mask)
continue;
make_who_status(client, acptr, channel, cm, status, cansee);
send_who_reply(client, acptr, channel->chname, status, "");
send_who_reply(client, acptr, channel->name, status, "");
}
}
@@ -857,7 +857,7 @@ static char *first_visible_channel(Client *client, Client *acptr, int *flg)
*flg |= FVC_HIDDEN;
if (showchannel)
return channel->chname;
return channel->name;
}
/* no channels that they can see */
+3 -3
View File
@@ -196,7 +196,7 @@ CMD_FUNC(cmd_whois)
if (showchannel)
{
long access;
if (len + strlen(channel->chname) > (size_t)BUFSIZE - 4 - mlen)
if (len + strlen(channel->name) > (size_t)BUFSIZE - 4 - mlen)
{
sendto_one(client, NULL,
":%s %d %s %s :%s",
@@ -258,8 +258,8 @@ CMD_FUNC(cmd_whois)
}
if (len)
*(buf + len) = '\0';
strcpy(buf + len, channel->chname);
len += strlen(channel->chname);
strcpy(buf + len, channel->name);
len += strlen(channel->name);
strcat(buf + len, " ");
len++;
}
+3 -3
View File
@@ -342,7 +342,7 @@ CMD_FUNC(cmd_whox)
Channel *channel = NULL;
/* List all users on a given channel */
if ((channel = find_channel(orig_mask, NULL)) != NULL)
if ((channel = find_channel(orig_mask)) != NULL)
{
if (IsMember(client, channel) || operspy)
do_who_on_channel(client, channel, 1, operspy, &fmt);
@@ -761,7 +761,7 @@ static void do_who(Client *client, Client *acptr, Channel *channel, struct who_f
else
host = GetHost(acptr);
sendnumeric(client, RPL_WHOREPLY,
channel ? channel->chname : "*",
channel ? channel->name : "*",
acptr->user->username, host,
hide ? "*" : acptr->user->server,
acptr->name, status, hide ? 0 : acptr->hopcount, acptr->info);
@@ -773,7 +773,7 @@ static void do_who(Client *client, Client *acptr, Channel *channel, struct who_f
if (HasField(fmt, FIELD_QUERYTYPE))
append_format(str, sizeof str, &pos, " %s", fmt->querytype);
if (HasField(fmt, FIELD_CHANNEL))
append_format(str, sizeof str, &pos, " %s", channel ? channel->chname : "*");
append_format(str, sizeof str, &pos, " %s", channel ? channel->name : "*");
if (HasField(fmt, FIELD_USER))
append_format(str, sizeof str, &pos, " %s", acptr->user->username);
if (HasField(fmt, FIELD_IP))