- Move code setting up SSL context from accept_new() to new
get/set_ssl_context() methods
- set_ssl_context() will allow setting context only if not already set,
or force re-setting context even if already present
- set_ssl_context() will return 1 if SSL context has been set
- if getting the new SSL context fails, set_ssl_context() will not break
current SSL context
This is preparatory work for reloading SSL certificates/key on BIP
reload.
Signed-off-by: Loïc Gomez <bip@animanova.fr>
- when the line to send to IRC was over a specific limit, the code was
not moving to the next item in the on_connect_send list after sending
the text to the client
- this change also adds a hard limit of 10 on_connect_send to display
for each connection
Signed-off-by: Loïc Gomez <bip@animanova.fr>
- Client connections in error also need to be closed/freed
- This fixes a file descriptor leak that would result in a bip crash
Signed-off-by: Loïc Gomez <bip@animanova.fr>
- Move gcc hardening/warning/advanced warnings flags to configure.ac to avoid
breaking incompatible environments
- Use -Warith-conversion only with gcc 10 and later
- Keep -Wundef -Wpedantic enabled globally
Signed-off-by: Loïc Gomez <bip@animanova.fr>
Some clients require the server to handle CAP requests (IRCv3).
This adds basic support for CAP requests during the authentication
phase, sending no capabilities on CAP LS or CAP LIST, and CAP NAK
with all requested capabilities listed on CAP REQ.
This will be a base for adding capabilities later.
Signed-off-by: Loïc Gomez <bip@animanova.fr>
- adds an internal method _irc_line_to_string with current irc_line_to_string
code, adding capability to skip the first N elements
- call this internal method from irc_line_to_string with N=0
- call this internal method from new irc_line_to_string_skip method
Signed-off-by: Loïc Gomez <bip@animanova.fr>
This will allow for user feedback in main bip.log when an IRC error
occurs, like:
- 401 ERR_NOSUCHNICK
- 404 ERR_CANNOTSENDTOCHAN
- 432 ERR_ERRONEUSNICKNAME
These should not be logged as LOG_ERROR as they are not bip errors but
usually on the end user instead.
Signed-off-by: Loïc Gomez <bip@animanova.fr>
This can be useful when a connection is very slow to reconnect and the
user wants to force an immediate reconnection.
Also:
- fix message when JUMPing on some already reconnecting link
- add find_link() method
- add reconnect timer info if any (else display 0s)
- add -f flag to reset reconnect timer
Signed-off-by: Loïc Gomez <bip@animanova.fr>
Waiting 2 minutes on the first disconnect is depressing.
With this the maximum of 10min wait time is reached after 20 attempts
instead of the current 5 attempts.
Signed-off-by: Loïc Gomez <bip@animanova.fr>
This would have defaults move to backlog_always=false / log=true /
backlog_lines=0, which should not cause much trouble as backlog will
be reset after being displayed.
Also, it is doubtfuk anyone would be keeping the default of 10 for
backlog as it is pretty much an undesirable configuration.
We need to annouce this change as important though, so users having
log = false are aware memory usage could increase if they don't set
it manually to another value.
Signed-off-by: Loïc Gomez <bip@animanova.fr>