Commit graph

439 commits

Author SHA1 Message Date
Ed Kellett 9834d3d5ba
Remove unused kline delay machinery 2019-04-27 14:51:27 +01:00
Ed Kellett 10df26d08f
Add check_one_kline, expose notify_banned_client 2019-04-27 14:47:28 +01:00
Aaron Jones c87c8e5bfe
newconf: remove plaintext listeners warning
Closes #270

[ci skip]
2019-03-27 19:29:55 +00: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
Chris West (Faux) 26c5df4b1e YESNO options are of type bool, not int 2018-03-23 16:46:38 +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 acd941bfed
ircd: use correct buffer sizes
This fixes an issue with truncated SJOINs.
2018-01-18 21:33:41 +00:00
Simon Arlott 6003ce763c
Add outgoing SCTP connect support 2017-08-24 20:08:21 +01:00
Simon Arlott c6ad9b0c5f
Add basic SCTP listener support that binds to multiple addresses
This only supports two addresses as the intended use is 1 IPv4 and 1 IPv6
address on a single-homed host, and the only supported configuration of
outgoing connections to other servers is to bind a single IPv4 or IPv6
address.
2017-08-24 20:08:20 +01:00
Simon Arlott 365e13662e
exit_unknown_client: don't delete servers from the client hash
Outgoing servers are not added to the client hash until they reach
IsServer() status, so if they're unknown when they exit then don't
attempt to delete them.
2017-08-24 20:08:18 +01:00
Simon Arlott 4ce1cac4b9
s_serv: connect using both IPv4 and IPv6 if unspecified 2017-08-22 21:55:12 +01:00
Simon Arlott de2934965c
remove RB_IPV6 2017-08-20 12:54:46 +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 42ae8ab21f
ircd: check caps for user in sendto_common_channels_local 2017-08-05 22:34:17 +01:00
Simon Arlott d2b5f4111b
tests: add sendto_* test framework 2017-08-05 14:09:01 +01:00
Simon Arlott 84a3275b7a
ircd: log command in mod_add_cmd/mod_del_cmd error scenarios 2017-08-05 12:29:52 +01:00
Simon Arlott 4212494106
ircd: substitution: fix buffer overrun if variable name is too long
Also fix the "ptr = ptr + (pptr - ptr)" aka "ptr = pptr" mess by
removing pptr.
2017-08-05 11:27:02 +01:00
Simon Arlott de36941445
remove unused variables 2017-08-04 20:02:20 +01:00
Simon Arlott 7a06833fb4
librb: linebuf: reduce the number of "put" implementations from 4 to 1 2017-07-30 15:51:45 +01:00
Simon Arlott a7fed8715b
Revert "Core modules cannot be unloaded, otherwise bad things happen."
This reverts commit b5cfad0319.
2017-07-29 23:52:06 +01:00
Simon Arlott 4c7d1de8f3
librb: linebuf needs to use the buffer limit from msgbuf_unparse_prefix 2017-07-29 23:32:27 +01:00
Simon Arlott 5ce6360b72
ircd: send: these buffers can be static 2017-07-29 23:24:23 +01:00
Simon Arlott 05a16d98e1
tests: add msgbuf_parse tests 2017-07-29 22:46:08 +01:00
Simon Arlott f3564f47f4
msgbuf: correctly split buffers into IRCv3 tags and RFC1459 message data 2017-07-29 22:46:07 +01:00
Simon Arlott 33ded5fc57
librb: remove unnecessary NULL from the end of rb_string_to_array output 2017-07-29 22:46:04 +01:00
Simon Arlott 86432f8f86
ircd: attach_conf: avoid clang static analysis warning
In the impossible scenario where ClassPtr(aconf) is NULL, reject the
client instead of dereferencing the NULL pointer.
2017-07-29 22:45:58 +01:00
Simon Arlott 07807ce8b0
ircd: send_to_channel_flags: avoid clang static analysis warning
Set current_capmask and then use it, instead of referencing target_p->localClient->caps again.

This makes the purpose of current_capmask a bit clearer.
2017-07-29 22:39:50 +01:00
Simon Arlott d856535edd
ircd: sendto_one_notice: avoid clang static analysis warning
target_p->from can't be NULL, and if it is then get_id(..., target_p)
dereferences it later in the function anyway
2017-07-29 22:39:49 +01:00
Simon Arlott 0d6da1a9c1
ircd: sendto_one_numeric: avoid clang static analysis warning
target_p->from can't be NULL, and if it is then get_id(..., target_p)
dereferences it later in the function anyway
2017-07-29 22:28:53 +01:00
Simon Arlott b9a6f1e5a1
ircd: get_or_create_channel: avoid clang static analysis warning
Use `len` after setting it.
2017-07-29 22:28:51 +01:00
Simon Arlott 0ded533dbc
ircd: sendto_one_prefix: avoid clang static analysis warning
target_p->from can't be NULL, and if it is then get_id(..., target_p)
dereferences it later in the function anyway
2017-07-29 22:28:49 +01:00
Simon Arlott 6c1e15a432
exit_remote_server: avoid clang static analysis warning
if IsServer(source_p) then the following must be all non-NULL:
 ->serv
 ->servptr
 ->servptr->serv

Remove unnecessary and inconsistent pointer checks.
2017-07-29 22:28:48 +01:00
Simon Arlott ab5fc9c032
ircd: hostmask: avoid clang static analysis warning
arec->Mask.ipa.bits is unused if arec->masktype == HM_HOST
2017-07-29 22:27:23 +01:00
Simon Arlott 8467fd9caf
ircd: listener: Document check_reject() behaviour 2017-07-29 22:20:04 +01:00
Simon Arlott a940f54623
sslproc: check number of arguments to zipstats command 2017-07-29 13:32:21 +01:00
Aaron Jones ed9f6a6565
src/channel.c: don't use the bancache in is_banned()/is_quieted()
The bancache will be re-architected onto clients in future for easier
invalidation, but this is a good-enough temporary fix for issue #243

Fixes #243
2017-07-29 13:32:20 +01:00
Simon Arlott e9f0d740e3
msgbuf: remove unused field parselen 2017-07-27 18:31:08 +01:00
Simon Arlott fb81421fc7
ircd: substitution: fix NULL termination buffer overrun when the output is too large for the buffer 2017-07-27 18:31:07 +01:00
Simon Arlott 1dfb080874
ircd: substitution: fix overrun with unterminated '}' in format string
handle a variable following an unterminated variable better
2017-07-27 18:31:05 +01:00
Simon Arlott 169a1c3535
msgbuf: s_assert is not a substitute for proper code
(dns, m_alias, m_stats updated as msgbuf no longer includes s_assert.h)
2017-07-26 19:30:41 +01:00
Simon Arlott d2b3a2a474
ircd: check_server: don't allow a connection if that would exceed the class limit 2017-07-23 17:38:11 +01:00
Simon Arlott e3cea4d811
ircd: serv_connect: don't try to connect if that would exceed the class limit 2017-07-23 15:40:00 +01:00
Simon Arlott 89bb7d65fb
ircd: s_conf: fix use of strlcpy in strip_tabs
strlcpy should be called with the size of the destination buffer, not
the length of the source string.

When the source is an empty string, the destination buffer isn't
written at all, resulting in it trying to output uninitialised data.

This could also cause a buffer overflow on very long invalid config
lines.
2017-06-25 19:48:49 +01:00
Aaron Jones 41390bfe5f
When a remote MODRESTART command is received, it will pass through the
ENCAP module. The ms_encap function is responsible for dispatching the
command handler and then the modules will eventually be reloaded.

However, if the ENCAP module is reloaded to a different address, the
stack now contains the address of a function that no longer exists.

Also, in this version of the IRCd, the module restarting functionality
was located in a function that is itself located in a module, so things
will also go badly if that module is reloaded to a different address,
too.

Return immediately from the command handler and have the event loop
call the function responsible for reloading the modules instead.

c.f. release/3.5 commit db05a3621058

Reported-by: mniip (Freenode)
2016-12-28 22:08:14 +00:00
Simon Arlott 57dd2c6a89
msgbuf: don't append a ';' unless there are existing tags
When both account-tag and server-time are present but the client
doesn't have the first (i == 0) of these enabled. They will get
an erroneous ';' after the '@'.

Track whether or not there are tags present, and use this to
determine whether to add the ';' or not. Also remove the extra
function that loops over all of the tags by using this flag to
handle the case where there are no tags being written.
2016-12-04 19:41:08 +00:00
Simon Arlott 6396c5da07
fix privmsg/notice send functions to use variable argument lists properly 2016-12-04 19:41:07 +00:00
Simon Arlott e2d5ffd5dd
echo-message should work for privmsg/notice to another user
Build the same message but send it to the local client first,
so that the echo-message capability works. But don't do it when
sending a message to yourself.
2016-11-23 21:59:43 +00:00
Simon Arlott 2d8d5b058b
echo-message should work for clients that aren't in the target channel
Move the echo part to the end of the channel membership loop so that it
works even if the user isn't on the channel.
2016-11-23 21:14:44 +00:00
Simon Arlott f41f79971c
server_estab: don't try to send to a dead client
If the zlib setup fails the client will be exited, so don't send
to it before checking this.
2016-11-20 21:41:18 +00:00
Simon Arlott 50b1e5987c
listener: use exit_client instead of free_client
As well as leaking a connid and leaving the connection open,
these calls to free_client() leave the client in the unknown_list
causing check_unknowns_list() to crash when either ptr->data
(ptr being the freed client_p->localClient->tnode) is NULL or
when client_p->localClient is NULL.

Flag the client as an IO error so that we don't try to send it
any data (as this is not a normal plaintext connection).
2016-11-20 21:09:07 +00:00