Commit graph

596 commits

Author SHA1 Message Date
Aaron Jones 41390bfe5f
When a remote MODRESTART command is received, it will pass through the
ENCAP module. The ms_encap function is responsible for dispatching the
command handler and then the modules will eventually be reloaded.

However, if the ENCAP module is reloaded to a different address, the
stack now contains the address of a function that no longer exists.

Also, in this version of the IRCd, the module restarting functionality
was located in a function that is itself located in a module, so things
will also go badly if that module is reloaded to a different address,
too.

Return immediately from the command handler and have the event loop
call the function responsible for reloading the modules instead.

c.f. release/3.5 commit db05a3621058

Reported-by: mniip (Freenode)
2016-12-28 22:08:14 +00:00
Simon Arlott 57dd2c6a89
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.
2016-12-04 19:41:08 +00:00
Simon Arlott 6396c5da07
fix privmsg/notice send functions to use variable argument lists properly 2016-12-04 19:41:07 +00:00
Simon Arlott e2d5ffd5dd
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.
2016-11-23 21:59:43 +00:00
Simon Arlott 2d8d5b058b
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.
2016-11-23 21:14:44 +00:00
Simon Arlott f41f79971c
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.
2016-11-20 21:41:18 +00:00
Simon Arlott 50b1e5987c
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).
2016-11-20 21:09:07 +00:00
Simon Arlott 4ce7eaefd4
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)
2016-10-30 12:05:45 +00:00
Simon Arlott 1c4f9748d7
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)
2016-10-30 11:45:56 +00:00
Simon Arlott c8641a273f
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)
2016-10-30 11:21:45 +00:00
Simon Arlott 76f3591a2d
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)
2016-10-30 11:20:31 +00:00
Simon Arlott d8f0b5d763
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
2016-10-28 20:13:36 +01:00
Simon Arlott 3608f31d39
authproc: don't allow authd to write too many parameters to parv array 2016-10-22 22:42:22 +01:00
Simon Arlott 3656fa83a9
msgbuf_parse: rb_string_to_array outputs to a MAXPARA+1 size array 2016-10-22 22:38:07 +01:00
William Pitcock 087555a00f 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).
2016-09-16 17:18:55 -05:00
William Pitcock 6e86cdd6d6 supported: fix up CHANTYPES 2016-09-16 14:00:00 -05:00
William Pitcock 01978a2c8c supported: add chantypes_update() 2016-09-16 13:49:02 -05:00
William Pitcock f3b84221d0 match: allow the CharAttrs table to be modified at runtime 2016-09-16 13:09:44 -05:00
Aaron Jones 6d16f66be6
msgbuf: Fix remote crash vulnerability due to malformed message tag.
Fixes #218

Reported-by: ManiacTwister <github@s7t.de>
2016-09-11 10:35:13 +00:00
Simon Arlott 86e1de17f3
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.
2016-09-03 14:52:48 +01:00
Aaron Jones 0942c1fc26
Print initialisation notice before forking 2016-08-24 16:44:04 +00:00
Jason Volk c1fc044c35
ircd: Fix umode orphan scheme.
Cherry-picked from jevolk/charybdis f5e7f335
Reformatted slightly.
2016-08-24 16:12:05 +00:00
Aaron Jones f4e9d91580
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.
2016-08-21 22:29:16 +00:00
Aaron Jones 0c23c0b1c5
Attempt to open /dev/null before forking incase it would fail 2016-08-21 00:32:34 +00:00
Aaron Jones 0c433865d3
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.
2016-08-21 00:15:17 +00:00
Aaron Jones ef24ede3e2
Revert "ircd startup: avoid black magic with file descriptors"
This reverts commit 27c0f6d8f4.

A more extensive investigation and refactoring of the code is
necessary.
2016-08-20 22:22:37 +00:00
Aaron Jones 27c0f6d8f4
ircd startup: avoid black magic with file descriptors
This *should* fix a reported but as yet unreproducable
ircd abort on restart.
2016-08-20 21:14:53 +00:00
Jason Volk ffedad8dfb ircd: Allow non-default CAP_MASK during server estab. 2016-08-20 04:10:28 -07:00
Jason Volk 4cc889ae17
ircd: Fix missing operhash reference decrement from b02a913b. 2016-07-19 23:24:33 +00:00
Jason Volk e4a7cf9f50 Fix erroneous return value. 2016-07-16 11:26:38 -07:00
Jason Volk 12de082e2c Fix bug. Note: The second hunk is just an assumption. It's not called from anywhere. 2016-06-25 14:27:32 -05:00
Jason Volk b5cfad0319 Core modules cannot be unloaded, otherwise bad things happen.
Additionally some information is logged and passed to the operator
conducting a MODRESTART.
2016-06-21 17:42:36 -07:00
Jason Volk 94afbe9c8e 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.
2016-06-21 17:32:28 -07:00
William Pitcock 94555087a1 ircd: relocate_paths() back on windows only now 2016-06-18 01:05:38 -05:00
William Pitcock 1e37cb443d conf_parser: warning fixes 2016-06-18 00:52:54 -05:00
William Pitcock e55a9d6abc modules: serious cleanups 2016-06-18 00:52:16 -05:00
William Pitcock 92dad4831d modules: cleanups 2016-06-18 00:38:40 -05:00
William Pitcock 73b70ae846 ircd: fix compile of relocate_paths() 2016-06-18 00:22:02 -05:00
William Pitcock 7145720468 ircd: make relocate_paths() available always 2016-06-18 00:21:39 -05:00
William Pitcock c51b77a312 ircd: call relocate_paths() in all cases 2016-06-18 00:20:59 -05:00
William Pitcock e0e0c41524 ircd: print runtime path configuration 2016-06-17 23:36:47 -05:00
Aaron Jones ab9088ad2e
wsproc: compile out dead code
Investigation is required to determine if this function should
actually be used
2016-06-01 20:54:12 +00:00
Aaron Jones 0b91afb2e1
ircd_signal: a function that tailcalls a noreturn function should be marked noreturn 2016-06-01 20:54:12 +00:00
Aaron Jones df3db5d99b
ircd: functions that call exit(3) should be marked noreturn 2016-06-01 20:54:12 +00:00
Aaron Jones b1cfd3922c
dns: make function used only within this unit static 2016-06-01 20:54:12 +00:00
Aaron Jones 4decc628bd
class: remove unused macros 2016-06-01 20:54:12 +00:00
Aaron Jones ce2c092b49
chmode: remove unreachable break statement 2016-06-01 20:54:12 +00:00
Aaron Jones bca336720e
chmode: silence harmless uninitialised variable warning 2016-06-01 20:54:12 +00:00
Aaron Jones ec5522a1ca
channel: silence harmless uninitialised variable warning 2016-06-01 20:54:12 +00:00
Aaron Jones 2ec9f59588
bandbi: a function that calls exit(3) should be marked noreturn 2016-06-01 20:54:11 +00:00
Aaron Jones 5cbd46a893
authproc: don't shadow variable decls, avoid reserved name 2016-06-01 20:54:11 +00:00
Aaron Jones 0982871a99
strcpy: mass-migrate to strlcpy where appropriate 2016-05-15 03:58:44 +00:00
Aaron Jones d539f22782
ircd_lexer: fix another crash with the same cause 2016-05-15 00:57:16 +00:00
Aaron Jones 401cb2bb17
ircd_lexer: fix crash with very large config option strings 2016-05-15 00:00:23 +00:00
Aaron Jones b143df9ac4
minor spring cleaning: remove/relocate duplicate/unused includes & macros
[ci skip]
2016-05-14 23:29:33 +00:00
William Pitcock dcf450702b newconf: ensure wsock and defer_accept are default-to-disable for now, for consistency sake on rehashes 2016-05-14 17:23:51 -05:00
Simon Arlott d2a4981ab2
client: call authd_abort_client with the client that is exiting, not the originator 2016-05-12 10:06:31 +01:00
Aaron Jones f5960b830b
[sslproc] Use certificate file if key file is not present 2016-05-05 04:10:57 +00:00
Aaron Jones 4d83a4d92d
[sslproc] Allow absense of private key file
Backends can then assume that the private key is in the certificate file
2016-05-05 03:47:18 +00:00
Simon Arlott da20854e83
random_ping: stop producing negative values that become 16 chars 2016-05-02 21:14:16 +01:00
Simon Arlott 3c5f720c6f
authd_check: don't try to update bl_stats if it doesn't exist
This can happen if all the blacklists are removed and then authd
sends a blacklisted response for a client.
2016-04-30 13:18:06 +01:00
Simon Arlott 4573f8f2fb
authproc: don't try to delete bl_stats if it hasn't been created 2016-04-30 13:11:06 +01:00
Elizabeth Myers e7c4ecd5b1
authproc: don't delete during iteration, this is not safe. 2016-04-30 01:11:56 -05:00
William Pitcock b5f3e5e5e8 ircd: Channel.bants is not a serial but a timestamp.
Previously, the IRCd would increment bants instead of resyncing the timestamp, causing the potential of
false negatives from the bancache system.
2016-04-29 18:59:32 -05:00
Aaron Jones fed4fc59bc
Mention another RFC with regard to deprecating plaintext 2016-04-29 16:28:18 +00:00
Simon Arlott 1cdf323be9
sslproc: don't send updated config to dead/shutdown sslds
They might be running older versions of the SSL library that
doesn't support the key type or ciphers being configured.
2016-04-29 07:35:43 +01:00
Simon Arlott 036cafaaaf
sslproc: reset ssld_wait/spin_count when explicitly requested to restart ssld 2016-04-28 22:25:36 +01:00
Simon Arlott f018ed844d
certfp: Move method name/prefix strings to a separate header file 2016-04-26 20:33:18 +01:00
Simon Arlott 5adde7a4ed
getopt: don't modify argv as it breaks restart() 2016-04-25 23:32:18 +01:00
Simon Arlott c173a8ad44
modules: use exit(EXIT_FAILURE) on failure
This will allow service process monitoring to recognise the difference
between a shutdown and an error of a -foreground ircd, because only
/DIE (or SIGINT) will exit with return code 0.
2016-04-25 22:27:57 +01:00
Simon Arlott 762468f85d
authd: wait until the ssl connection is "open" before reading
It's useful to allow authd to run in parallel with ssl negotiation,
but if the ssld connection has plaintext data ready for reading
there's a race condition between authd calling read_packet() and
ssl_process_certfp() storing the certificate fingerprint. This
scenario would be bad for a server connecting because fingerprint
verification will fail.

Allow either operation to complete first, but wait until
ssl_process_open_fd() calls the ssl open callback before calling
read_packet().
2016-04-25 21:43:21 +01:00
Simon Arlott 53789fddda
sslproc: simplify ssl open callback
Don't use the librb callback type as we're always passing client_p.

Provide a return value so that the connect handler can exit_client()
and the accept handler can opt to use the default dead handler.
2016-04-25 21:12:44 +01:00
Simon Arlott f61d096186
conf: require certificate fingerprint for SSL connections 2016-04-25 20:19:48 +01:00
Simon Arlott dc986b5468
sslproc: prefix SPKI certfp types to distinguish them from CERT 2016-04-25 20:12:27 +01:00
Simon Arlott 93ad89b232
sslproc: send the certftp method on rehash 2016-04-25 19:25:45 +01:00
Simon Arlott f7b0c4b3d8
sslproc: use global ServerInfo configuration
There's no need to pass information around that sslproc already has access
to, so use ServerInfo directly. Remove the extra NULL checks as these are
already performed before setting ircd_ssl_ok = true.
2016-04-25 19:20:45 +01:00
Simon Arlott 90fd6ede1b
sslproc: include ssl_cipher_list in length check before sending configuration to ssld 2016-04-25 19:12:47 +01:00
Simon Arlott 19d1853f71
ssld: remove init_prng command
This is no longer configurable so it's redundant.
2016-04-25 19:02:03 +01:00
Simon Arlott 8cbd70a8ed
ircd: don't send ERR_NOTREGISTERED to servers
Sending messages after SERVER but before zlib is established breaks
outgoing connections. If the other server is misbehaving then ignore
its messages.
2016-04-24 17:41:44 +01:00
Simon Arlott 5ad62c80ee
librb: remove socklen parameter from rb_connect_tcp 2016-04-24 17:11:20 +01:00
Simon Arlott d4214e9445
ircd: server connection configuration
Fix the server connection configuration so that it can simultaneously
handle a hostname/IPv4/IPv6 for connecting and a hostname/IPv4/IPv6
for binding. Maintains backwards compatibility for matching a hostname
with a mask.

Multiple host/vhost entries can be specified and the last value for
each address family is stored. Hostnames that resolve automatically
overwrite the IP address.

Server connections can now be made to either IPv4 or IPv6 at random
as well as preferring a specific address family.
2016-04-24 17:06:24 +01:00
Simon Arlott 65f43a4fc4
ircd: Don't try to connect to servers that we know have an invalid fingerprint
This just causes an unnecessary link/squit on the other server.
2016-04-24 11:49:21 +01:00
Simon Arlott 4fbb736202
ssld: add a callback when the connection is opened
This allows us to wait until we have the fingerprint information before
continuing with a server connect process.
2016-04-24 11:48:35 +01:00
Simon Arlott 5c317f1313
ircd: parse: add asserts for improper use of mod_add_cmd/mod_del_cmd 2016-04-23 23:56:41 +01:00
Simon Arlott e8de2bfaf0
modules: add missing break 2016-04-23 23:37:38 +01:00
Simon Arlott 558744e520
ircd: do nothing in client_release_connids if !MyConnect 2016-04-23 23:25:25 +01:00
Simon Arlott cc02bdf3a6
ircd: fix assert in client_release_connids
The connection may have already been closed and MyConnect cleared.

It's only a bug if the connection somehow has connids but is not
our connection.
2016-04-23 23:22:01 +01:00
Simon Arlott cf430c1a40
ssld: Add new certfp_methods spki_sha256 and spki_sha512
These operate on the SubjectPublicKeyInfo of the certificate, which does
change unless the private key is changed. This allows the fingerprint to
stay constant even if the certificate is reissued.

(The same fingerprint is also used by DANE)
2016-04-23 22:51:05 +01:00
Simon Arlott 0ae7a89d78
ircd: sslproc: certfp commands have a 9 byte header, not 5 bytes
SHA512 hashes were being ignored because the message was too large
2016-04-23 20:52:20 +01:00
William Pitcock c6098ed357 client: fix up client_release_connids() too, pointed out by lp0 2016-04-23 14:26:01 -05:00
William Pitcock 5c63bfe8b1 client: connid_get() should check MyConnect(), not MyClient(). 2016-04-23 14:17:36 -05:00
Simon Arlott 84e3e445aa
mr_server: Report certificate fingerprint mismatches
Log the received certificate fingerprint when it causes a server to be
rejected.
2016-04-23 17:37:05 +01:00
Simon Arlott e7c4cf63bc
authproc: set GOT_ID flag when an ident response is received 2016-04-23 15:41:27 +01:00
staticfox 1729f46eab
authd: Avoid negative array indices 2016-04-22 23:06:42 -04:00
Elizabeth Myers 7445ece1d1
Revert "Implement the netsplit batch type."
This needs more work, see
https://github.com/ircv3/ircv3-specifications/issues/253

This reverts commit 2373891299.
2016-04-16 11:05:00 -05:00
Elizabeth Myers 2373891299
Implement the netsplit batch type.
This also lays the groundwork for the netjoin batch type, but that isn't
implemented yet. I don't like how some of this is implemented but it'll
have to do for now...

Compile tested, needs more testing.
2016-04-15 16:50:43 -05:00
Elizabeth Myers 4f2b9a4fd1
Don't use key member of dictionary iter objects after deletion 2016-04-12 09:43:50 -05:00
Elizabeth Myers 9e5c31ea0d
authproc: fix a typo 2016-04-12 09:37:56 -05:00
Elizabeth Myers 5e9a3f8674
Change the way authd configures opm
It's a bit of a hack, but better than before. Rather than rehashing
(which could get us into an endless loop), we now segregate the
configuration phase (creating entries ircd-side in case we restart authd
later) and sending phases (when configure_authd() is called). Since we
have to call configure_authd() no matter what (to send timeouts etc.)
and we have to send this data to configure authd anyway, and sending
duplicate data is bad, this is the only way I can think of for now.
2016-04-12 09:36:09 -05:00
Elizabeth Myers ed5e1d1e41 send: trim a blank line [ci skip] 2016-04-11 11:52:01 -05:00
Elizabeth Myers 7a21fb5b34 s_user: clean up authd checks 2016-04-10 10:02:33 -05:00
Elizabeth Myers 2a104d6641 s_user: enhancements to proxy reporting messages 2016-04-10 09:35:02 -05:00
Elizabeth Myers d19aab3375 Fix stupid linux warning 2016-04-10 09:22:34 -05:00
Elizabeth Myers 154dc91ef0 Wrap up authd preclient stuff in its own struct 2016-04-10 09:20:51 -05:00
staticfox 02fa4362cd version.c.SH: Fix build
We need stddef.h mainly for NULL
2016-04-09 06:05:08 -04:00
Elizabeth Myers b14d2bd6ea Formatting fixes for credits
Contributed from jackal^, but fixed up a bit.
2016-04-09 04:55:57 -05:00
Elizabeth Myers 4eafa9e62f ipv4_from_ipv6: move to librb 2016-04-08 03:49:23 -05:00
Elizabeth Myers 66f7fe673b Get rid of flags2.
It seems to come from an era where long long didn't exist and 64-bit
machines weren't common. 32-bit machines are still common but I can't
imagine this will have much performance impact there.

This "fixes" #179 in title only, but see comments within.
2016-04-07 07:40:55 -05:00
Elizabeth Myers 9057170ce8 Cleanup defaults.h config file.
Clean up spaces/tabs mixing mess (bleh), add some defaults for authd
stuff, and get rid of CHARYBDIS_SOMAXCONN (just define SOMAXCONN if it's
available...).
2016-04-07 04:47:48 -05:00
Elizabeth Myers 0a87075b86 modules: fix up display names 2016-04-07 04:15:12 -05:00
Elizabeth Myers 78946542bb modules: move module loading/unloading commands to dedicated module.
There's no reason to really have these in the main ircd anymore, static
modules are dead and aren't coming back.

To ensure people don't do something hopelessly retarded, this is a core
module.
2016-04-07 04:00:25 -05:00
Elizabeth Myers 999c42bad8 Remove useless alias_entry hits member 2016-04-06 11:47:13 -05:00
Elizabeth Myers a19097baa4 ircd: load modules after conf files
The alias module depends on this
2016-04-06 07:43:45 -05:00
Elizabeth Myers b663a8070f Move alias handling into a dedicated module.
Not yet tested, caveat emptor!

Closes #166
2016-04-06 07:27:50 -05:00
Elizabeth Myers 2575a78b0e Add hook for when rehash is called.
This will be used by the future alias module.
2016-04-06 05:43:54 -05:00
Elizabeth Myers f956cb0f1f Use rb_* versions of nonportable string functions 2016-04-05 05:39:59 -05:00
Elizabeth Myers 731d128990 authd: rework module ID system
Provider ID's are now assigned dynamically at load-time. To accomodate
this, there is now a lookup system for finding providers by name (all
providers have names as well).
2016-04-05 04:31:22 -05:00
Elizabeth Myers 3256156aca Announce changed capabilities on module load
Closes #165
2016-04-04 02:30:35 -05:00
staticfox 5eb3d7a7c0 modules: Revert mapi_register() to use ints
modinit() returns either 0 (success) or -1 (failure) so we
can't check for true/false.
2016-04-03 20:14:36 -04:00
Elizabeth Myers c0483ac17b boolify calls to rehash 2016-04-03 01:53:34 -05:00
Elizabeth Myers aa483e55bd bool-ify modules stuff 2016-04-03 01:51:45 -05:00
Elizabeth Myers 6603175304 Clean up module loading a bit. 2016-04-03 01:21:19 -05:00
Elizabeth Myers ffa79a9516 Use rb_dlink_list_length... == 0, not !rb_dlink_list_length 2016-04-02 22:45:52 -05:00
Elizabeth Myers 34bc7caeae Send enabling message to opm at the end of opm block. 2016-04-02 22:33:19 -05:00
Elizabeth Myers 5c5296c8f8 newconf: delete all proxies on rehash 2016-04-02 22:30:54 -05:00
Elizabeth Myers e2a8228f85 authproc: minor fixes 2016-04-02 20:31:32 -05:00
Elizabeth Myers 8d48aa190b dns: don't use zero ID's 2016-04-02 20:19:37 -05:00
Elizabeth Myers 1d657e0b08 authproc: rehash on authd restart
This is a hack for now so it gets the config again.
2016-04-02 20:10:56 -05:00
Elizabeth Myers 3d2fc110e3 authproc: add more API's for opm management 2016-04-02 19:45:27 -05:00
Elizabeth Myers c1f4db3fb7 Tweak some configuration semantics of opm 2016-04-02 19:45:09 -05:00
Elizabeth Myers d9364d2913 authproc: pad leading 0 for localhost IP's
This avoids misparsing by rb's helper stuff..
2016-04-02 19:29:16 -05:00
Elizabeth Myers eb0814b3cb opm: add support for HTTPS CONNECT proxies.
TBD: do we need an SSL listener for these?
2016-04-02 18:38:21 -05:00
Elizabeth Myers 64fae2607a Rename authd.[ch] on ircd side to authproc.[ch] to prevent shadowing. 2016-04-02 16:44:04 -05:00
Elizabeth Myers b0326abdc9 authd: warn on a bad command 2016-04-02 05:05:28 -05:00
Elizabeth Myers 6d0fafec99 authd: minor cleanups 2016-04-02 04:51:11 -05:00
Elizabeth Myers ae0a058544 authd: clean up command handling with a table 2016-04-02 04:49:01 -05:00
Elizabeth Myers 61d1befa2a authd: fix race on the ircd side.
The client may have already gone away, so if we can't find the local
cid, don't try to restart authd.
2016-04-02 03:51:54 -05:00
Elizabeth Myers 6d5edc6f53 authd: when aborting, don't just do read_packet. 2016-04-02 03:46:31 -05:00
Elizabeth Myers 9bba0f6143 opm: add adjustable timeout values 2016-04-02 03:33:27 -05:00
William Pitcock 34b88b6571 ircd: conf: properly calculate the number of wsockd to start 2016-04-02 03:20:16 -05:00
Elizabeth Myers fabe8b94c5 Add HTTP CONNECT proxy scanning 2016-04-02 03:11:30 -05:00
William Pitcock bccb7dedef ircd: wsproc: cleanups 2016-04-02 03:10:01 -05:00
William Pitcock c53ca1e029 ircd: integrate ircd side of wsockd support 2016-04-02 02:56:22 -05:00
Elizabeth Myers fbe8d087e7 Add exempt logic for open proxies 2016-04-02 02:42:11 -05:00
Elizabeth Myers 51fa2ab8a3 opm: allow scanners to be configurable 2016-04-02 02:29:48 -05:00
Elizabeth Myers adfe7b8396 authd: small cleanup 2016-04-02 01:20:49 -05:00
Elizabeth Myers 6a7bb6f1df authd: more minor cleanups 2016-04-02 01:16:47 -05:00
Elizabeth Myers b1a577f224 ircd/authd: cleanups 2016-04-02 01:05:21 -05:00
Elizabeth Myers 8275e2700d Add opm stuff to default configs 2016-04-01 04:11:04 -05:00
Elizabeth Myers 34f16c467d authd: fix API boo boo 2016-04-01 02:56:03 -05:00
Elizabeth Myers 6da256dc93 authd: remove some whitespace 2016-04-01 02:44:50 -05:00
Elizabeth Myers 4f6119cd40 authd: add API for setting OPM listeners 2016-04-01 02:43:01 -05:00
Elizabeth Myers 7372553dd6 authd: fix compile error 2016-04-01 02:42:50 -05:00
Elizabeth Myers e158281056 authd: properly abort clients who timeout or when the helper restarts 2016-04-01 02:27:48 -05:00
Elizabeth Myers d86692fa44 Add new sockaddr_storage port retrieval/setting macros
These macros are safe for use on IPv6 and clean up a lot of code.
2016-03-31 03:00:29 -05:00
Elizabeth Myers bf3ecca24b ircd/listener: un-obsoleteify comments 2016-03-30 03:36:04 -05:00
Elizabeth Myers 4094d2fad5 Remove trailing whitespace from files. 2016-03-29 13:23:27 -05:00
Matt Ullman 2b535500f9 automake: Ensure ircd_parser.h is created
Fixes random travis explosions
2016-03-28 21:39:10 -04:00
Elizabeth Myers 7ad083b065 logger: add idebug
This only does something if debugging is enabled.
2016-03-28 19:06:31 -05:00
Elizabeth Myers bae7e637de ircd/authd: remove rb_free no longer needed. 2016-03-28 18:19:06 -05:00
Elizabeth Myers 0bb5d3f031 authd: this isn't a list dammit! 2016-03-28 18:13:57 -05:00
Elizabeth Myers 540ae37b96 authd: don't use wild pointer 2016-03-28 18:09:22 -05:00
Elizabeth Myers a6a30cc7b8 ircd/newconf: better IPv4 example 2016-03-28 17:55:54 -05:00
Elizabeth Myers 771dcfad37 newconf: add illustrative examples to comments 2016-03-28 17:54:01 -05:00
Elizabeth Myers 835d456c64 newconf: fix check for IPv6 address length 2016-03-28 17:47:13 -05:00
Elizabeth Myers 3fe0efd55a newconf: change an error to a warning 2016-03-28 17:45:35 -05:00
Elizabeth Myers 50808796e0 authd: It Works, Bitches™ 2016-03-28 16:47:51 -05:00
Elizabeth Myers a9b809c796 ircd_lexer: use correct variable here.
ircd_paths[IRCD_PATH_ETC] is what's wanted, not IRCD_PATH_ETC.
2016-03-28 14:58:26 -05:00
Elizabeth Myers 7b4d1de38d Merge branch 'master' into authd-framework 2016-03-28 14:44:47 -05:00
Elizabeth Myers ad04380360 ircd/authd: respect auth_disabled config option 2016-03-28 02:42:20 -05:00
Elizabeth Myers 59d42a9fcb ircd/authd: use proper timeout values for clients 2016-03-28 02:32:05 -05:00
Elizabeth Myers ef0b13b960 ircd/authd: timeout dead authd clients 2016-03-28 02:30:54 -05:00
Elizabeth Myers cc4d393152 ircd/authd: implement client noticing 2016-03-28 02:19:34 -05:00
Elizabeth Myers d3f6b80867 Replace s_auth/blacklist stuff with authd calls
This also does a lot of surgery on the conf system to reconfigure authd.

/!\ WARNING! ACHTUNG! ADVERTENCIA! ATTENTION! AVVERTIMENTO! /!\
This code has not been run-time tested yet (though it compiles)!
2016-03-28 02:11:16 -05:00
Matt Ullman 33d43d4fa4 ircd: Move signaled variables to volatile sig_atomic_t 2016-03-27 20:05:38 -04:00
Matt Ullman aa7eff28f2 hash.c: Save some more bytes 2016-03-27 06:29:10 -04:00
Elizabeth Myers 3f7039934f s_auth: remove trailing whitespace at end of usernames. 2016-03-26 19:21:16 -05:00
Elizabeth Myers 938f93f4bc ircd/authd: some comments 2016-03-26 16:44:41 -05:00
Matt Ullman de8b3b7174 sslproc: Remove unused variable 2016-03-26 16:41:36 -04:00
Elizabeth Myers 0a659bf0ab Port notice stuff over from authd-framework-2 and use it.
This allows things like oper warnings from authd using the W message type
also.
2016-03-25 21:58:32 -05:00
Elizabeth Myers 122ae255d7 authd: change reload character to R from H.
This is more in line with the specification @kaniini laid out.
2016-03-25 21:00:13 -05:00
William Pitcock de7cf7e009 ircd: client: substantially rework the connid registry system
now connid's are allocated on demand and clients may have as many connid's as necessary.
this allows us to build chains of helpers while ensuring the ircd properly tracks and GCs the resources.
2016-03-25 19:50:29 -05:00
Matt Ullman afba2488ec extb_combi: More int to bool conversion
Cleanup whitespace in ircd_lexer.l
2016-03-25 19:47:58 -04:00
William Pitcock 0aaa37f721 ircd: only relocate_paths on windows, no point on posix 2016-03-25 18:13:39 -05:00
William Pitcock d6c17e5de2 ircd: implement path relocation 2016-03-25 01:57:25 -05:00
William Pitcock 2f545aad87 ircd: use ircd_paths for logFileName and pidFileName 2016-03-25 00:00:06 -05:00
William Pitcock 0d180487b4 ircd: unbreak build 2016-03-24 18:50:13 -05:00
William Pitcock 4d8cfacd95 ircd: start staging for relocatable paths 2016-03-24 18:45:28 -05:00
Matt Ullman e0a9b5d3bf chmode: Move check_forward() to a boolean 2016-03-24 14:42:54 -04:00
Matt Ullman a383180a0a chmode: Move add_id() to a boolean 2016-03-24 14:37:52 -04:00
Matt Ullman 9aa639eddd chmode: Move allow_mode_change() to a boolean 2016-03-24 14:26:02 -04:00
Matt Ullman 2a4b3ea648 version.c.SH: Fix generation not incrementing 2016-03-24 04:00:23 -04:00
Matt Ullman 3b9507d0e9 channel: Move flood_attack_channel() to a boolean 2016-03-24 02:25:26 -04:00
Matt Ullman 216f58a27c channel: Change check_channel_name() note to false
[ci skip]
2016-03-24 02:14:03 -04:00
Matt Ullman 3a46803fef channel: Move check_channel_name() to a boolean 2016-03-24 01:54:39 -04:00
Matt Ullman 2e45f5d808 Cleanup more BSD-isms 2016-03-23 22:37:52 -04:00
Matt Ullman 4b11f39115 Move away from BSD data types 2016-03-23 19:11:42 -04:00
Elizabeth Myers 28c94d6598 Remove common.h from lexer and parser 2016-03-23 10:09:53 -05:00
Elizabeth Myers 79435744c7 common.h: raison d'être is gone, so out it goes.
Fold whatever was left into ircd_defs.h
2016-03-23 09:33:56 -05:00
Elizabeth Myers 7ac3261f97 Ensure the parser/lexer don't use IRCD_BUFSIZE. 2016-03-23 09:26:07 -05:00
Elizabeth Myers 82236a2a65 IRCD_BUFSIZE is redundant with BUFSIZE, so kill it. 2016-03-23 09:22:55 -05:00
Elizabeth Myers ab31d2b07e Send YES/NO to Davy Jones's Locker. 2016-03-23 08:52:32 -05:00
Elizabeth Myers bd43a44469 Remove more YES/NO usage. 2016-03-23 08:43:28 -05:00
Elizabeth Myers 2fc6772ee1 typedef-ify rb_radixtree for consistency. 2016-03-23 08:32:22 -05:00
Elizabeth Myers 4177311e6e Change struct Dictionary(*) to rb_dictionary(_\1).
This cleans things up a slightly and puts the dictionary stuff in its
own namespace.
2016-03-23 08:09:58 -05:00
Elizabeth Myers 2ac4ba969b ircd: shut GCC the fuck up.
No, it can't probably fail... that isn't what that's there for.
2016-03-23 08:07:23 -05:00
Elizabeth Myers 56f84dedf7 DICTIONARY_FOREACH → RB_DICTIONARY_FOREACH
This is in librb and therefore should be prefixed.
2016-03-23 07:45:44 -05:00
Matt Ullman 66769bc1f8 More cleanup 2016-03-23 00:11:26 -04:00
Matt Ullman e23126c83b Cleanup warnings 2016-03-21 22:28:41 -04:00
William Pitcock 4d383612d4 ircd: log runtime path (mainly as proof of concept for rb_path_to_self()) 2016-03-21 21:14:11 -05:00
Matt Ullman ad9cbf9e0d s_user: Don't send CHGHOST clients op/voice syncs 2016-03-20 18:59:07 -04:00
William Pitcock 5a5f173daa parse: check IsServer() before firing off a remove_unknowns() call 2016-03-20 06:40:54 -05:00
William Pitcock 4f5056dd83 ircd: fix build on freebsd 2016-03-20 06:22:39 -05:00
William Pitcock dd92c99b83 modules: fix thinko 2016-03-20 06:01:12 -05:00
William Pitcock c9108ea073 ircd: modules: findmodule_byname(): also check LT_MODULE_EXT here 2016-03-20 06:00:20 -05:00
William Pitcock 6cb643f4f9 ircd: modules: use LT_MODULE_EXT more consistently 2016-03-20 05:54:48 -05:00
William Pitcock 44f442e3fb ircd: parse: now this type cast for POINTER MATH is just fucking stupid 2016-03-20 04:21:25 -05:00
William Pitcock 09f528c24c ircd: win32 does not need the FD 0,1,2 stuff 2016-03-20 03:10:05 -05:00
William Pitcock c1bfea7332 ircd: handle some EXIT_FAILURE cases differently on win32 2016-03-20 03:06:14 -05:00
William Pitcock 48c6d0f56c ircd: squelch write(2) warning differently 2016-03-20 03:02:56 -05:00
William Pitcock 02831b6f65 modules: warning cleanups 2016-03-20 02:42:42 -05:00
William Pitcock b5c0180c4b ircd: build: tell libtool what to DLL_EXPORT 2016-03-20 02:08:14 -05:00
William Pitcock 1ba9eba550 ircd: _WIN32 checks on geteuid() too 2016-03-20 02:04:26 -05:00
William Pitcock 538d208948 ircd: ircd main: use librb functions for daemon management 2016-03-20 02:03:32 -05:00
William Pitcock a7fb269357 ircd: listener: more ss_family grr 2016-03-20 02:01:00 -05:00
William Pitcock 53e50d0e2f ircd: ircd_signal: win32 stubs 2016-03-20 02:00:22 -05:00
William Pitcock 7671316784 ircd: lexer: likewise 2016-03-20 01:59:09 -05:00
William Pitcock e16f4b78b1 ircd: ircd_parser: we do not need to include netinet/in.h 2016-03-20 01:58:28 -05:00
William Pitcock 0b9aca384a ircd: client: fix format string for free_user() debug notice 2016-03-20 01:57:19 -05:00
William Pitcock e867208deb ircd: use GET_SS_FAMILY() in a bunch of places 2016-03-20 01:54:24 -05:00
William Pitcock 1d90b085d3 ircd: blacklist: use GET_SS_FAMILY() 2016-03-20 01:48:14 -05:00
William Pitcock 85368a13d3 ircd: rewrite SOCKET_ERROR as I_SOCKET_ERROR 2016-03-20 01:44:00 -05:00
William Pitcock 1859e9d7d7 ircd: remove basically entirely pointless ServerInfo.hub (closes #167) 2016-03-19 23:05:07 -05:00
William Pitcock 72b51232a9 ensure we do not distribute flex/bison files 2016-03-19 19:23:08 -05:00
Elizabeth Myers 9b8e9eb321 config.h delenda est 2016-03-19 19:14:26 -05:00
William Pitcock 43f06d8d8c ircd/sslproc: same for zlib_ok 2016-03-19 00:58:57 -05:00
William Pitcock bfc44622c8 ircd: do not shadow internal openssl symbol "ssl_ok" (yeah, i know) 2016-03-19 00:57:32 -05:00
William Pitcock 7cc67225cb sslproc: return after calling free_ssl_daemon() when in sandbox ipc service routine 2016-03-19 00:04:38 -05:00
William Pitcock 61eb4ba64a ircd: link libircd with -no-external 2016-03-18 23:14:38 -05:00
Elizabeth Myers c084fcafec ircd: fix a really retarded GCC warning by being anal retentively "standards compliant" 2016-03-18 15:53:43 -05:00
Elizabeth Myers 1db8a31395 modules: fix stupid GCC false positive warning.
This invocation of strlen is on a constant string and should be folded
by any sane compiler (GCC included), but it warns anyway because GCC is
stupid.
2016-03-18 15:32:33 -05:00
William Pitcock 1ca8cd5276 parse: ensure that aliases have a sufficient number of parameters before trying to process them 2016-03-17 23:13:22 -05:00
Elizabeth Myers 617144af7a dns: remove unneeded defines 2016-03-14 22:15:28 -05:00
Elizabeth Myers 9ca15a2679 Merge branch 'master' of github.com:charybdis-ircd/charybdis 2016-03-14 22:14:28 -05:00
Simon Arlott 532f83a70a
ircd: Don't refer to the IP address as a "netmask" in error messages 2016-03-14 22:38:04 +00:00
Elizabeth Myers 068c6c4a2b dns: use a dictionary for query storage 2016-03-13 03:23:41 -05:00
Elizabeth Myers 9abdcf1c64 modules: can .la suffix.
.la archives are prohibited by most Linux distributions because they
clutter up the linker. They may get caught up as victims in scripts that
purge .la files. Besides, .la files don't matter for simple loadable
modules on most systems.

So, what we do now instead is just use the platform suffix detected by
libtool.
2016-03-12 20:10:46 -06:00
Elizabeth Myers 50f842125a authd: crap, C was taken already, rename reload to H. 2016-03-10 08:07:29 -06:00
Elizabeth Myers 6445c1cf0b rehash: don't restart authd for DNS reloads
This could lead to pretty nasty things, like losing DNS (and in the
future, ident) queries. That's a Bad Thing™.
2016-03-09 03:46:04 -06:00
Elizabeth Myers 503727d1ee More bool conversions 2016-03-09 02:19:31 -06:00