Commit graph

967 commits

Author SHA1 Message Date
Ed Kellett d4f7eb4ce6
Replace most checks for +o with oper:general
I'm preparing to PR a succession of privs changes with the ultimate goal
of severely limiting the scope of the binary oper/user dichotomy and
move conceptually distinct oper functions into their own privs.

Accomplishing this is a non-trivial task, and can wait, but it's
inconvenient now to have such functions enabled by the same mechanism
that grants any privs at all--so I'm moving all of them to a
transitional priv with the intention of eroding that later.
2020-08-04 22:58:30 +01:00
Ed Kellett 24652f2b95
m_stats: Make /stats l respect oper hiding
found by @jesopo
2020-08-03 01:23:54 +01:00
Aaron Jones ad7ecd5cbb
Merge pull request #352 from edk0/grant-oper-data
m_grant: zero-initialize struct oper_conf
2020-07-27 17:13:33 +00:00
Ed Kellett cf0aa42180
m_dline: make apply_undline permissive
Trying to find invalid bans won't do anything unless they already exist,
in which case it's legitimate to try to remove them.
2020-07-26 22:50:42 +01:00
Ed Kellett 72464c6abd
m_dline: Make error notices more verbose 2020-07-26 22:50:42 +01:00
Ed Kellett bf493a3410
m_dline: Abort early if host isn't an IP address 2020-07-26 22:03:20 +01:00
Ed Kellett 7d9e8e9d77
Add error handling to parse_netmask() 2020-07-26 22:03:06 +01:00
Ed Kellett bd8b9a37be
m_privs: don't leave a damaged privset behind 2020-07-25 23:49:52 +01:00
Ed Kellett 687ec8f766
m_grant: zero-initialize struct oper_conf
bug noticed by @xnrand
2020-07-16 17:59:27 +01:00
Simon Arlott 373ba193b8
Merge pull request #351 from ophion-project/upstream/sasl
sasl: use mapi_cap_list_v2 correctly
2020-07-12 10:28:02 +01:00
Unit 193 7372db99f2
Fix a couple typos.
automaticlly → automatically
completly → completely
permissable → permissible
redunant → redundant
threshhold → threshold
2020-07-11 04:51:22 +00:00
Ariadne Conill 8ad8fd34f5 callerid: fix a missed instance of hardcoded +g 2020-07-10 21:25:25 -06:00
Ariadne Conill c6e584dd1b callerid: fix invite case 2020-07-10 18:43:31 -06:00
Ariadne Conill ace0c8655b callerid: align soft caller-id behavior with ircd-hybrid implementation 2020-07-10 18:18:28 -06:00
Ariadne Conill 3792c63dc0 sasl: use mapi_cap_list_v2 correctly 2020-07-09 17:47:28 -06:00
Ariadne Conill 92f5320e1d message: run privmsg_user hook on both source and target 2020-07-09 16:06:56 -06:00
Ariadne Conill 4abf8eb2e6 callerid: actually the guard should be for source_p 2020-07-09 16:06:33 -06:00
Ariadne Conill 4841ad6197 callerid: only check the target's accept list on their own local server 2020-07-09 16:06:33 -06:00
Ariadne Conill 3ed61fba8c callerid: use public isupport_umode 2020-07-09 16:06:33 -06:00
Ariadne Conill 5d4cce6cc0 callerid: has_common_channels(): fix return value 2020-07-09 16:06:33 -06:00
Ariadne Conill 4d07382c2d callerid: fix module description 2020-07-09 16:06:33 -06:00
Ariadne Conill 915bb5614b callerid: unregister usermode +g if usermode +G cannot be allocated 2020-07-09 16:06:33 -06:00
Ariadne Conill c6edf65411 callerid: use hdata.error where available 2020-07-09 16:06:33 -06:00
Ariadne Conill fdff78f891 callerid: catch find_umode_slot() failures 2020-07-09 16:06:33 -06:00
Ariadne Conill db80763427 callerid: use invite instead of can_invite hook 2020-07-09 16:06:33 -06:00
Ariadne Conill 7b60cca0f1 callerid: implement relaxed caller id mode (+G) 2020-07-09 16:06:33 -06:00
Ariadne Conill 7106e36ed3 callerid: fix up isupport 2020-07-09 16:06:33 -06:00
Ariadne Conill 6558648dc3 callerid: don't clobber other modules 2020-07-09 16:06:33 -06:00
Ariadne Conill 921b508b1b add callerid module 2020-07-09 16:06:33 -06:00
Ariadne Conill 4a9cf86981 message: remove hardcoded +G logic 2020-07-09 16:06:33 -06:00
Ariadne Conill 98ac35197b invite: remove hardcoded callerid logic 2020-07-09 16:06:33 -06:00
Simon Arlott ac09f70838
Merge remote-tracking branch 'ophion/upstream/dnsbl-rename' 2020-07-09 20:53:38 +01:00
Aaron Jones 860d2381cf
Merge pull request #345 from edk0/alias
m_alias: Preserve protocol framing characters
2020-07-07 09:16:38 +00:00
Aaron Jones e241d7979c
Merge pull request #346 from edk0/opmod-as-statusmsg
Port opmod_send_cprivmsg from ircd-seven, sans naming mistake
2020-07-06 10:52:15 +00:00
Janik Kleinhoff 04e5ed6c57
Make 5614c9e6f0b (opmod as fake statusmsg) optional
This adds a channel { ... } option, opmod_send_statusmsg, disabled by
default for compatibility reasons.
2020-07-06 10:36:35 +01:00
Ariadne Conill 3321eef45a ircd: rename DNSBL entries from blacklist to dnsbl_entry. 2020-07-05 21:20:31 -06:00
Ed Kellett fff4f76353
Add general::tls_ciphers_oper_only 2020-07-05 23:06:51 +01:00
Ed Kellett 4e14f9a413
m_alias: Preserve protocol framing characters 2020-07-05 01:15:03 +01:00
Aaron Jones e2ceb48c3e
Merge pull request #343 from xnrand/patch-ison-unreg-conn
m_ison: Do not report unregistered connections
2020-06-29 17:36:30 +00:00
Aaron Jones b41d97e9ab
m_invite: remove redundant block of code missed by review
I missed this due to refactoring in #341. This function is already
called by the same function we're already in, just further down.

[ci skip]
2020-06-27 14:45:02 +00:00
Ariadne Conill 402b21d47a regonlymsg: use hdata.error where available 2020-06-26 15:36:12 -06:00
xnrand c345d844e6 m_ison: Do not report unregistered connections
Prior to this, m_ison would report a nick as being online if a client
that was not yet registered had chosen this nickname on the same server.
This change adds a check to make sure the struct Client has a
struct User associated with it, i.e. registration has occurred.
2020-06-26 20:36:43 +00:00
Ariadne Conill 2bbfce681f regonlymsg: catch find_umode_slot() failure 2020-06-26 14:32:46 -06:00
Ariadne Conill daaf127d84 regonlymsg: use invite instead of can_invite hook 2020-06-26 14:24:34 -06:00
Ariadne Conill 27590ae0b4 invite: revert the ERR_CHANOPRIVSNEEDED change too 2020-06-26 14:24:26 -06:00
Ariadne Conill e3c27d7dbd Revert "invite: rework the way can_invite hook is called"
This reverts commit ed06fed70a67b0cdd4e53aad575fca7b9d046061.
2020-06-26 14:24:21 -06:00
Ariadne Conill ddb063e2f9 invite: remove redundant parenthesis 2020-06-26 13:58:00 -06:00
Ariadne Conill 4371dcbd55 invite: rework the way can_invite hook is called 2020-06-26 13:57:22 -06:00
Ariadne Conill 4436a7ca73 regonlymsg: allow messages through if target is not a local client 2020-06-26 13:56:05 -06:00
Ariadne Conill 90e99760a0 regonlymsg: do not clobber the work of other modules 2020-06-26 13:05:50 -06:00
Ariadne Conill dc5d1d012a regonlymsg: fix allow_message() return values 2020-06-26 12:03:43 -06:00
Ariadne Conill 968dee680f modularize usermode +R (registered users only) 2020-06-26 11:56:42 -06:00
Ariadne Conill ed3b56f965 message: remove hardcoded +R logic 2020-06-26 11:56:41 -06:00
Ariadne Conill 0b8910e40b invite: remove hardcoded UMODE_REGONLYMSG code 2020-06-26 11:56:40 -06:00
Aaron Jones 01ef07c1c8
Merge pull request #333 from edk0/privs-multiline
m_privs: break long responses into multiple lines
2020-06-26 16:55:56 +00:00
Aaron Jones b804829aa4
Merge pull request #340 from ophion-project/upstream/hook-channel-lowerts
join: add channel_lowerts hook
2020-06-26 16:51:52 +00:00
Ariadne Conill 13a16b28cb join: add channel_lowerts hook 2020-06-26 10:29:29 -06:00
Aaron Jones 6d58b1d38e
Merge pull request #334 from edk0/massnotice
Remove the massnotice wildcard restriction
2020-06-25 17:42:43 +00:00
Aaron Jones 9d65d599c4
Merge pull request #322 from edk0/invite-umode-g
m_invite: Don't punch through +g
2020-06-25 17:37:04 +00:00
Ed Kellett 8e1e48e114
m_kline: insert a safety zero early 2020-06-25 12:43:57 +01:00
Ed Kellett f0e4d607c9
m_invite: Don't punch through +g 2020-06-21 14:08:24 +01:00
Aaron Jones 3ef1213be4
Merge pull request #335 from edk0/post-registration-delay
Import post_registration_delay from ircd-seven
2020-06-21 12:56:56 +00:00
Stephen Bennett b3a0099139
Rename connect_delay to post_registration_delay. This matches the ircd-ratbox feature, and better describes what it actually is. Also make sure to set localClient->firsttime on registration, so that the delay counts from the right time. 2020-06-07 19:22:36 +01:00
Stephen Bennett 2d6562846f
Initial attempt at the conndelay hack 2020-06-07 19:22:36 +01:00
Ed Kellett d819df92b8
Remove the massnotice wildcard restriction 2020-06-07 18:10:51 +01:00
Ed Kellett 7e1a68eaf8
m_privs: break long responses into multiple lines 2020-06-07 00:43:06 +01:00
Ed Kellett 260fc2cc34
Add client_quit hook 2020-05-23 19:10:07 +01:00
Ed Kellett 91ccda4f8c
Fix invite-notify and move it to an extension
The existing approach to invite-notify is deeply flawed--it currently
notifies only the target user's server, and that can't be fixed without
sending notifies for invites that end up not happening.

I'm resolving this by broadcasting a second message, INVITED, from the
target user's server. I'm also pulling it out into an extension while
I'm at it--invite notifies reveal new information, so I don't think
they should be mandatory.
2020-04-30 18:17:00 +01:00
Ed Kellett e0622d7519
m_invite: Add hooks
can_invite is called on the source server, can override channel access
invite is called on the target
2020-04-30 18:16:59 +01:00
Ed Kellett a7d4a0ab81
Centralise banmask matching logic 2020-04-12 12:35:18 +01:00
Ed Kellett 7b6410135b
m_modules: make modreload work like restart
/modrestart used to be implemented as a normal command and could crash
when used remotely because it would reload m_encap, which was on the
call stack at the time. This was fixed in 41390bfe5f. However,
/modreload has exactly the same problem, so I'm giving it the
same treatment.

Incidentally: This bug was first discovered in ircd-seven, where the
`/mod*` commands themselves live in the core, so m_encap was the only way
the crash could happen (and it didn't most of the time, because m_encap
would only be moved if you got unlucky). But `/mod*` are in modules in
charybdis, so /modrestart would have unloaded the code it was in the
middle of executing. With that in mind, I'm not sure how it ever
appeared to work.
2019-11-17 18:01:51 +00:00
Ed Kellett 20276d4011
m_motd: don't ratelimit with no server argument 2019-09-15 20:05:51 +01:00
Ed Kellett e902e16974
m_stats: don't ratelimit with no server argument 2019-09-15 20:05:51 +01:00
Ed Kellett b143f5e3bd
m_grant: match "deoper" case-insensitively 2019-09-15 00:35:55 +01:00
Ed Kellett ebd0f4db7a
m_grant: remove a confusing line 2019-09-15 00:35:55 +01:00
Ed Kellett 7f373431d0
m_grant: use AV2 2019-09-15 00:35:55 +01:00
Ed Kellett 910f883959
m_grant: propagate privset changes 2019-09-15 00:35:55 +01:00
Ed Kellett bdc87b5f37
m_grant: maintain privilegeset refcounts 2019-09-15 00:35:55 +01:00
Ed Kellett 6119faa9a0
charybdise m_grant 2019-09-15 00:35:55 +01:00
Ed Kellett c1649fd04d
Use the m_grant from ircd-seven
Charybdis' rewritten m_grant introduces at least one serious bug without
providing any apparent benefit. I think the best solution here is the
easiest one.

The bug in question is that an empty mode change is triggered after
seven's grant has done its work, and this is necessary in order to
give umodes granted by oper privileges a chance to update. The rewrite
removes this, generating a mode change only if it wants to change the
state of +o, which means the grant victim can keep privileged modes they
no longer have access to, or fail to gain new ones.
2019-09-15 00:35:55 +01:00
Ed Kellett ed3ca2ff16
Propagate OPER
Move opername and privset storage to struct User, so it can exist for
remote opers.

On /oper and when bursting opers, send:

    :foo OPER opername privset

which sets foo's opername and privset. The contents of the privset on
remote servers come from the remote server's config, so the potential
for confusion exists if these do not match.

If an oper's privset does not exist on a server that sees it, it will
complain, but create a placeholder privset. If the privset is created by
a rehash, this will be reflected properly.

/privs is udpated to take an optional argument, the server to query, and
is now local by default:

    /privs [[nick_or_server] nick]
2019-09-13 10:08:27 +01:00
Ed Kellett 1123eefcb0
Rework oper hiding
As it stands, oper hiding is rather messy and inconsistent. Add
SeesOper(target, source), which is true iff target should appear as an
oper to source. If I haven't missed something, all commands that reveal
oper status now use the same logic.

general::hide_opers_in_whois is a special case, and affects /whois only.

general::hide_opers is introduced, and has the same effect as giving
everyone oper:hidden. All commands that reveal oper status respect both.
2019-09-12 23:14:15 +01:00
Ed Kellett 28cc8bb924
Deferred capability notifications from modules
Reloading modules sends CAP DEL followed by an immediate CAP NEW:

    :staberinde.local CAP * DEL :account-tag
    :staberinde.local CAP * NEW :account-tag

This isn't very nice. /modrestart is particularly bad. In order to avoid
doing this, we remember the capability set at the beginning of module
operations, compare that with the set afterwards, and report only the
differences with CAP {DEL,NEW}.
2019-09-07 14:59:33 +01:00
Simon Arlott eeeb228664
cap_server_time: Fix strftime return value check 2019-08-31 16:35:19 +01:00
Ed Kellett 6ca9ff0ea1
Remove unused kline_delay config option 2019-04-27 14:53:04 +01:00
Ed Kellett 43037e1af3
m_ban: check only the added K-line 2019-04-27 14:51:17 +01:00
Ed Kellett b068a4b518
m_kline: check only the added K-line 2019-04-27 14:47:33 +01:00
Simon Arlott 40a766a0a0
m_sasl: Don't process authentication messages if SASL has been aborted, but track failures 2019-02-23 13:02:15 +00:00
Simon Arlott d5d52a994d
m_nick/m_sasl/m_user: restore check for mixing of client and server protocol 2018-08-15 22:48:21 +01:00
Simon Arlott d4b2529a61
m_pass: store unverified SID in preClient for use in m_server 2018-08-15 22:48:20 +01:00
Simon Arlott 15b05f95f0
m_sasl: check if the agent is present after every client_exit
When a server disconnects the client_exit hook will only be called once
but there could be multiple servers and clients behind that server.

After any client exits, check if the agent is still present.
2018-08-12 12:50:43 +01:00
Aaron Jones 6d8a8851df
modules/m_sasl.c: prevent abort_sasl() sending 906 twice 2018-04-06 20:07:08 +00:00
Aaron Jones 631c30890c
modules/m_sasl.c: command functions are void on this branch 2018-04-06 19:58:45 +00:00
Aaron Jones 280ce6a951
modules/m_sasl.c: abort session if we receive '*' as data
Otherwise we'd send the * on to services as actual data, which is likely
to fail to decode it (it's not valid Base-64) and reply with an SASL ...
D F which will result in us sending a 904 numeric instead of a 906.

cf. https://github.com/ircv3/ircv3-specifications/pull/298#issuecomment-271336287

Reported-By: James Wheare
2018-04-06 19:49:33 +00:00
Simon Arlott fe5fc851aa
gcc7 fixes: NICKLEN -> NAMELEN
Use NAMELEN instead of NICKLEN when accessing Client->name because it
could in theory be a HOSTLEN length string.
2018-01-19 23:26:20 +00:00
Simon Arlott 6003ce763c
Add outgoing SCTP connect support 2017-08-24 20:08:21 +01:00
Simon Arlott de2934965c
remove RB_IPV6 2017-08-20 12:54:46 +01:00
Simon Arlott 0ee833da4a
m_sasl: indicate client connection type for SASL 2017-08-09 22:04:11 +01:00
Simon Arlott 4b1cce65ed
ircd: send tags on every message
Simplify linebuf by introducing fsnprint to manage a list of printfs.
Add a msgbuf unparse cache for send functions that loop.
2017-08-06 16:21:29 +01:00
Simon Arlott de36941445
remove unused variables 2017-08-04 20:02:20 +01:00