aboutsummaryrefslogtreecommitdiffstats
path: root/include/msgbuf.h
Commit message (Expand)AuthorAgeFilesLines
* 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
* 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-101-2/+3
* 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-101-0/+6
* msgbuf: Add msgbuf_get_tagGravatar Ed Kellett2025-10-101-0/+2
* Mailmap and copyright update for AriadneGravatar Ariadne Conill2021-06-011-1/+1
* Innovation by sedGravatar Ed Kellett2020-10-151-3/+3
* m_alias: Preserve protocol framing charactersGravatar Ed Kellett2020-07-051-0/+7
* 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. Gravatar Simon Arlott2017-08-061-1/+34
* msgbuf: correctly split buffers into IRCv3 tags and RFC1459 message dataGravatar Simon Arlott2017-07-291-13/+4
* msgbuf: remove unused field parselenGravatar Simon Arlott2017-07-271-1/+0
* msgbuf: s_assert is not a substitute for proper code•••(dns, m_alias, m_stats updated as msgbuf no longer includes s_assert.h) Gravatar Simon Arlott2017-07-261-12/+10
* msgbuf: allow for an explicit target to be definedGravatar William Pitcock2016-02-201-2/+3
* msgbuf: make msgbuf_unparse_prefix() publicGravatar William Pitcock2016-02-201-0/+2
* msgbuf: add some message building codeGravatar William Pitcock2016-02-201-3/+3
* msgbuf: msgbuf_append_tag(): add support for attaching a specific capability bitGravatar William Pitcock2016-02-131-1/+2
* msgbuf: pull in s_assertGravatar William Pitcock2016-02-121-0/+2
* msgbuf: fix AFP() macroGravatar William Pitcock2016-02-121-1/+1
* msgbuf: attach capabilities mask to each tag for sending•••this will be used with a bloom filter to speed up the 1-to-many case Gravatar William Pitcock2016-02-111-12/+17
* msgbuf: improve parse logicGravatar William Pitcock2016-02-101-3/+1
* msgbuf: implement msgbuf_parse()Gravatar William Pitcock2016-02-101-1/+1
* msgbuf: add lowlevel interface for building MsgBuf objectsGravatar William Pitcock2016-02-091-2/+33
* include: add msgbuf.h for future msgbuf apiGravatar William Pitcock2016-02-091-0/+60