]> jfr.im git - solanum.git/log
solanum.git
7 years agomkpasswd: avoid strdup(NULL) and the like if rb_crypt() fails
Aaron Jones [Tue, 20 Dec 2016 17:29:37 +0000 (17:29 +0000)] 
mkpasswd: avoid strdup(NULL) and the like if rb_crypt() fails

7 years agoauthd: don't exit() on OPM duplicate scanner errors, just ignore it
Aaron Jones [Mon, 19 Dec 2016 04:56:54 +0000 (04:56 +0000)] 
authd: don't exit() on OPM duplicate scanner errors, just ignore it

I run into this code even with a single kind of scanner with a single
port, so I'm not even sure how it thinks it already exists.

Perhaps it's being parsed twice, or something similar.

c.f. issue #229

7 years agomr_server: Handle certificate validation errors.
Keith Buck [Fri, 9 Dec 2016 10:01:22 +0000 (10:01 +0000)] 
mr_server: Handle certificate validation errors.

When certificate validation fails, the certificate fingerprint won't be
calculated, resulting in an attempt to format NULL into a log line
showing the fingerprint. Instead, add a different error message for
missing fingerprint (i.e. validation failed).

7 years ago.gitignore: ignore .exe extension.
Jason Volk [Mon, 5 Dec 2016 19:14:23 +0000 (14:14 -0500)] 
.gitignore: ignore .exe extension.
Utilized when building on windows, but shouldn't require any iff
windows case when on unix, so it can be simply ignored.

[ci skip]

7 years agom_rehash: Require admin privileges for REHASH SSLD.
Keith Buck [Sun, 4 Dec 2016 22:03:34 +0000 (22:03 +0000)] 
m_rehash: Require admin privileges for REHASH SSLD.

This change enforces admin privileges for the REHASH SSLD command, as
originally intended.

7 years agoFix cross compile for Windows
Simon Arlott [Sun, 4 Dec 2016 20:21:07 +0000 (20:21 +0000)] 
Fix cross compile for Windows

7 years agomsgbuf: don't append a ';' unless there are existing tags
Simon Arlott [Fri, 25 Nov 2016 16:02:11 +0000 (16:02 +0000)] 
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.

7 years agofix privmsg/notice send functions to use variable argument lists properly
Simon Arlott [Fri, 25 Nov 2016 16:19:29 +0000 (16:19 +0000)] 
fix privmsg/notice send functions to use variable argument lists properly

7 years agoreference.conf: Use proper IPv6 RFC Documentation Range Subnet
Aaron Jones [Sun, 27 Nov 2016 20:51:06 +0000 (20:51 +0000)] 
reference.conf: Use proper IPv6 RFC Documentation Range Subnet

[ci skip]

7 years agoecho-message should work for privmsg/notice to another user
Simon Arlott [Wed, 23 Nov 2016 21:43:33 +0000 (21:43 +0000)] 
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.

7 years agoecho-message should work for clients that aren't in the target channel
Simon Arlott [Wed, 23 Nov 2016 21:14:44 +0000 (21:14 +0000)] 
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.

7 years agoserver_estab: don't try to send to a dead client
Simon Arlott [Sun, 20 Nov 2016 21:41:18 +0000 (21:41 +0000)] 
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.

7 years agolistener: use exit_client instead of free_client
Simon Arlott [Sun, 20 Nov 2016 20:43:53 +0000 (20:43 +0000)] 
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).

7 years agoreference.conf: document that SPKI is supported in version 3.5 now
Aaron Jones [Tue, 15 Nov 2016 12:36:01 +0000 (12:36 +0000)] 
reference.conf: document that SPKI is supported in version 3.5 now

7 years agoTLS backends: Move some library-dependent functions to the proper location
Aaron Jones [Tue, 15 Nov 2016 12:16:03 +0000 (12:16 +0000)] 
TLS backends: Move some library-dependent functions to the proper location

The comment incorrectly stated these were library-agnostic; infact, they
use library-dependent data types or macro names.

7 years agoREADME: Document glibtoolize use on Mac systems
Aaron Jones [Mon, 31 Oct 2016 09:08:46 +0000 (09:08 +0000)] 
README: Document glibtoolize use on Mac systems

Fixes #224

7 years agoUse const hook data where possible
Simon Arlott [Sun, 30 Oct 2016 12:36:50 +0000 (12:36 +0000)] 
Use const hook data where possible

core/m_nick.c: In function `change_remote_nick':
core/m_nick.c:745: warning: assignment discards qualifiers from pointer target type

7 years agofree cache emptyline rb_dlink_node, allocated automatically but never freed
Simon Arlott [Sun, 30 Oct 2016 12:05:45 +0000 (12:05 +0000)] 
free cache emptyline rb_dlink_node, allocated automatically but never freed

==00:00:01:09.081 1762== 48 bytes in 2 blocks are definitely lost in loss record 545 of 991
==00:00:01:09.081 1762==    at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==00:00:01:09.081 1762==    by 0x56C14A2: rb_malloc (rb_memory.h:41)
==00:00:01:09.081 1762==    by 0x56C177C: rb_bh_alloc (balloc.c:189)
==00:00:01:09.081 1762==    by 0x56CA0A9: rb_make_rb_dlink_node (tools.c:65)
==00:00:01:09.081 1762==    by 0x4E52D85: cache_file (cache.c:146)
==00:00:01:09.081 1762==    by 0x4E52AC3: init_cache (cache.c:67)
==00:00:01:09.081 1762==    by 0x4E69530: charybdis_main (ircd.c:762)
==00:00:01:09.081 1762==    by 0x400815: main (main.c:8)

==00:00:01:09.100 1762== 2,808 bytes in 117 blocks are definitely lost in loss record 960 of 991
==00:00:01:09.100 1762==    at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==00:00:01:09.100 1762==    by 0x56C14A2: rb_malloc (rb_memory.h:41)
==00:00:01:09.100 1762==    by 0x56C177C: rb_bh_alloc (balloc.c:189)
==00:00:01:09.100 1762==    by 0x56CA0A9: rb_make_rb_dlink_node (tools.c:65)
==00:00:01:09.100 1762==    by 0x4E52D85: cache_file (cache.c:146)
==00:00:01:09.100 1762==    by 0x4E5337A: load_help (cache.c:301)
==00:00:01:09.100 1762==    by 0x4E698AA: charybdis_main (ircd.c:848)
==00:00:01:09.100 1762==    by 0x400815: main (main.c:8)

==00:00:01:09.100 1762== 5,328 (5,304 direct, 24 indirect) bytes in 221 blocks are definitely lost in loss record 971 of 991
==00:00:01:09.100 1762==    at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==00:00:01:09.100 1762==    by 0x56C14A2: rb_malloc (rb_memory.h:41)
==00:00:01:09.100 1762==    by 0x56C177C: rb_bh_alloc (balloc.c:189)
==00:00:01:09.100 1762==    by 0x56CA0A9: rb_make_rb_dlink_node (tools.c:65)
==00:00:01:09.100 1762==    by 0x4E52D85: cache_file (cache.c:146)
==00:00:01:09.100 1762==    by 0x4E53278: load_help (cache.c:266)
==00:00:01:09.100 1762==    by 0x4E698AA: charybdis_main (ircd.c:848)
==00:00:01:09.100 1762==    by 0x400815: main (main.c:8)

7 years agofree server_p->certfp, allocated in newconf.c
Simon Arlott [Sun, 30 Oct 2016 11:45:56 +0000 (11:45 +0000)] 
free server_p->certfp, allocated in newconf.c

==01:17:20:36.920 5966== 429 bytes in 3 blocks are possibly lost in loss record 899 of 1,020
==01:17:20:36.920 5966==    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==01:17:20:36.920 5966==    by 0x4E73867: rb_strdup (rb_memory.h:70)
==01:17:20:36.920 5966==    by 0x4E7674C: conf_set_connect_fingerprint (newconf.c:1421)
==01:17:20:36.920 5966==    by 0x4E78D55: conf_call_set (newconf.c:2562)
==01:17:20:36.920 5966==    by 0x4E6A33D: yyparse (ircd_parser.y:215)
==01:17:20:36.920 5966==    by 0x4E7FFC7: read_conf (s_conf.c:834)
==01:17:20:36.920 5966==    by 0x4E81718: read_conf_files (s_conf.c:1419)
==01:17:20:36.920 5966==    by 0x4E69567: charybdis_main (ircd.c:775)
==01:17:20:36.920 5966==    by 0x400815: main (main.c:8)

7 years agofree localClient->cipher_string, allocated in sslproc.c
Simon Arlott [Sun, 30 Oct 2016 11:21:02 +0000 (11:21 +0000)] 
free localClient->cipher_string, allocated in sslproc.c

==01:17:20:36.919 5966== 280 bytes in 8 blocks are definitely lost in loss record 876 of 1,020
==01:17:20:36.919 5966==    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==01:17:20:36.919 5966==    by 0x4E93F4F: rb_strdup (rb_memory.h:70)
==01:17:20:36.919 5966==    by 0x4E95280: ssl_process_cipher_string (sslproc.c:476)
==01:17:20:36.919 5966==    by 0x4E95540: ssl_process_cmd_recv (sslproc.c:561)
==01:17:20:36.919 5966==    by 0x4E9582A: ssl_read_ctl (sslproc.c:632)
==01:17:20:36.919 5966==    by 0x56CBAB6: rb_select_epoll (epoll.c:199)
==01:17:20:36.919 5966==    by 0x56C4EB5: rb_select (commio.c:2085)
==01:17:20:36.919 5966==    by 0x56C7FD6: rb_lib_loop (rb_lib.c:228)
==01:17:20:36.919 5966==    by 0x4E69987: charybdis_main (ircd.c:872)
==01:17:20:36.919 5966==    by 0x400815: main (main.c:8)

7 years agofree localClient->zipstats, allocated in sslproc.c
Simon Arlott [Sun, 30 Oct 2016 11:17:41 +0000 (11:17 +0000)] 
free localClient->zipstats, allocated in sslproc.c

==01:17:20:36.906 5966== 48 bytes in 1 blocks are definitely lost in loss record 544 of 1,020
==01:17:20:36.906 5966==    at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==01:17:20:36.906 5966==    by 0x4E93F0C: rb_malloc (rb_memory.h:41)
==01:17:20:36.906 5966==    by 0x4E961E8: start_zlib_session (sslproc.c:901)
==01:17:20:36.906 5966==    by 0x4E86FAC: server_estab (s_serv.c:877)
==01:17:20:36.906 5966==    by 0x13B2921A: mr_server (m_server.c:304)
==01:17:20:36.906 5966==    by 0x4E7AF03: handle_command (parse.c:241)
==01:17:20:36.906 5966==    by 0x4E7A96A: parse (parse.c:157)
==01:17:20:36.906 5966==    by 0x4E7A3DC: client_dopacket (packet.c:354)
==01:17:20:36.906 5966==    by 0x4E798D6: parse_client_queued (packet.c:98)
==01:17:20:36.906 5966==    by 0x4E79FAC: read_packet (packet.c:282)
==01:17:20:36.906 5966==    by 0x56CBAB6: rb_select_epoll (epoll.c:199)
==01:17:20:36.906 5966==    by 0x56C4EB5: rb_select (commio.c:2085)

7 years agocppcheck: fix various warnings/errors
Simon Arlott [Fri, 28 Oct 2016 18:23:21 +0000 (19:23 +0100)] 
cppcheck: fix various warnings/errors

[ircd/match.c:316]: (error) Shifting a negative value is undefined behaviour
[librb/src/patricia.c:55]: (error) Shifting a negative value is undefined behaviour
[modules/m_alias.c:64]: (portability) '(void*)message' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined.
[modules/m_time.c:111]: (warning) %u in format string (no. 9) requires 'unsigned int' but the argument type is 'signed int'.
[modules/m_time.c:111]: (warning) %u in format string (no. 10) requires 'unsigned int' but the argument type is 'signed int'.
[librb/src/dictionary.c:819]: (warning) %d in format string (no. 3) requires 'int' but the argument type is 'unsigned int'.
[librb/src/radixtree.c:1080]: (warning) %d in format string (no. 3) requires 'int' but the argument type is 'unsigned int'.
[ircd/s_user.c:351] -> [ircd/s_user.c:357]: (warning) Either the condition '0!=source_p' is redundant or there is possible null pointer dereference: source_p.
[extensions/ip_cloaking_3.0.c:109]: (warning, inconclusive) The buffer 'buf' may not be null-terminated after the call to strncpy().
[ircd/chmode.c:256]: (style) Clarify calculation precedence for '&' and '?'.
[modules/m_help.c:100]: (style) Clarify calculation precedence for '&' and '?'.
[modules/m_knock.c:169]: (style) Clarify calculation precedence for '&' and '?'.
[modules/m_stats.c:628]: (style) Clarify calculation precedence for '&' and '?'.
[modules/m_stats.c:727]: (style) Clarify calculation precedence for '&' and '?'.
[librb/src/radixtree.c:601]: (style) Clarify calculation precedence for '&' and '?'.
[librb/src/radixtree.c:704]: (style) Clarify calculation precedence for '&' and '?'.
[librb/src/radixtree.c:739]: (style) Clarify calculation precedence for '&' and '?'.
[librb/src/radixtree.c:763]: (style) Clarify calculation precedence for '&' and '?'.
[librb/src/radixtree.c:768]: (style) Clarify calculation precedence for '&' and '?'.
[librb/src/radixtree.c:774]: (style) Clarify calculation precedence for '&' and '?'.
[librb/src/radixtree.c:781]: (style) Clarify calculation precedence for '&' and '?'.
[librb/src/radixtree.c:786]: (style) Clarify calculation precedence for '&' and '?'.
[librb/src/radixtree.c:791]: (style) Clarify calculation precedence for '&' and '?'.
[librb/src/radixtree.c:804]: (style) Clarify calculation precedence for '&' and '?'.
[ircd/wsproc.c:372]: (style) Unused variable: len
[modules/core/m_modules.c:382]: (style) Unused variable: i
[modules/m_stats.c:741]: (style) Unused variable: amsg
[ircd/authproc.c:390]: (style) Unused variable: iter
[ircd/authproc.c:391]: (style) Unused variable: client_p

7 years agoauthproc: don't allow authd to write too many parameters to parv array
Simon Arlott [Sat, 22 Oct 2016 21:42:22 +0000 (22:42 +0100)] 
authproc: don't allow authd to write too many parameters to parv array

7 years agomsgbuf_parse: rb_string_to_array outputs to a MAXPARA+1 size array
Simon Arlott [Sat, 22 Oct 2016 21:37:35 +0000 (22:37 +0100)] 
msgbuf_parse: rb_string_to_array outputs to a MAXPARA+1 size array

7 years agorb_string_to_array: document parv array size
Simon Arlott [Sat, 22 Oct 2016 21:36:47 +0000 (22:36 +0100)] 
rb_string_to_array: document parv array size

7 years agoOpenSSL: Adjust ciphersuite order and update documentation
Aaron Jones [Tue, 18 Oct 2016 11:17:41 +0000 (11:17 +0000)] 
OpenSSL: Adjust ciphersuite order and update documentation

7 years agoMbedTLS: Adjust ciphersuite order and update documentation
Aaron Jones [Tue, 18 Oct 2016 11:16:38 +0000 (11:16 +0000)] 
MbedTLS: Adjust ciphersuite order and update documentation

7 years agoREADME: Fix location of channel
Aaron Jones [Sat, 15 Oct 2016 12:50:47 +0000 (12:50 +0000)] 
README: Fix location of channel

7 years agoSASL: Relax rate limiting for failures a little
Aaron Jones [Sun, 2 Oct 2016 14:13:02 +0000 (14:13 +0000)] 
SASL: Relax rate limiting for failures a little

Begin at 8 seconds after 2 failures and up to ~4 minutes

7 years agoMerge pull request #221 from Xenthys/release/4
Aaron Jones [Sun, 2 Oct 2016 10:02:02 +0000 (10:02 +0000)] 
Merge pull request #221 from Xenthys/release/4

Added kick immunity to umode +p (oper-override)

7 years agoMerge pull request #222 from Xenthys/release/4+sasl
Aaron Jones [Sun, 2 Oct 2016 09:50:57 +0000 (09:50 +0000)] 
Merge pull request #222 from Xenthys/release/4+sasl

SASL: rate-limit after the 2nd failed attempt (m_sasl.c)

7 years agoSASL: rate-limit after the 2nd failed attempt (m_sasl.c)
Xenthys [Sun, 2 Oct 2016 01:57:11 +0000 (03:57 +0200)] 
SASL: rate-limit after the 2nd failed attempt (m_sasl.c)

7 years agoAdded kick immunity to umode +p (oper-override)
Xenthys [Wed, 28 Sep 2016 22:34:53 +0000 (00:34 +0200)] 
Added kick immunity to umode +p (oper-override)

7 years agowhois: check target is an oper before assuming they have a privset
Aaron Jones [Tue, 20 Sep 2016 13:46:33 +0000 (13:46 +0000)] 
whois: check target is an oper before assuming they have a privset

The CHALLENGE functionality will set opername but not privset --
if an oper performs a WHOIS on someone currently half-way through
a challenge we will perform a NULL dereference.

Related to ircd-seven commit d7b05f7583babf6

7 years agohelpops: add duplication guards on helper/dehelper state changes
William Pitcock [Sun, 18 Sep 2016 22:11:00 +0000 (17:11 -0500)] 
helpops: add duplication guards on helper/dehelper state changes

7 years agoGNUTLS: Forward-port release/3.5 improvements
Aaron Jones [Sat, 17 Sep 2016 17:53:01 +0000 (17:53 +0000)] 
GNUTLS: Forward-port release/3.5 improvements

The changes made in this file are detailed in release/3.5 commits
4d89c83c324605b through ecfdcb08e8c2bdd inclusive.

Some slight alterations are necessary; librb instead of libratbox,
snprintf() instead of rb_snprintf(), etc. Also, release/4 has
offline certificate digesting functionality. For more insight,
simply diff the gnutls.c between release/3.5 and release/4.

7 years agoMbedTLS: Forward-port release/3.5 improvements
Aaron Jones [Sat, 17 Sep 2016 17:19:31 +0000 (17:19 +0000)] 
MbedTLS: Forward-port release/3.5 improvements

The changes made in this file are detailed in release/3.5 commits
295c8f7d37bb557 through 265dc4e53c0b24e inclusive.

Some slight alterations are necessary; librb instead of libratbox,
snprintf() instead of rb_snprintf(), etc. Also, release/4 has
offline certificate digesting functionality. For more insight,
simply diff the mbedtls.c between release/3.5 and release/4.

7 years agoOpenSSL: Forward-port release/3.5 improvements
Aaron Jones [Sat, 17 Sep 2016 17:03:21 +0000 (17:03 +0000)] 
OpenSSL: Forward-port release/3.5 improvements

The changes made in this file are detailed in release/3.5 commits
1f30c8943bf2ca3 through 92c04c6b9dbdd11 inclusive.

Some slight alterations are necessary; librb instead of libratbox,
snprintf() instead of rb_snprintf(), etc. Also, release/4 has
offline certificate digesting functionality. For more insight,
simply diff the openssl.c between release/3.5 and release/4.

7 years agoircd: introduce 'no-export' links
William Pitcock [Fri, 16 Sep 2016 22:18:55 +0000 (17:18 -0500)] 
ircd: introduce 'no-export' links

Links that are 'no-export' are not distributed to the rest of the IRC network (including local peers).
This provides a core primitive for 'anycasting' services (but the actual issue of synchronizing data in
a services package is left to the authors of the services package).

7 years agohelpops: fix up graph cleanup for helpers_list
William Pitcock [Fri, 16 Sep 2016 22:02:50 +0000 (17:02 -0500)] 
helpops: fix up graph cleanup for helpers_list

7 years agoextensions/chantype_dummy: ^ is a valid nickchar, but > isn't
William Pitcock [Fri, 16 Sep 2016 19:12:29 +0000 (14:12 -0500)] 
extensions/chantype_dummy: ^ is a valid nickchar, but > isn't

7 years agoNEWS: document new CHANTYPES api
William Pitcock [Fri, 16 Sep 2016 19:08:04 +0000 (14:08 -0500)] 
NEWS: document new CHANTYPES api

7 years agoextensions/chantype_dummy: cleanups
William Pitcock [Fri, 16 Sep 2016 19:07:54 +0000 (14:07 -0500)] 
extensions/chantype_dummy: cleanups

7 years agochannels: fix IsChannelName() to actually use IsChanPrefix().
William Pitcock [Fri, 16 Sep 2016 19:02:41 +0000 (14:02 -0500)] 
channels: fix IsChannelName() to actually use IsChanPrefix().

7 years agosupported: fix up CHANTYPES
William Pitcock [Fri, 16 Sep 2016 19:00:00 +0000 (14:00 -0500)] 
supported: fix up CHANTYPES

7 years agoextensions: add new module adding ^channels (which are just like #channels)
William Pitcock [Fri, 16 Sep 2016 18:55:44 +0000 (13:55 -0500)] 
extensions: add new module adding ^channels (which are just like #channels)

7 years agosupported: add chantypes_update()
William Pitcock [Fri, 16 Sep 2016 18:49:02 +0000 (13:49 -0500)] 
supported: add chantypes_update()

7 years agomatch: allow the CharAttrs table to be modified at runtime
William Pitcock [Fri, 16 Sep 2016 18:09:44 +0000 (13:09 -0500)] 
match: allow the CharAttrs table to be modified at runtime

7 years agohelpops: MyClient() check is wrong, we only care if it is a Person or a Server
William Pitcock [Fri, 16 Sep 2016 17:57:34 +0000 (12:57 -0500)] 
helpops: MyClient() check is wrong, we only care if it is a Person or a Server

7 years agohelpops: handle cleaning up remote opers from the helpops list
William Pitcock [Fri, 16 Sep 2016 17:56:18 +0000 (12:56 -0500)] 
helpops: handle cleaning up remote opers from the helpops list

7 years agoMerge pull request #217 from Xenthys/release/4
William Pitcock [Fri, 16 Sep 2016 05:06:40 +0000 (22:06 -0700)] 
Merge pull request #217 from Xenthys/release/4

m_grant.c - fixed remote grant support

7 years agoAdd hooks for local and remote nick changes
Stephen Bennett [Sun, 9 Nov 2008 18:54:00 +0000 (18:54 +0000)] 
Add hooks for local and remote nick changes

7 years agomsgbuf: Fix remote crash vulnerability due to malformed message tag.
Aaron Jones [Sun, 11 Sep 2016 10:33:19 +0000 (10:33 +0000)] 
msgbuf: Fix remote crash vulnerability due to malformed message tag.

Fixes #218

Reported-by: ManiacTwister <redacted>
7 years agom_grant.c - fixed remote grant support
Xenthys [Sat, 10 Sep 2016 15:54:13 +0000 (17:54 +0200)] 
m_grant.c - fixed remote grant support

7 years agoMbedTLS: Misc backend cleanups
Aaron Jones [Sat, 10 Sep 2016 08:51:09 +0000 (08:51 +0000)] 
MbedTLS: Misc backend cleanups

This is a forward-port of release/3.5 commit 566f4678

* Add generic direction enum for negotiation setup.

* Rename a rather long wrapper function to a shorter one consistent with
  what it does.

* Rework context setup function.

* Don't check for handshake state before beginning handshaking.

  The old backend began a handshake and then stepped into the callback
  function if it was interrupted; the current one just jumps right into
  it, so there is no need to check if it has previously succeeded,
  because it hasn't been attempted yet.

* Add missing errno assignment to one of the handshake wrappers.

* Don't bother checking if SSL_P(F) is NULL when we already checked if
  F->ssl is NULL -- this should be impossible.

* Don't bother checking if SSL_C(F) is NULL -- this was a no-op.

* Change the socket send and recv functions to not peer into a foreign
  ratbox structure -- use the correct function to get the socket fd.

* Rewrap some lines and function arguments.

Other backends will be brought into line with this backend soon.

This will enable easier maintenance of the backends, by reducing the
diffs between them, which should make different behaviour easier to
spot.

7 years agoMbedTLS: Treat 0 bytes read/written to socket properly
Aaron Jones [Fri, 9 Sep 2016 01:46:20 +0000 (01:46 +0000)] 
MbedTLS: Treat 0 bytes read/written to socket properly

At the moment, if a link quits in just the right (wrong [1]) way,
the quit reason will resemble:

    <-- foo (~bar@baz) has quit (Read error: (-0x0) )

This should resolve that.

[1] Peers should send a close_notify alert before abruptly shutting
    down their socket. This will result in a sane quit message:

    <-- foo (~bar@baz) has quit (Read error: (-0x7880) SSL -
    The peer notified us that the connection is going to be closed)

[ci skip]

7 years agoMbedTLS: Initial attempt to port release/3.5 commit 89d4c468 to this branch
Aaron Jones [Sun, 4 Sep 2016 03:50:29 +0000 (03:50 +0000)] 
MbedTLS: Initial attempt to port release/3.5 commit 89d4c468 to this branch

7 years agoSASL: Disallow beginning : and space anywhere in AUTHENTICATE parameter
Aaron Jones [Sat, 3 Sep 2016 17:29:53 +0000 (17:29 +0000)] 
SASL: Disallow beginning : and space anywhere in AUTHENTICATE parameter

This is a FIX FOR A SECURITY VULNERABILITY. All Charybdis users must
apply this fix if you support SASL on your servers, or unload m_sasl.so
in the meantime.

7 years agoircd: serv_connect: initialise sa_connect/sa_bind to AF_UNSPEC
Simon Arlott [Sat, 3 Sep 2016 13:50:59 +0000 (14:50 +0100)] 
ircd: serv_connect: initialise sa_connect/sa_bind to AF_UNSPEC

These are read to check if they're AF_UNSPEC (unset) but they aren't
initialised.

7 years agolibrb: set sockaddr port to 0 in success path
Simon Arlott [Sat, 3 Sep 2016 13:36:17 +0000 (14:36 +0100)] 
librb: set sockaddr port to 0 in success path

Instead of only in the failure path, which causes
all sorts of annoying server connection failures
when we try to repeatedly reuse the same port.

7 years agoOpenSSL: Initialise if LibreSSL
Aaron Jones [Thu, 1 Sep 2016 19:29:47 +0000 (19:29 +0000)] 
OpenSSL: Initialise if LibreSSL

LibreSSL's definition of OPENSSL_VERSION_NUMBER bites us in the ass,
*again*.

7 years agoOpenSSL: Initialise one context at a time
Aaron Jones [Tue, 30 Aug 2016 10:30:17 +0000 (10:30 +0000)] 
OpenSSL: Initialise one context at a time

If initialising the server context fails, but the client one succeeds,
we will not only leak memory, but the error message reported for
initialising the server context might not make sense, because we
initialise the client context after and that could erase or change the
list of queued errors.

This scenario is considered rare. Nevertheless, we now initialise the
client context after *successfully* initialising the server context.

7 years agoPrint initialisation notice before forking
Aaron Jones [Wed, 24 Aug 2016 16:44:04 +0000 (16:44 +0000)] 
Print initialisation notice before forking

7 years agoircd: Fix umode orphan scheme.
Jason Volk [Wed, 24 Aug 2016 13:14:47 +0000 (06:14 -0700)] 
ircd: Fix umode orphan scheme.

Cherry-picked from jevolk/charybdis f5e7f335
Reformatted slightly.

7 years agostartup: fork before initialising the event subsystem
Aaron Jones [Sun, 21 Aug 2016 22:29:16 +0000 (22:29 +0000)] 
startup: fork before initialising the event subsystem

On FreeBSD 4.8, fork(2) doesn't actually behave like fork(2).

Namely, kqueue(2) descriptors are not inherited by the child.
IOW, we can't fork(2) after we get the kqueue(2) descriptor.

So we'll just have to rely on people to actually read the
server log file if they want to understand why their server
is dying during startup.

7 years agoAttempt to open /dev/null before forking incase it would fail
Aaron Jones [Sun, 21 Aug 2016 00:32:34 +0000 (00:32 +0000)] 
Attempt to open /dev/null before forking incase it would fail

7 years agoAttempt #2 at fixing the file descriptor mess.
Aaron Jones [Sun, 21 Aug 2016 00:15:17 +0000 (00:15 +0000)] 
Attempt #2 at fixing the file descriptor mess.

This commit defers daemonisation to the end of initialisation
as that makes it vastly simpler to get this right.

7 years agoRevert "ircd startup: avoid black magic with file descriptors"
Aaron Jones [Sat, 20 Aug 2016 22:22:37 +0000 (22:22 +0000)] 
Revert "ircd startup: avoid black magic with file descriptors"

This reverts commit 27c0f6d8f406658655cc45a0a7f2d0a0f120244b.

A more extensive investigation and refactoring of the code is
necessary.

7 years agoircd startup: avoid black magic with file descriptors
Aaron Jones [Sat, 20 Aug 2016 21:14:53 +0000 (21:14 +0000)] 
ircd startup: avoid black magic with file descriptors

This *should* fix a reported but as yet unreproducable
ircd abort on restart.

7 years agoircd: Allow non-default CAP_MASK during server estab.
Jason Volk [Sat, 20 Aug 2016 11:10:28 +0000 (04:10 -0700)] 
ircd: Allow non-default CAP_MASK during server estab.

7 years agoTLS Backends: Harmomise the rb_ssl_get_cipher() function
Aaron Jones [Sat, 20 Aug 2016 03:16:33 +0000 (04:16 +0100)] 
TLS Backends: Harmomise the rb_ssl_get_cipher() function

The GNUTLS backend reports the version in use for the client as well
as its ciphersuite -- do the same for the other 2 backends.

7 years agoGNUTLS: Avoid null dereference in constructing ciphersuite
Aaron Jones [Fri, 19 Aug 2016 20:26:43 +0000 (20:26 +0000)] 
GNUTLS: Avoid null dereference in constructing ciphersuite

7 years agoGNUTLS: Cleanup fingerprint generation
Aaron Jones [Fri, 19 Aug 2016 19:14:40 +0000 (19:14 +0000)] 
GNUTLS: Cleanup fingerprint generation

Removes intermediate buffer, properly check return values

7 years agoREADME: Clarify that OpenSSL is not required for ECDHE
Aaron Jones [Mon, 15 Aug 2016 10:50:59 +0000 (10:50 +0000)] 
README: Clarify that OpenSSL is not required for ECDHE

7 years agomkpasswd: use urandom for salts, cleanup
Aaron Jones [Mon, 15 Aug 2016 09:50:53 +0000 (09:50 +0000)] 
mkpasswd: use urandom for salts, cleanup

Using /dev/random for salt generation is pointless -- it can block, and
any extra randomness it would provide (which is debatable) is not needed,
as salts only need to be unique, not unpredictable.

7 years agoopenssl: Avoid use-after-free when rehashing fails to load new files
Aaron Jones [Fri, 12 Aug 2016 13:34:13 +0000 (13:34 +0000)] 
openssl: Avoid use-after-free when rehashing fails to load new files

Commit cf12678 introduced a fix for issue #186 by freeing the old SSL_CTX
structure before constructing a new one, which could disconnect existing
clients otherwise.

Unfortunately, the freeing is done first, which means that if setting up
a new structure fails for any reason, there will be no usable structures
left, but they are still referenced.

This fix moves the freeing to the end of the function, using intermediate
new variables in the meantime. This problem was discovered while testing
against OpenSSL 1.1.0 RC6.

7 years agocharybdis 4-rc3.
William Pitcock [Sat, 6 Aug 2016 04:38:34 +0000 (23:38 -0500)] 
charybdis 4-rc3.

7 years agom_grant: convert jevolk's rewritten version to AV2
William Pitcock [Sat, 6 Aug 2016 04:37:05 +0000 (23:37 -0500)] 
m_grant: convert jevolk's rewritten version to AV2

7 years agoMerge pull request #207 from charybdis-ircd/jevolk-patch-1
William Pitcock [Sat, 6 Aug 2016 04:07:00 +0000 (23:07 -0500)] 
Merge pull request #207 from charybdis-ircd/jevolk-patch-1

authd: Fix use after reference count decrement.

7 years agoauthd: Fix use after reference count decrement.
Jason Volk [Fri, 5 Aug 2016 19:08:16 +0000 (13:08 -0600)] 
authd: Fix use after reference count decrement.

7 years agoMerge pull request #205 from jevolk/release/4
William Pitcock [Wed, 27 Jul 2016 07:34:38 +0000 (02:34 -0500)] 
Merge pull request #205 from jevolk/release/4

m_grant: rewrite.

7 years agom_grant: rewrite.
Jason Volk [Wed, 27 Jul 2016 05:40:26 +0000 (22:40 -0700)] 
m_grant: rewrite.

7 years agoircd: Fix missing operhash reference decrement from b02a913b.
Jason Volk [Tue, 19 Jul 2016 22:59:35 +0000 (15:59 -0700)] 
ircd: Fix missing operhash reference decrement from b02a913b.

7 years agoFix erroneous return value.
Jason Volk [Sat, 16 Jul 2016 18:26:38 +0000 (11:26 -0700)] 
Fix erroneous return value.

7 years agoreference.conf: Document fingerprint generation
Aaron Jones [Sat, 16 Jul 2016 05:41:49 +0000 (05:41 +0000)] 
reference.conf: Document fingerprint generation

[ci skip]

8 years agoFix stupid compiler errors by my stupidity and tiredness
Elizabeth Myers [Tue, 28 Jun 2016 00:14:32 +0000 (19:14 -0500)] 
Fix stupid compiler errors by my stupidity and tiredness

8 years agoblacklist: add blacklist_cancel_none
Elizabeth Myers [Tue, 28 Jun 2016 00:06:49 +0000 (19:06 -0500)] 
blacklist: add blacklist_cancel_none

8 years agoblacklist: add return statement. d'oh.
Elizabeth Myers [Tue, 28 Jun 2016 00:00:00 +0000 (19:00 -0500)] 
blacklist: add return statement. d'oh.

8 years agoblacklist: fix precedence lossage
Elizabeth Myers [Mon, 27 Jun 2016 23:59:53 +0000 (18:59 -0500)] 
blacklist: fix precedence lossage

8 years agoblacklist: if no blacklists were checked, properly terminate query.
Elizabeth Myers [Mon, 27 Jun 2016 23:56:14 +0000 (18:56 -0500)] 
blacklist: if no blacklists were checked, properly terminate query.

8 years agobuild_rdns: minor cleanup
Elizabeth Myers [Mon, 27 Jun 2016 23:37:46 +0000 (18:37 -0500)] 
build_rdns: minor cleanup

8 years agoblacklist: tweak message for timeout
Elizabeth Myers [Mon, 27 Jun 2016 23:28:02 +0000 (18:28 -0500)] 
blacklist: tweak message for timeout

8 years agoblacklist: give different messages for cancellation and timeout
Elizabeth Myers [Mon, 27 Jun 2016 23:24:39 +0000 (18:24 -0500)] 
blacklist: give different messages for cancellation and timeout

8 years agocharybdis 4-rc2.
William Pitcock [Sun, 26 Jun 2016 03:10:41 +0000 (22:10 -0500)] 
charybdis 4-rc2.

8 years agoMerge branch 'master' into release/4
William Pitcock [Sat, 25 Jun 2016 19:27:44 +0000 (14:27 -0500)] 
Merge branch 'master' into release/4

8 years agoFix bug. Note: The second hunk is just an assumption. It's not called from anywhere.
Jason Volk [Sat, 25 Jun 2016 02:29:02 +0000 (19:29 -0700)] 
Fix bug. Note: The second hunk is just an assumption. It's not called from anywhere.

8 years agoMerge pull request #196 from jevolk/master
William Pitcock [Wed, 22 Jun 2016 01:00:01 +0000 (20:00 -0500)] 
Merge pull request #196 from jevolk/master

I typed MODRESTART by accident

8 years agoCore modules cannot be unloaded, otherwise bad things happen.
Jason Volk [Wed, 22 Jun 2016 00:39:44 +0000 (17:39 -0700)] 
Core modules cannot be unloaded, otherwise bad things happen.
Additionally some information is logged and passed to the operator
conducting a MODRESTART.

8 years agoircd: Fix capability entry name string ownership.
Jason Volk [Wed, 22 Jun 2016 00:32:28 +0000 (17:32 -0700)] 
ircd: Fix capability entry name string ownership.
The entry->cap must be copied and exclusive to the entry for the
cap to be orphaned, even if literals are expected. Because modules.

8 years agocharybdis 4-rc1.
William Pitcock [Mon, 20 Jun 2016 03:44:47 +0000 (22:44 -0500)] 
charybdis 4-rc1.