aboutsummaryrefslogtreecommitdiffstats
path: root/include
Commit message (Expand)AuthorAgeFilesLines
* build: add Meson buildsystem dwfreed/meson-rebasedGravatar Valentin Lorentz2026-03-151-0/+26
* build: split serno generation out into a scriptGravatar Valentin Lorentz2026-03-143-0/+20
* Pass msgbuf to PART's privmsg_channel hook and propagate PART tags•••The privmsg_channel hook gained a new msgbuf member which was uninitialized in m_part. Properly pass the msgbuf to that parameter and propagate any tags set by the hook to downstream servers. This requires introducing sendto_server_tags(), and I refactored sendto_server() to call the same helper internal method as sendto_server_tags(). I took the opportunity to update the method to use msgbuf instead of linebuf directly (meaning sendto_server() now calls outbound_msgbuf). Fixes #484 Gravatar Ryan Schmidt2026-01-221-0/+4
* Add doing_info_conf hook and cleanup unused hooks•••doing_info_conf is called during INFO commands after all conf options have been sent to opers. Modules can use this hook to expose any conf options they define by sending relevant RPL_INFO replies to the oper. This addition removes the final barrier to defining new ircd.conf options inside of extension modules rather than requiring core changes for extension configuration. Additionally, some cleanup has been performed for hook definitions that are not called anywhere inside of solanum. Three hooks were declared in hook.h as extern int but were not defined or referenced in any other file: iosend_id, iorecv_id, and iorecvctrl_id. The doing_admin, doing_info, doing_motd, and doing_trace "spy" hooks were defined in the module headers for those modules, however the modules never actually invoked those hooks. All of the lingering declarations for these hooks have now been removed as they weren't doing anything anyway. Gravatar Ryan Schmidt2026-01-211-4/+0
* Fix msgid tags with echo-message•••msgid generation has been moved to the privmsg_user and privmsg_channel hooks, which are called on every normal PRIVMSG/NOTICE/TAGMSG. They are not called when messaging user@server, opers@server, or mass-messages and as such none of those things will have msgid attached. This seems fine as user@server is rejected by solanum and exists solely for messaging pseudoservers, opers@server is turned into a snote, and mass-messages are oper-only and thus unlikely to need anything that keys off msgid in the future. Moving this solves the interaction with msgid and echo-message. Now, we ensure that an echoed message always has a msgid, and that msgid is always the same as the msgid shown to other clients. This requires expanding the hook_data structures for those two hooks. While a core restart is not needed, attempting to reload tag_message_id before reloading m_message may cause crashes. When updating your servers, please reload m_message first. Gravatar Ryan Schmidt2026-01-211-0/+2
* Batch updates•••The extension example_module was extended to introduce a new client-initiated batch type named test. This is primarily done to ease testing of the client-initiated portions of m_batch, but also serves as a useful sketch for how a module can register its own client-initiated batch types. The definition of struct BatchHandler was slightly modified to use a callback function to determine if nesting is allowed. The callback can additionally set a custom error message if desired when returning false. The len and messages list in struct Batch no longer include the start message, so a len of 0 indicates an empty batch. Because the start message is still allocated and saved off, adjust anything that impacts a client's pending_batch_lines by 1 to account for the implicit additional message. Empty batches now trigger the relevant batch handler. If a handler wants to no-op on empty batches, it can do so but this allows additional flexibility for handlers to still do something upon receiving empty client-initiated batches. Gravatar Ryan Schmidt2026-01-211-9/+10
* Add batch support•••- Add "batch" client capability - Support sending netsplit/netjoin batches - Support receiving BATCH from clients and remote servers - Support for modules to define supported batch types for incoming batches - Add "message_handler" hook to override the handler for a particular incoming message - Add technical and user-facing documentation for batches - Add some more sendto_* overloads that support tags which were missing from the initial message-tags implementation but turned out to be needed Gravatar Ryan Schmidt2026-01-216-8/+121
* Revert "msgbuf: duplicate the string during partial parse and constify line" ...•••This reverts commit 5b253939da8f6b0a44ce6787ed12e26450ac6a63 to fix a memory leak: ``` ==825564== 818 bytes in 4 blocks are definitely lost in loss record 616 of 648 ==825564== at 0x4844818: malloc (vg_replace_malloc.c:446) ==825564== by 0x49CD7A9: strdup (strdup.c:42) ==825564== by 0x4888A2E: msgbuf_partial_parse (msgbuf.c:143) ==825564== by 0x489DA84: build_msgbuf (send.c:276) ==825564== by 0x489DA84: sendto_one_numeric (send.c:431) ==825564== by 0x48A3CD7: show_isupport (supported.c:181) ==825564== by 0x489A9F2: user_welcome (s_user.c:1433) ==825564== by 0x489B114: register_local_user (s_user.c:718) ==825564== by 0x488FC08: handle_command (parse.c:310) ==825564== by 0x488FC08: parse (parse.c:224) ==825564== by 0x488EEF8: parse_client_queued.part.0 (packet.c:67) ==825564== by 0x488F084: parse_client_queued (packet.c:49) ==825564== by 0x488F084: read_packet (packet.c:306) ==825564== by 0x4B3C47B: rb_select_epoll (epoll.c:199) ==825564== by 0x4B3716F: rb_select (commio.c:2038) ==825564== [...] ==825564== ==825564== 3,012 bytes in 15 blocks are definitely lost in loss record 627 of 648 ==825564== at 0x4844818: malloc (vg_replace_malloc.c:446) ==825564== by 0x49CD7A9: strdup (strdup.c:42) ==825564== by 0x4888A2E: msgbuf_partial_parse (msgbuf.c:143) ==825564== by 0x489D3CE: build_msgbuf (send.c:276) ==825564== by 0x489D3CE: sendto_realops_snomask (send.c:1431) ==825564== by 0x4887C0D: load_a_module (modules.c:712) ==825564== by 0x488801D: load_core_modules (modules.c:257) ==825564== by 0x488124A: solanum_main (ircd.c:664) ==825564== by 0x494DCA7: (below main) (libc_start_call_main.h:58) ```Gravatar Val Lorentz2025-10-111-1/+1
* Fix typing module decl and send 417 in more cases•••The typing module declaration had a copy/paste error that has now been corrected, and we now send 417 ERR_INPUTTOOLONG in cases where parsing the line into a MsgBuf fails because it overflowed the 8191+512 byte buffer while processing tags or the message origin. Gravatar Ryan Schmidt2025-10-101-0/+9
* Address review comments•••Correctly sent ERR_INPUTTOOLONG if the incoming tags portion from a client is too long. The previous calculation did not take into account the fact we added null terminators after every tag key and value. Since msgbuf_parse is used for both server and client input, we expose the length of the original tags portion of the buffer in the MsgBuf struct rather than abort msgbuf_parse if it is too long, since the only time truncation is explicitly not allowed is for incoming tags from client messages. Additionally, make join_sep functional in format_client_tags(). Gravatar Ryan Schmidt2025-10-101-0/+1
* m_message: Implement message-tags and TAGMSG•••The CAP_STAG server capability and the CAP_TAGS server capability introduced by m_message are redundant, so get rid of CAP_TAGS and update the comment for CAP_STAG to indicate what it is for. Additionally, define the message-tags client capability in m_message. A lot of new sendto_* functions were introduced that take an explicit array of tags to attach to the outgoing message. New functions were preferred over updating existing functions in order to maintain compatibility with non-tags-aware code in both the API and ABI layers. The updated definitions of these functions will be provided in a subsequent patch in this PR; however I felt the declarations would be useful in reviewing the changes to m_message. A TAGMSG with zero client-only tags is rejected with 412 ERR_NOTEXTTOSEND. While the precise message of that numeric is a little bit misleading, it was the closest existing thing and matches what we send off when a PRIVMSG contains no text. The message-tags spec does not specify any particular error when a TAGMSG contains no tags (indeed it has a non-normative example where such a TAGMSG is propgated). The spec also allows for server-side moderation of tags, however, and not propagating completely useless messages is a valid use of those moderation powers. General cleanup of the file was performed as part of this patch. Gravatar Ryan Schmidt2025-10-102-5/+22
* Refactor message_tag hook•••The original hook was defined in the (now-removed) cap_message_tag module. This new hook lives deeper down in parse.c so that it fires on all incoming tags for all incoming messages. The hook was renamed from client_tag_accept to message_tag to denote that it is used for all tags, including tags coming from server connections, and not just tags with a client-only prefix. The hook data contains two non-const fields for the capmask and approval status. Since incoming tags lack a capmask entirely, this allows hook functions that wish to keep the tag around to specify the capmask used for propagating the tag to other clients and servers. The approval status can take one of three forms: approve the tag, drop the tag from the message (but still process other tags and run the command handler), or drop the entire message (not processing any other tags and not running any command handlers). It is expected when a hook function drops the message that they'll send appropriate feedback to the client, however the nature of that feedback will likely vary by hook function so no default message is given to a client if their message is dropped. The incoming_message global defined previously with cap_server_time now holds the MsgBuf with the updated/sanitized list of tags rather than the raw values specified by the client. Additionally, cap_server_time makes use of this new hook to propagate the time tag into function callbacks that support tag propagation. The implicit propagation still exists since the majority of function callbacks do not support explicit tag propagation, and that fact will not change in the course of this patchset. Gravatar Ryan Schmidt2025-10-101-5/+19
* Update MsgBuf for better tags support•••Note: Future commits within this PR update call sites to leverage these changes. I opted to keep each individual commit smaller to make them easier to review in series. When parsing a line into a MsgBuf, we now keep track of whether the final parameter had a leading colon or not, so that we can roundtrip unparse it with said colon even if the final parameter lacks a space or otherwise doesn't require the leading colon. solanum sends multiple such messages and clients may be coded to expect colons in various situations, so adding this roundtrip support maintains backwards compatibility for when all outbound messages get parsed into MsgBuf and then unparsed before being sent off. The MsgBuf cache now keeps track of two messages: one with a "local" source and one with a "remote" source. Many send functions, e.g. the sendto_channel family, use ids for the sender when sending remotely but use the hostmask or server name for local sends. When forcing outbound messages into a parse/unparse loop we can no longer just ad-hoc assemble strings together like the current linebuf code does, so instead we cache both variants to avoid needless string formatting operations in tight send loops. Unparsing tags from a MsgBuf now enforces that the server tags and client tags portions do not exceed 4094 bytes each, and that server tags always come before client tags. Excess data is truncated. Gravatar Ryan Schmidt2025-10-101-4/+8
* Increase tags to 8191 bytes and max count to 30•••If we receive an incoming message from a client that has over 4094 bytes of tag data (not including leading '@' or trailing ' '), reject the message with ERR_INPUTTOOLONG (417) per the message-tags spec. Similarly, give the same numeric if the client specifies the new maximum of 30 tags, since we can't distinguish between a client that gives us 30 tags and one that gives us more than 30. The spec says we are not allowed to truncate tags at all, and having 30 means we could have potentially truncated the incoming tag data. Gravatar Ryan Schmidt2025-10-104-3/+7
* msgbuf: duplicate the string during partial parse and constify lineGravatar Raito Bezarius2025-10-101-1/+1
* message-tags: facility to manipulate client-tags•••It provides for hook facilities to client-only tags: - messages can be dropped silently ; - messages can be edited ; - messages can be stripped from a client-only tag Gravatar Raito Bezarius2025-10-103-3/+24
* m_message: proper tag propagation•••This introduces an handler to accept or not the propagation of a tag. Basic sketch API is provided for modules to hook for providing their own policy for specific tag propagation. Gravatar Raito Bezarius2025-10-103-0/+42
* Propagate server-time implicitly (ugh)Gravatar Ed Kellett2025-10-101-0/+3
* msgbuf: Add msgbuf_get_tagGravatar Ed Kellett2025-10-101-0/+2
* Add STAG server capGravatar Ed Kellett2025-10-101-0/+1
* Add dedicated hook data type for can_create_channel•••hook_data_can_create_channel includes the name of the channel being created, which is necessary for any non-trivial restriction of channel creation as well as sending correct error messages. The new hook data matches the layout of the previous hook data, taking advantage of a disused pointer field in hook_data_client_approval as used by callers of the hook (m_join). Gravatar daemoness2025-05-111-0/+7
* GitHub CI Workflow: Bump OS and compiler versions (#447)•••* GitHub CI Workflow: Bump OS and compiler versions * CI: fix for clang 18/19 - Don't enable -Werror during the execution of ./configure and drop -Wunused-value from --enable-warnings - librb/src/crypt.c: remove old-style function decls - rb_dictionary: define type of arguments, fix callees - rb_radixtree: fix spurious out-of-bounds diagnostic Co-authored-by: Doug Freed <dwfreed@mtu.edu>Gravatar Aaron Jones2025-02-251-2/+2
* Don't set the oper flags on client (#443)•••Remove unused OPER_FLAGS logic in favor new priv system. It had rotted over time and was overlapping with PINGSENTGravatar Eric Mertens2025-01-291-2/+0
* Remove WebSocket supportGravatar Aaron Jones2024-06-124-50/+2
* extensions/invite_notify: make the NOTICE optional, configurable•••This adds a configuration option that determines whether the NOTICE is sent to clients that do not support the IRCv3 invite-notify capability. Requested by LiberaChat MGM. Gravatar Aaron Jones2023-11-081-0/+1
* ircd/listener: return a fatal TLS alert for early rejected TLS clients•••This is in furtherance of commit 3fdf26aa19628d5e12a3 which added functionality to reply with a TLS record layer alert for D-Lined TLS clients. It turns out that there are other plaintext error messages in this same function that should receive the same treatment. Also move another error string to a variable and use a compile-time optimised-out strlen for it too, to use the same approach as an existing error string. Finally, use a different alert (internal_error) for the case where IRCd is simply unable to accept more connections. Gravatar Aaron Jones2023-11-071-1/+1
* client: refactor del_all_accepts to allow skipping own accept list•••This allows reusing this function for other uses that just need to remove this client from others' accept lists on nick change and not have duplicates of this code everywhere Gravatar Doug Freed2023-11-061-1/+1
* Replace RPL_WHOISTEXT(337) with RPL_WHOISSPECIAL(320) (#419)•••Reasons: * 337 conflicts with other IRCds use as RPL_ENDOFINVITELIST * 320 is commonly used for extra human-readable informationGravatar Eric Mertens2023-10-032-2/+2
* Warn opers about unresponsive serversGravatar David Schultz2023-06-132-0/+2
* authd: fix crash/restart breaking DNSBL lookups (#394)•••authd child processes are only told about configured DNSBLs when the configuration is being parsed. This is bad, because when authd crashes or is killed, IRCd will restart it, but will not tell it about any configured DNSBLs until IRCd is next rehashed. We already have a dictionary that stores configured DNSBLs (for hit statistics for `STATS n'), so store the additional needed fields in that structure, and loop over that dictionary's entries when authd is restarted, sending the fields just as if the configuration were being reloaded. Reported-By: @Unit193Gravatar Aaron Jones2023-01-111-1/+3
* strip_colour: Strip '\x11' (monospace) and '\x1e' (strikethrough)•••Also clarify the comment: this function strips more than just colours. Gravatar Tobias Geerinckx-Rice2023-01-031-1/+3
* Remove the unused COMPRESSED flag and stats handler•••- Null "compress" handler left as-is in newconf.c Gravatar JailBird2022-12-221-2/+0
* Note that messages caught in +g/+G are discardedGravatar Tobias Geerinckx-Rice2022-10-261-2/+2
* Add umode +I to allow users to hide their idle time (#220)Gravatar David Schultz2022-08-301-0/+8
* Remove ancient portability code (#361)•••Remove portability code for systems that don't follow at least SUSv3. This fairly closely aligns with ISO C99, which solanum already requires.Gravatar jailbird7772022-08-241-18/+0
* OpenSSL 3.0 compatibility•••Edited by @aaronmdjones: - Correct some data types and casts - Minor style fixups (e.g. we put * on the variable name not the type) - librb/src/openssl.c: - Defer call of BIO_free(3ssl) to the end of the conditional block to avoid having calls to it in multiple paths - Check the return value of SSL_CTX_set0_tmp_dh_pkey(3ssl) because if it fails then we must use EVP_PKEY_free(3ssl) to avoid a memory leak This could fail if, for example, the user supplied DSA parameters in the DH parameters file instead. - ircd/newconf.c: - Check whether OSSL_DECODER_CTX_new_for_pkey(3ssl) was able to parse the given CHALLANGE public key as a valid RSA public key, and then check whether OSSL_DECODER_from_bio(3ssl) actually loads it successfully - ircd/s_newconf.c: - Use EVP_PKEY_free(3ssl) instead of OPENSSL_free(3ssl) on EVP_PKEY pointers; this will avoid inadvertent memory leaks if the EVP_PKEY structure contains any dynamically-allocated child members - modules/m_challenge.c: - Unconditionally use EVP(3ssl) to generate the SHA-1 digest of the random challenge; this API has been around for a very long time and is available in all supported versions of OpenSSL - Add lots of error checking to all steps of the process Tested against 1.1.1 and 3.0; both with missing and provided DH parameters (which works as you'd expect; the server will not negotiate a DHE cipher without them), and CHALLENGE, including missing keys or keys of the wrong type (e.g. when you supply an EdDSA key instead of an RSA key). This does break compatibility with OpenSSL 1.1.0 and below, which are now all end-of-life and unsupported anyway. Closes #357 Gravatar jailbird7772022-08-252-1/+5
* EBMASK capab, to burst BMASK metadata (#354)Gravatar Jess Porter2022-08-202-1/+2
* chm_regmsg: don't duplicate nick in 415•••sendto_one_numeric already includes the nick, so there's no need to duplicate it. OFTC does not.Gravatar Doug Freed2022-07-111-1/+1
* Cast time_t to long long when printingGravatar Matthew Martin2022-07-011-2/+2
* Add description parameter to auth blocks (#327)Gravatar Eric Mertens2022-04-142-2/+3
* Make valid_temp_time overflow-resistantGravatar Ed Kellett2022-04-131-0/+2
* remove some header dependencies on client.hGravatar Ed Kellett2022-03-062-0/+3
* just a stray colon where it wasn't meant to have :)Gravatar Valerie Pond2021-10-261-1/+1
* Support *mask* and !*mask* in LISTGravatar Ed Kellett2021-10-191-1/+1
* add SNO_BANNED, snote for it on client k/x-line rejection (#242)•••* add SNO_BANNED, snote for it on client k/x-line rejection * add snomask help file line for SNO_BANNEDGravatar jesopo2021-08-111-0/+1
* listener: refactor to use rb_dlink like the other lists in ircdGravatar Ariadne Conill2021-07-311-1/+1
* Create configurations for user-facing messages within registration (#238)Gravatar Melissa Draper2021-07-291-0/+8
* Create configurable client rejection message for SASL only (#236)Gravatar Melissa Draper2021-07-291-0/+1
* Update NUMERIC_STR_435 to be more human-readable and mention quietsGravatar Melissa Draper2021-07-291-1/+1
* Remove ziplinks (#218)Gravatar Ariadne Conill2021-06-263-19/+0