Commit graph

240 commits

Author SHA1 Message Date
William Pitcock
6f7b36d5d0 Mostly enable support for checking format strings with -Wformat.
Basically derived from Ratbox 3.1.
2013-02-21 05:46:04 -06:00
Jilles Tjoelker
e0c7937a9f UID/EUID: Add server's SID to invalid UID error message. 2013-02-03 20:31:52 +01:00
Jilles Tjoelker
561d7efc44 UID/EUID: Check that the UID starts with the server's SID.
If not, the local link that sent the command is broken, as with
syntactically invalid UIDs.
2013-02-03 19:38:46 +01:00
Jilles Tjoelker
fce4df5473 server: Show the missing CAPABs when rejecting a server. 2013-01-02 21:00:18 +01:00
Jilles Tjoelker
22b24f637d server: Move required CAPAB check after authentication and add snote and log. 2013-01-02 20:07:28 +01:00
Jilles Tjoelker
71eb2bb99b server: Fix required capabilities check if there is more than one capability. 2012-12-18 16:37:21 +01:00
Keith Buck
62cf5b4036 Call the privmsg_channel hook for part messages too. 2012-04-07 03:03:07 +00:00
Keith Buck
880db619be m_message: Remove some unused variables. 2012-04-03 21:51:09 +00:00
William Pitcock
b8c16fdaba if 0 some things out 2012-04-01 00:09:18 -05:00
William Pitcock
f30a5ee4c4 Remove MODE_NOCTCP from core, in favor of chm_noctcp. 2012-03-31 22:48:36 -05:00
William Pitcock
67aeaba593 Remove MODE_NOCOLOR from core, replacing it with modules/chm_nocolour.so. 2012-03-31 22:26:45 -05:00
William Pitcock
6eb033605c Check for empty string after permutation hooks have run. 2012-03-31 22:18:15 -05:00
William Pitcock
ca4c2a86ee Add support for hookifying PRIVMSG/NOTICE.
This will allow us to modularize message processing, e.g. having new modules to manipulate
channel and private messages in new ways.

Yes: it can be used to intercept messages, but such modules are already out in the wild for
charybdis anyway -- so this doesn't really change anything there.

If you are changing the text, then it is your responsibility to provide a pointer to a new
buffer.  This buffer should be statically allocated and stored in your module's BSS segment.
We will not, and cannot, free your buffer in core, so dynamically allocated buffers will
cause a memory leak.

This will allow us to simplify m_message considerably, by moving channel mode logic out to
their own modules.
2012-03-31 21:23:01 -05:00
Keith Buck
2d537cae88 Remove unused variable cruft. 2012-03-25 02:37:41 +00:00
Jilles Tjoelker
494d2b9dd4 Apply special CTCP handling to messages to @/+ channel as well:
* +C cmode blocks CTCPs
 * CTCPs to large channels relax some flood protection to allow all
   answers through.
2012-03-14 23:20:05 +01:00
Jilles Tjoelker
60dd1febe2 Apply colour stripping (cmode +c) to messages to @/+ channel as well. 2012-03-14 23:04:30 +01:00
Jilles Tjoelker
d1316b193b Keep forward channels in sync after a netjoin.
Arbitrarily prefer a forward channel to no forward channel and an
alphabetically higher forward channel to a lower one.

This is a simplistic implementation that generates one MODE message to
local clients for each ban removed (to be replaced).

For simplicity and to avoid amplification of incoming MODE messages,
regular modes may still desync the forward channel of a ban.
2012-03-03 23:45:52 +01:00
Keith Buck
7e132ff005 ratelimit: Add rate-limiting to MOTD, WHO, and remote WHOIS. 2012-02-18 03:56:47 +00:00
Jilles Tjoelker
c25a890796 Remove some TS5 code from ms_bmask().
ms_bmask() used to send MODE messages to TS5 servers, but
TS5 support was removed long ago.
2012-02-17 00:36:12 +01:00
Jilles Tjoelker
23f6b63af6 Send forward channel when bans are added/removed because of TS/bursts.
If a netburst adds bans or a channel TS change removes bans, +b/-b modes
are generated. Make sure these contain the forward channel, if any.

This appears also broken in ircd-seven.
2012-02-17 00:09:39 +01:00
William Pitcock
806402515b m_server: make sure required_caps is non-zero. 2012-02-04 04:39:39 -06:00
William Pitcock
79d488b283 m_server: reenable required cap negotiation 2012-02-04 02:03:52 -06:00
William Pitcock
346fba9252 Migrate capability negotiation code to new dynamic capability management API.
This needs a lot of testing, obviously.
2012-02-04 01:47:46 -06:00
Jilles Tjoelker
97532cfafb Fix assertion failure when failing to join a channel and there is no forward.
This was harmless apart from the message.
2012-01-08 16:41:26 +01:00
Jilles Tjoelker
d9af501aa8 Fix a warning about const with forward channels. 2012-01-08 16:23:18 +01:00
William Pitcock
b583faf970 Add support for customizing the usable nick length.
This adds a new ISUPPORT token, NICKLEN_USABLE which is strictly an informative value.
NICKLEN is always the maximum runtime NICKLEN supported by the IRCd, as other servers may
have their own usable NICKLEN settings.  As NICKLEN_USABLE is strictly informative, and
NICKLEN is always the maximum possible NICKLEN, any clients which depend on NICKLEN for
memory preallocation will be unaffected by runtime changes to NICKLEN_USABLE.

The default NICKLEN is 50; the default serverinfo::nicklen in the config file is set to
30, which is the NICKLEN presently used on StaticBox.
2011-11-29 16:10:21 -06:00
Jilles Tjoelker
0cce01d388 Fix -Wformat errors found in ircd-ratbox.
We cannot use -Wformat meaningfully but ircd-ratbox trunk can.
2011-11-13 00:22:09 +01:00
Jilles Tjoelker
6a85e665db If use_forward=no, ignore any forwarding for joins by local users. 2011-09-25 17:26:01 +02:00
Jilles Tjoelker
2da6f6ebd7 Put back use_forward. 2011-09-25 16:22:29 +02:00
Elizabeth Jennifer Myers
765d839d3c Port ircd-seven banfowards to charybdis.
nenolod gave the thumbs-up to port ircd-seven banfowards to charybdis to spb
for a while, and people have asked about it. Might as well do it since it's a
slow weekend.

Note that as a side effect use_forward is removed from the config and
unconditionally enabled!
2011-08-12 20:33:10 -04:00
Elizabeth Jennifer Myers
7eec45bc9d Back out chanroles.
While what chanroles are trying to accomplish is a good idea, it is
apparently unclear this is the proper way to do it. Until we figure out
the exact way we wish to do this, it should be reverted for now.
2011-07-07 21:24:14 -04:00
Elizabeth Jennifer Myers
8aabb973c0 Implement chanroles, as discussed with nenolod.
The theory behind this is that services sends an ENCAP * GRANT #channel
UID :+flagspec message specifying the chanroles the user has. They are
mapped into flag bits and applied to the membership of the user. They
then are restricted or permitted to what they can do based on the
permissions mask regardless of rank.

For backwards compatibility, the default permission bit (without a GRANT
statement) allows a user to to anything an existing op can do ONLY if
they are an op.

Todo: make CHANROLE_STATUS work (the ability to apply +ov to people),
which is at the moment controlled by CHANROLE_MODE.
2011-07-06 13:46:22 -04:00
Jilles Tjoelker
a1574df4a2 Allow kick_on_split_riding to protect channels with mlocked keys.
Do kick_on_split_riding if services sends an SJOIN
with a lower TS and a different key. This relies on
services restoring TS (changets option in atheme) and
services not immediately parting after receiving the
KICK, which is the case in recent atheme.

For invite-only channels, still only do
kick_on_split_riding in netbursts. Services is
assumed to handle this itself (atheme does).
2011-04-06 19:05:08 +02:00
Stephen Bennett
341f971efa Bring across disable_local_channels config option from ircd-seven 2010-12-21 20:38:04 +00:00
William Pitcock
805cfa5ab2 Use send_channel_join(). 2010-12-16 00:13:42 -06:00
William Pitcock
7a948bdaa7 Add capability parameter to sendto_common_channels_local() and sendto_common_channels_local_butone(). 2010-12-15 22:55:05 -06:00
William Pitcock
cddbab51bb Send ERR_TOOMANYCHANNELS for each channel join that fails due to channel limits.
The reason why we do this is because some clients are dependent on receiving a numeric
for every channel join failure, even due to this limit where it can be assumed that
subsequent joins failed.
2010-12-14 02:24:23 -06:00
William Pitcock
ff0cc1e616 Add support for linking using SSL certificate fingerprints as the link credential rather than the traditional server-password pair. 2010-12-13 23:14:00 -06:00
B.Greenham
15484f02bd Move flood_attack_channel to channel.c so it can be used outside m_message.c 2010-12-09 18:29:56 -05:00
William Pitcock
0343b3c563 Use get_channel_access() for KICK/TOPIC. 2010-12-07 00:14:42 -06:00
William Pitcock
6ca4dec95a Extend hook_data_channel_activity moduledata with membership struct. 2010-12-06 22:57:04 -06:00
William Pitcock
1f679bfe7b Filter bogus CTCP ACTION messages. 2010-11-05 01:16:03 -05:00
Jilles Tjoelker
02e655aeac Provide an error message when a user does /quote ban. 2010-08-29 15:16:47 +02:00
Jilles Tjoelker
717238d2a2 Add target change for channels.
This has a separate enabling option channel::channel_target_change.

It applies to PRIVMSG, NOTICE and TOPIC by unvoiced unopped non-opers.

The same slots are used for channels and users.
2010-08-29 01:26:00 +02:00
Jilles Tjoelker
dd9b78dc92 Remove redundant MyClient check, it is already checked above. 2010-08-24 22:46:57 +02:00
William Pitcock
6fb6bd15ae Enforce TS rules on MLOCKs. 2010-08-23 20:22:59 -05:00
Jilles Tjoelker
f5455d2cd5 Tweak auto-accept:
* does not apply to NOTICE (as those may well be automated)
* mirrors +g behaviour so that no useless accept entries are added for services
* respects max_accept, if it would be exceeded the message is dropped with numeric 494
* check moved up so this is checked before floodcount/tgchange
2010-07-04 17:14:56 +02:00
William Pitcock
0770c9936e Stop griefing through taunting while hiding behind CALLERID.
This shouldn't provide any way for a client to get on a CALLERID list
without authorization, as if a client is +g already, a CTCP request, for
example, won't be replied to.
2010-07-03 00:44:55 -05:00
Stephen Bennett
6b8db2daf2 Allow the final parameter of MLOCK to be empty, to remove an existing mlock 2010-05-02 20:42:46 +01:00
Stephen Bennett
1916ed52f8 Branch merge 2010-04-30 22:03:42 +01:00
Stephen Bennett
78e6b731e4 Rework ircd-side MLOCK enforcement: instead of trying to track modes locked on or off, instead keep a simple list of mode letters that are locked, and reject any change to those modes. 2010-04-30 22:01:21 +01:00
Jilles Tjoelker
a0ce140ed6 Improve technical documentation of BAN protocol. 2010-04-29 00:26:49 +02:00
Jilles Tjoelker
803ce385bf Fix various compiler warnings. 2010-03-27 20:09:46 +01:00
Jilles Tjoelker
dca9e55257 Add propagated resvs, like klines and xlines. 2010-03-27 16:13:57 +01:00
Jilles Tjoelker
f89191ace9 BAN: xlines do not have oper reasons, their "reason" is already oper only. 2010-03-18 00:22:35 +01:00
Jilles Tjoelker
3cbbfb2556 Add propagated xlines, like klines. 2010-03-16 23:05:50 +01:00
William Pitcock
8727cbe88a Add propagation of MLOCK state for simple modes.
Special modes like +j can be tracked easily just by adding the necessary
code to parse them to set_channel_mlock().  This will cover propagation
as well.
2010-03-07 23:13:39 -06:00
Jilles Tjoelker
5c2b9eaf48 BAN: Reject bans with insufficient non-wildcard characters.
Such bans are not applied locally, but are propagated normally.
They can only be removed on a server that applies them.

Note that normally KLINE will not accept such bans.
This is mainly for services, differing min_wildcard and
ircd changes.
2010-03-06 01:45:41 +01:00
Jilles Tjoelker
6229f9f83b Among bans with the same creation time, prefer the one with longest lifetime. 2010-03-05 23:16:28 +01:00
Jilles Tjoelker
9470d75a42 BAN: Avoid fake direction. 2010-03-05 22:53:35 +01:00
Jilles Tjoelker
cedb7d05b4 Remove +/- from the BAN message, instead indicating unban with duration=0.
A kline must now last at least one second since its creation time.

Also add better logic for bans that have already expired
when they come in.
2010-03-05 22:51:47 +01:00
Jilles Tjoelker
431a1a2784 Add propagated klines.
A KLINE command without the ON clause now sets a propagated
("global") ban. KLINE commands with the ON clause work as
before.

Propagated klines can only be removed with an UNKLINE command
without the ON clause, and this removes them everywhere.
In fact, they remain in a deactivated state until the latest
expiry ever used for the mask has passed.

Propagated klines are part of the netburst using a new BAN
message and capab. If such a burst has an effect, both the
server name and the original oper are shown in the server
notice.

No checks whatsoever are done on bursted klines at this time.

The system should be extended to XLINE and RESV later.

There is currently no way to list propagated klines,
but TESTLINE works normally.
2010-03-05 18:36:44 +01:00
Jilles Tjoelker
ff91faaf76 Do not penalize for spambot checks if creating a new channel. 2010-02-21 01:45:51 +01:00
Jilles Tjoelker
4eb9a3ca0b JOIN 0: Make spambot check equivalent to PART's. 2010-02-21 01:12:04 +01:00
Jilles Tjoelker
9148f6aa7c Remove dead code: last_join_time is already updated by check_spambot_warning(). 2010-02-21 01:10:04 +01:00
Jilles Tjoelker
cf3564d61f Do not check for spambot if the user is not allowed to join the channel. 2010-02-21 01:07:32 +01:00
Jilles Tjoelker
4f2685f3e1 Move target change code to src/tgchange.c,
so we can use it for /invite as well.
2010-02-15 21:58:34 +01:00
Jilles Tjoelker
c9f01c4f2f target change: Allow free replies.
When a user receives a private message, notice or RPL_UMODEGMSG,
add the source to a special set of 5 target slots.
These slots are checked in the normal way when sending messages,
allowing a reply without using up a free target.

This feature will not be very useful if a user is being messaged
by many different users; to help this, messages blocked entirely
by +g or +R do not affect the targets. CTCP replies also remain
free in terms of targets.
2010-02-15 01:07:07 +01:00
Jilles Tjoelker
179becdf5f target change: Overwrite the least recently used target with a new one. 2010-02-15 00:31:17 +01:00
Jilles Tjoelker
ad1d39a76f Make the number of targets tracked for target change a #define. 2010-02-13 15:18:17 +01:00
Jilles Tjoelker
1fd171a547 Fix op-moderate (cmode +z) for channel names with '@'. 2010-01-24 19:37:00 +01:00
Jilles Tjoelker
641eb2c3c8 Put back fb7d6089158e, not setting large_ctcp_sent for CTCP ACTION. 2010-01-20 00:03:57 +01:00
William Pitcock
2e918bf515 Merge +C (no CTCP to channels) from ircd-seven. 2010-01-19 02:11:04 -06:00
Jilles Tjoelker
3d0bbdcbe1 Do not set large_ctcp_sent for CTCP ACTION as it does not request a reply. 2010-01-14 01:12:16 +01:00
Stephen Bennett
c127b45b83 Revert all presence-related changes 2009-12-08 19:22:55 +00:00
William Pitcock
884b5d41c1 presence: Remove user.away, replaced by a metadata entry.
Cache the metadata retrieval value where feasible for minimal performance impact.
2009-06-02 02:03:51 -05:00
Jilles Tjoelker
aa9c9ed268 Allow ctcp replies through floodcount after ctcp'ing a large group.
A large group is any $$ or $# or a channel with more than
floodcount/2 local members, checked on each server separately.
Note that floodcount checks are done on the sender's server.

The special treatment is active for 15 seconds.
2009-05-17 20:52:16 +02:00
Jilles Tjoelker
a416ed2e79 Move check for required CAPABs to mr_server -- CAPAB may not be sent.
Also fix exit message.
2009-04-21 18:43:07 +02:00
William Pitcock
5f8d323c59 can_kick hook, based on the ircd-seven one. 2009-04-20 09:20:11 -05:00
Jilles Tjoelker
b7b1d686a9 Simplify floodcount checking, it is no longer affected by +g/+R anymore. 2009-04-19 00:04:21 +02:00
Jilles Tjoelker
631b4a542a Use uid/sid for some ERR_CHANOPRIVSNEEDED if they go to a remote client. 2009-04-09 23:45:35 +02:00
Jilles Tjoelker
c4d2d01419 Apply +z to messages blocked by +b and +q as well.
This adds a new server capab EOPMOD which will be used
for an extended topic command also.
2009-03-29 15:48:07 +02:00
Jilles Tjoelker
f93bc39774 Remove some unused variables.
Found with llvm static analyzer.
2009-03-01 01:53:40 +01:00
Jilles Tjoelker
6865c0b099 Add channel::only_ascii_channels config option
to restrict channel names to printable ascii only.
Like disable_fake_channels this only applies to joins
by local users; unlike disable_fake_channels it applies
to opers as well.
2009-02-22 00:12:21 +01:00
Jilles Tjoelker
161f040940 Update comments for parv[0] removal. 2009-01-18 18:22:43 +01:00
Jilles Tjoelker
3dfaa67120 Replace parv[0] with source_p->name. 2009-01-17 01:18:19 +01:00
Jilles Tjoelker
0a849a8fa9 Do not log ERROR messages from unknowns.
from ircd-ratbox (androsyn)
2009-01-17 00:23:02 +01:00
Jilles Tjoelker
463947ad90 Remove more TS5 remnants. 2009-01-16 23:18:10 +01:00
Jilles Tjoelker
4dd5d304eb Log to serverlog when throwing out a server because of a bad nickname. 2009-01-16 23:10:49 +01:00
Jilles Tjoelker
6c77f1f74f Close the local link that sends a TS5 NICK introduction.
This is no longer supported and was already broken,
sending out a UID message without UID parameter to
other servers.
2009-01-16 23:08:05 +01:00
Jilles Tjoelker
5cb843c6a5 Remove obsolete comment. 2009-01-07 23:35:24 +01:00
Jilles Tjoelker
6ccac783ae Allow coloured part reasons in -c channels. 2008-11-29 22:22:18 +01:00
Jilles Tjoelker
8feca1768e Allow +z messages from outside if -n.
This gives a useful meaning to the cmode combo +mz-n:
messages from ops and voices go to all channel members,
messages from anyone else (on or off channel) go to ops.
With +mnz, messages from outside are not allowed at all.
2008-11-15 22:56:09 +01:00
Jilles Tjoelker
3583564678 Make comment for ms_join() up to date. 2008-11-09 00:05:15 +01:00
Jilles Tjoelker
7b054ca30a Do not send snotes/logs about juped servers trying to connect.
A juped server is defined as a server that already
exists with a service{} server as uplink.
If a juped server is introduced by another server,
this generates snotes/logs as before.
2008-09-25 00:00:36 +02:00
Jilles Tjoelker
7bf78de058 Make TS deops appear to come from the same server the other modes come from.
In particular, this makes atheme changets deops come
from the services server instead of the user's server.
2008-09-24 23:13:10 +02:00
Jilles Tjoelker
56023eb2e8 Add more detail in squit reason for certain invalid NICK/UID/EUID commands. 2008-09-16 22:53:44 +02:00
Jilles Tjoelker
4a5655b20d Close the link that sends an invalid UID.
It does not make sense to send a kill using an invlid
identifier to an obviously broken server, as was
previously done.
2008-09-06 15:13:28 +02:00
Jilles Tjoelker
8c29ec4eeb Remove check that cannot happen due to minparc in Message struct. 2008-09-06 01:33:18 +02:00
Jilles Tjoelker
8f7ca682ec Improve server notices for hub_mask/leaf_mask.
Local-only server notices kept here because
hub_mask/leaf_mask tends to be specific to a (hub)
server. The same information is now available in
Netsplit notices.
2008-09-06 01:21:16 +02:00