Bram Matthys
0e6fc07bd9
Update verify_link() to return rather than set the link block in a variable.
...
Hopefully this fixes a crash when linking (succesfully authenticated) servers,
something which only happens with GCC and only for some people in some cases.
2022-08-03 14:55:37 +02:00
Bram Matthys
7267d81278
RPC: add spamfilter.list and spamfilter.add calls.
2022-08-02 09:28:09 +02:00
Bram Matthys
574419a607
For JSON spamfilter output: add "ban_duration" and "ban_duration_string"
2022-08-02 09:21:36 +02:00
Bram Matthys
eb9aff4c1c
RPC: user.get: use JSON_RPC_ERROR_NOT_FOUND if user is not found.
2022-08-02 08:31:46 +02:00
Bram Matthys
b079aa3498
RPC: Fix "id" not showing up in error responses.
...
rpc_error() and rpc_error_fmt() were called with a NULL request.
This also fixes logging of RPC errors to show the name of the RPC call.
2022-08-02 08:30:03 +02:00
Bram Matthys
6749ab4e0c
RPC: server_ban: add handling of "expire_at".
...
Was previously always setting expiry to 5 seconds as a placeholder/TODO.
2022-08-02 08:22:28 +02:00
Bram Matthys
970cd60698
Use timestamp_iso8601() from server-time module (less duplicate code).
2022-08-02 08:13:49 +02:00
Bram Matthys
8fae1d9306
Show mode parameters when an IRCOp does MODE #channel, that is:
...
for a channel they are not in, if they have the channel:see:mode:remote
permission. This permission is included in all operclasses by default,
just like how this is already the case for channel:see:mode:remotebanlist
and other related permissions.
Reported by alice.
2022-07-03 09:07:45 +02:00
Bram Matthys
bfcde12338
Fix internal function convert_regular_ban() to actually use the buffer
...
that it was provided. Duh!
(bug introduced 2 days ago in 7371498ffd )
2022-07-03 08:58:32 +02:00
Bram Matthys
514a1f6430
Clean up the listener code (code deduplication 3x -> 1x helper) and
...
also fix a small memory leak on rehash due to listener->webserver not
being freed.
Hopefully this doesn't break anything ;)
2022-07-02 08:27:00 +02:00
Bram Matthys
7371498ffd
Make auto-expansion work for IPv6 bans as well: +b A:B:C:IP -> *!*@A:B:C:IP.
...
Reported by armyn in https://bugs.unrealircd.org/view.php?id=6147
This also adds a new function convert_regular_ban() which is now
used by both clean_ban_mask() and extban_conv_param_nuh().
2022-07-01 10:13:57 +02:00
Bram Matthys
8703d883dd
Fix crash with ip change vs 'connect-flood' module.
2022-06-28 17:28:44 +02:00
Bram Matthys
a3fb6bc07b
Remove leftover of a copypaste in json_expand_tkl() causing a memory leak.
2022-06-27 10:51:15 +02:00
Bram Matthys
c85f666fed
Fix server_ban_parse_mask() returning with variables set to local storage.
...
More precise, for extended server bans, usermask/hostmask was set to
a local variable that was not defined as static char[]. This would lead
to corrupt data and/or crashes.
Bug introduced a few days ago with 3d9b7e4b70
2022-06-27 10:49:46 +02:00
Bram Matthys
1d701cb7d4
Remove old "TODO" item in conf file.
...
[skip ci]
2022-06-25 09:52:15 +02:00
Bram Matthys
29dc2e1e47
Fix REMOTE_CLIENT_JOIN not showing up for remote joins.
...
There was log code for "JOIN" but not for "SJOIN". Added now.
Reported by ComputerTech in https://bugs.unrealircd.org/view.php?id=6141
2022-06-25 09:17:07 +02:00
Bram Matthys
c60fdad7eb
RPC: add server_ban.add
...
This also moves some of the adding code (sending notice, broadcasting to
other servers, etc) to a function tkl_added().
We should probably do the same for deletion and not use the tkllayer
anymore for that?
2022-06-24 19:49:32 +02:00
Bram Matthys
2c1457ae6b
RPC: add server_ban.del
2022-06-24 19:18:39 +02:00
Bram Matthys
3d9b7e4b70
RPC: remove tkl, split this up.. starting with server_ban.
...
Currently available:
* server_ban.list
* server_ban.get with params: name="*@1.2.3.4", type="kline"
This also adds server_ban_parse_mask() which is now used by both GLINE/etc
and the RPC API to parse the same way and convey the same error messages.
2022-06-24 18:53:10 +02:00
Bram Matthys
6596741638
Add rpc.modules.default.conf, loads all required modules for JSON-RPC.
2022-06-24 13:44:41 +02:00
Bram Matthys
d3697b8684
RPC: add tkl.list
2022-06-24 13:33:20 +02:00
Bram Matthys
36946c6c51
Move JSON stuff from log.c to json.c now that it is more universal.
2022-06-24 13:21:27 +02:00
Bram Matthys
14215e1837
Fix two memory leaks in RPC:
...
* on REHASH rpc-user block name was not freed
* temporary construct was not freed (if params was missing)
2022-06-22 14:54:51 +02:00
Bram Matthys
fdf0d545d7
Split rpc_client_handshake() into rpc_client_handshake_unix_socket()
...
and rpc_client_handshake_web().
Makes the code easier to follow / less chance of mistakes.
2022-06-22 13:53:56 +02:00
Bram Matthys
25d5ae93e6
Do some sanity checking in webserver (fixes crash)
2022-06-22 13:45:54 +02:00
Bram Matthys
faffe7c9a8
Fix crash in webserver
2022-06-21 17:56:25 +02:00
Bram Matthys
7c8918e22d
Update rpc_error() to use JsonRpcError (enum) and add more error values.
2022-06-20 19:02:52 +02:00
Bram Matthys
b38b0f5086
Set loop.config_state to one of CONFIG_STATE_* so modules (and core)
...
can track at what step we are during configuration file and module
processing.
2022-06-20 12:54:22 +02:00
Bram Matthys
0a4c6e877d
Fix crash if 'websocket' is loaded without 'websocket_common'.
...
Previously we did show a warning but we could crash a millisecond
later so that wasn't particularly helpful.
Now, is_module_loaded() can be used from HOOKTYPE_CONFIGPOSTTEST
to detect if a module is loaded or not, contrary to us having to
do it in MOD_LOAD when it is too late. So now the requirement is
really enforced and also works for hot-loading as well as
unloading of required modules is now prevented.
2022-06-20 08:54:53 +02:00
Bram Matthys
a14609f493
Fix small memory leak in webserver.
2022-06-20 08:25:46 +02:00
Bram Matthys
26ab79132b
Fix memory leak in webserver for HTTPS POST.
2022-06-19 20:47:48 +02:00
Bram Matthys
bbf9600504
Mention JSON-RPC documentation in early release notes.
...
https://www.unrealircd.org/docs/JSON-RPC
[skip ci]
2022-06-19 20:28:51 +02:00
Bram Matthys
1fe6119026
Make tld::motd and tld::rules optional.
...
Suggested by Jellis in https://bugs.unrealircd.org/view.php?id=6072
2022-06-19 20:15:00 +02:00
Bram Matthys
55387a8aa4
RPC: Fix strchr() on non-nul-terminated string (leading to OOB read)
2022-06-19 17:59:05 +02:00
Bram Matthys
85784e8118
Bump version to 6.0.5-git
2022-06-19 16:30:50 +02:00
Bram Matthys
8b2caf5501
Make listen::options::rpc implicitly enable TLS, so nobody
...
accidentally allows JSON-RPC over insecure HTTP.
2022-06-19 16:17:15 +02:00
Bram Matthys
5301ab5be8
Add some TODO items
2022-06-19 13:13:33 +00:00
Bram Matthys
941439a710
Use RPC_CALL_FUNC() just like how we have CMD_FUNC()
2022-06-19 13:13:33 +00:00
Bram Matthys
c24a8e43e3
Fix outdated doxygen information on CMD_FUNC()
2022-06-19 13:13:33 +00:00
Bram Matthys
f99085fc03
RPC: add user.get()
2022-06-19 13:13:33 +00:00
Bram Matthys
0e60b8bbfb
RPC: Add ?username=xyz&password=zzz authentication as well
...
FIXME: move URI parsing to 'webserver' and deal with unescaping %xx
2022-06-19 13:13:33 +00:00
Bram Matthys
c611f18d56
RPC: Add rpc-user { } block and do authentication
2022-06-19 13:13:33 +00:00
Bram Matthys
ab999659fc
Remove some FIXME's and cleanup code a little bit.
2022-06-19 13:13:33 +00:00
Bram Matthys
feb2c9c418
Don't print "Link to server [..] closed" for RPC and control sockets.
2022-06-19 13:13:33 +00:00
Bram Matthys
e718d2021f
Make websocket work over RPC
2022-06-19 13:13:33 +00:00
Bram Matthys
853f0685ed
Split off big chunk of websocket module into websocket_common module.
...
And load the websocket_common module by default (which is just an API).
2022-06-19 13:13:33 +00:00
Bram Matthys
7679ec7920
Get rid of cast, do things properly.
2022-06-19 13:13:33 +00:00
Bram Matthys
0eb42155dd
Limit request body to 4k by default.
2022-06-19 13:13:33 +00:00
Bram Matthys
3e35b8e96a
Small code cleanup
2022-06-19 13:13:33 +00:00
Bram Matthys
467e3d847a
Handle chunked encoding in webserver (mostly meant for RPC).
2022-06-19 13:13:33 +00:00