aboutsummaryrefslogtreecommitdiffstats
path: root/include
Commit message (Expand)AuthorAgeFilesLines
* Unify the preprocessor macro for OpenSSL support•••Commit 9a1ee1b64ed660164197 introduced support for building IRCd with Meson. It defines the "HAVE_OPENSSL" preprocessor macro for both IRCd and librb. While librb does use that macro, IRCd unfortunately uses only the "HAVE_LIBCRYPTO" macro instead, set implicitly by AC_CHECK_LIB from autotools. Make the autotools build system define HAVE_OPENSSL (to unify IRCd with librb) and change IRCd to use that. amdj/unify-openssl-macroGravatar Aaron Jones2026-03-223-7/+7
* Tidy up module loading code•••The existing code had several defects: - Core module file names were hardcoded, while autoloaded non- core module filenames were not. Code that loaded core modules had a different but in some places duplicated structure to the code that loaded autoloaded modules. - Module loading for autoloaded modules happened in dentry order, making it unpredictable from one server to the next, or even across instances of `make install` on the same server. - Module loading for autoloaded modules did not verify that the dentry was a file before trying to load it. - An IRCd start (or a conftest) only printed lines about loading modules mentioned in the configuration file. - The configuration file was parsed before loading core and autoloaded modules, meaning any modules specified in the configuration file would be loaded first. - Once a module was loaded, it was added to the head of the module list, making MODLIST show them in reverse loaded order (newest (re)loaded modules at the top of the list). These are addressed as follows: - We now scan the core and autoload module directories and use this to determine which modules to load. - We now sort the dentries according to their filename before iterating them to load them, making module load order finally deterministic. - We now test if a dentry is actually a file before trying to load it. - We now print a message to the console (if running in foreground or conftest mode) when loading any module, including core and autoloaded modules. - The message printed to the console now has the IRCd module directory prefix stripped from it if it matches. - The configuration file is now parsed after loading core and autoload modules. - The modules are added to the module list in the order that they are loaded. This now makes MODLIST show the order that modules were (re)loaded in. Modifications to two modules are part of this effort: - The autoload module `m_alias` relied upon the alias dict not being NULL when loaded, but this is only the case after the configuration file has been parsed. The module already had a "rehash" hook to destroy all existing aliases and create new ones, so we can just make the module do nothing on load (remove its modinit function) and change it to use the "conf_read_end" hook instead of the "rehash" hook, and it will still create aliases after the configuration file is subsequently parsed. With this modification, there are now no in-tree consumers of the "rehash" hook. - The autoload module `m_services` iterated `service_list` upon loading it, which will now be empty (a no-op) since the module is loaded before configuration file is parsed. This module too handles the configuration file being parsed with a "conf_read_end" hook and takes the appropriate action, so we can just remove this code from its modinit function. All other modules' modinit functions have been audited for behaviour like this; there was nothing of note. Gravatar Aaron Jones2026-03-222-4/+1
* Add no-implicit-names client capability•••This has been recently ratified and suppresses NAMES output during channel joins when enabled, providing for a decent chunk of bandwidth savings. Gravatar Ryan Schmidt2026-03-191-0/+1
* build: add Meson buildsystemGravatar Valentin Lorentz2026-03-171-0/+26
* build: split serno generation out into a scriptGravatar Valentin Lorentz2026-03-173-0/+20
* Remove channel::kick_on_split_riding•••This feature had numerous pitfalls (such as not checking +beI) and services does it better than we can. Remove it and alert opers that the feature no longer exists if they had it configured. Gravatar Ryan Schmidt2026-03-171-1/+0
* Unconditionally include <stdint.h> in stdinc.h•••Previously we relied on an inclusion from librb-config.h which was generated via the configure script. This seemed unwise, so add it to our list of standard includes. This replaces a superfluous include of stdio.h since we included it twice for some reason (check two lines down from the changed line for the other location) Gravatar Ryan Schmidt2026-03-171-1/+1
* Adjust unsigned int -> uint64_t for all caps•••The previous commit addressed the issue with (most) function signatures, but forgot to update the caps themselves to be 64-bit. This fixes that, and finishes the remaining overlooked function signatures. Gravatar Ryan Schmidt2026-03-174-36/+36
* Apply review suggestions•••Also made full use of the Set/Clear macros across the codebase so there's fewer places to touch in the future if changes are needed. Gravatar Ryan Schmidt2026-03-171-6/+8
* Separate client vs server caps•••Instead of overloading the same field in a LocalUser, have separate fields for client caps vs server caps. While only one of these will ever be nonzero, it reduces error by making it explicit which set of caps is being checked. IsCapable and friends have been split as well, to IsClientCapable and IsServerCapable. Finally, both fields have been updated to uint64_t (server caps were approaching the current limit) and all APIs that reference caps updated to uint64_t as well (no more signed/unsigned mismatches). Gravatar Ryan Schmidt2026-03-176-42/+46
* 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