Commit graph

153 commits

Author SHA1 Message Date
Aaron Jones
47a66e154f
librb: silence some fairly harmless compiler warnings
These include warnings about "break" statements that will never be
executed (because they are after "return" statements), unused macros
(lost to code refactoring or never even used in the first place),
functions that call abort() or loop indefinitely but aren't marked with
the "noreturn" attribute, and use of variables possibly uninitialised
(a false positive).
2016-06-01 20:54:11 +00:00
Aaron Jones
d5ad6015c5
openssl: use snprintf(3) instead of rb_snprintf() 2016-06-01 18:04:43 +00:00
Aaron Jones
1490b52e19
openssl: More LibreSSL compatibility
LibreSSL does not have the new version macros & functions that OpenSSL
1.1.0 implements. This causes a compile-time failure against LibreSSL.

Further, the runtime function for returning the library version returns
the wrong number (the hardcoded constant number SSLEAY_VERSION_NUMBER
aka OPENSSL_VERSION_NUMBER, instead of LIBRESSL_VERSION_NUMBER).

Add more ifdef soup to remedy the situation.
2016-06-01 17:55:53 +00:00
Aaron Jones
3057f91d98
openssl: change how we load DH parameters
The code already assumes the presence of fopen(3) and errno, and, by
extension, fclose(3) and strerror(3), so just use those instead of the
BIO wrappers.

Additionally, don't fail to initialise if the DH file does exist but
parsing it fails, as per the pre-existing comment about them being
optional.
2016-05-25 21:46:34 +00:00
Simon Arlott
7c7cf006ca
librb: define UINT32_MAX for FreeBSD 4.8 2016-05-12 12:43:16 +01:00
Simon Arlott
87f7632760
librb: support rb_path_to_self on FreeBSD 4.8 2016-05-12 12:43:15 +01:00
Aaron Jones
1e7342d0f4
[mbedtls] Various fixes and improvements
* Move certificate, key, DH parameters and configuration to heap
  (Documentation states that setting new configuration, e.g.
   during a rehash, is unsupported while connections using that
   configuration are active)

  This is the same approach as the fix for #186

  Refcount these structures so as to not introduce a memory leak

  On rehash, it will use new structures only if there are no
  errors in constructing them

* Make fingerprint generation work for TLS connections

  See the comments in the newly created file for an explanation

* Fix memory leak when generating a fingerprint from a file

* Add better error-reporting (strings in addition to numbers)
  where possible

* Coalesce several connection memory allocations into one function

* Reduce boilerplate where possible (Charybdis targets C99)

* Support private key being in certificate file, and having no
  DH parameters file

* Correct erroneous closing comment
2016-05-05 03:47:57 +00:00
Aaron Jones
c40eede13b
[TLS Backends] Make version strings more useful and consistent 2016-05-05 03:47:46 +00:00
Aaron Jones
0fe9dd4119
[TLS Backends] Allow absense of private key file
Use the certificate file instead
2016-05-05 03:47:33 +00:00
William Pitcock
9cd0063a2c librb: fix commio build on win32 2016-04-30 19:33:31 -05:00
Aaron Jones
92404a1a98
[openssl] Forward-port some more cleanups from fixes to 3.5 2016-04-30 21:45:16 +00:00
Simon Arlott
8a29e7cd1e
librb: shutdown() listening sockets pending close() so that listeners can be reopened reliably 2016-04-30 11:36:28 +01:00
William Pitcock
d71787ab69 librb: rb_path_to_self(): use sysctl(2) interface on freebsd/dragonfly 2016-04-30 01:19:08 -05:00
William Pitcock
a2bfe0f88e librb: linebuf: don't reinvent rb_dlinkAddTailAlloc(). 2016-04-30 00:59:08 -05:00
William Pitcock
5a775221d2 tools: fix stub rb_strcasecmp() build 2016-04-29 19:52:19 -05:00
Simon Arlott
ff0414c856 librb: close FDs when they're freed (outside of select handler) 2016-04-29 16:19:08 -05:00
Aaron Jones
cf12678be5
[openssl] More improvements to the backend
* Don't manually initialise libssl 1.1.0 -- it does this automatically
* SSL_library_init() should be called first otherwise
* Move SSL_CTX construction to rb_setup_ssl_server()
* Test for all required files (certificate & key) before doing anything
* Free the old CTX before constructing a new one (Fixes #186)
* Don't try to set options / ciphers etc on a NULL CTX
* Clean up ifdef indentation
* Fix DH parameters memory leak
2016-04-29 16:26:52 +00:00
Simon Arlott
f9014791da
openssl: set ciphers on client connections too 2016-04-29 07:42:12 +01:00
Aaron Jones
6a7ea191a7
[mbedtls] correct printf argument count
[ci skip]
2016-04-27 22:11:19 +00:00
Aaron Jones
b28c26d965
Partially revert previous commit
The OpenSSL backend is the only one that assigns a non-constant
value to the length variable. Use the correct type for its
pointer and cast instead.

[ci skip]
2016-04-27 21:49:55 +00:00
Aaron Jones
e3760ba710
[TLS backends] Miscellaneous fixes
* Certificate fingerprint length functions return an "int", so use an
  int when calculating the length
* Clean up the OpenSSL certificate fingerprint if() and indentation mess
2016-04-27 21:45:19 +00:00
Simon Arlott
d6acb43769
openssl: don't allow certificates outside the validity period 2016-04-27 22:03:49 +01:00
Simon Arlott
c53b6ef2cc
epoll: don't try to read from closed FDs 2016-04-27 21:16:29 +01:00
Aaron Jones
b1f0549361
[openssl] support ECDHE on more than one curve when possible 2016-04-27 16:17:33 +00:00
Simon Arlott
0346918701
add mkfingerprint program 2016-04-26 20:49:03 +01:00
Simon Arlott
31646e89ba
librb: gnutls: check return value of fread() 2016-04-26 20:33:17 +01:00
Simon Arlott
e1f16ce22e
openssl: accept more certificate verify errors as valid 2016-04-25 20:38:39 +01:00
Simon Arlott
5ad62c80ee
librb: remove socklen parameter from rb_connect_tcp 2016-04-24 17:11:20 +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
7da82465a8
librb: mbedtls: fix rb_get_ssl_certfp()
Add missing break statements.
Return the hash length on success.
2016-04-23 22:45:13 +01:00
Simon Arlott
bf3bcbb5b2
librb: fix mbedtls library order
libmbedtls depends on libmbedx509 and libmbedcrypto
libmbedx509 depends on libmbedcrypto

They have to be specified in the correct order for the GNU linker to work.
2016-04-23 22:13:03 +01:00
Elizabeth Myers
c9b6f58349 Name the fallback strncasecmp properly [ci skip] 2016-04-10 17:28:20 -05:00
Elizabeth Myers
ea3168fff8 whoops, fix a typo 2016-04-10 17:26:09 -05:00
Elizabeth Myers
8b813d3060 Replace my shitty fallbacks with those from FreeBSD 2016-04-10 17:25:32 -05:00
Elizabeth Myers
efc4b18c78 *sigh* comment these out until travis is fixed. 2016-04-10 17:12:42 -05:00
Elizabeth Myers
c5514ce8ee Add these for now until travis actually gets their shit together. 2016-04-10 17:07:33 -05:00
Elizabeth Myers
238db37776 Get rid of install-sh and use shtoolize to create them.
Contributed by jackal^
2016-04-10 16:49:42 -05:00
Elizabeth Myers
9af0d38291 librb: minor adjustments to rb_strcasestr fallback to avoid warnings. 2016-04-10 10:10:46 -05:00
Elizabeth Myers
b376d0fd46 Properly clean up build artifacts.
Author: jackal^ from freenode
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
508e25a85b librb: add versions of rb_strcasecmp, rb_strncasecmp, and rb_strcasestr.
The first two are POSIX but not standard (Windows has functions that act
like it, so use them), but the latter is non-standard, full stop.
2016-04-05 05:33:43 -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
0e651b1441 librb: rb_run_event -> rb_run_one_event
This is to avoid confusion with rb_event_run, which does something else.
2016-04-02 23:38:28 -05:00
Elizabeth Myers
f8ef4b8dd6 win32: change from ircd-ratbox-class to charybdis-class 2016-04-02 23:19:38 -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
7b2c764f59 librb: don't include linux/tcp.h, that's already included 2016-03-31 01:16:34 -05:00
Elizabeth Myers
468ef960f8 opm: don't assume we have netinet/tcp.h
Instead, check for it in librb
2016-03-31 01:08:38 -05:00
William Pitcock
a20190d5ea librb: fix rb_path_to_self() dlinfo variant 2016-03-30 14:33:39 -05:00
Elizabeth Myers
42c5dd7e01 serno.h: remove it with make clean. 2016-03-25 11:47:02 -05:00
William Pitcock
ac2f2189f9 librb: define RB_PATH_SEPARATOR 2016-03-24 18:21:11 -05:00
Elizabeth Myers
491b3b39d5 cleanup: u_long -> unsigned long 2016-03-23 22:03:24 -05:00
Matt Ullman
c056dba233 Remove the rest of the SVN id tags 2016-03-23 20:13:12 -04:00
Matt Ullman
4b11f39115 Move away from BSD data types 2016-03-23 19:11:42 -04:00
Elizabeth Myers
3d1df26cdd librb/ports: ungimp thing. 2016-03-23 12:06:26 -05:00
Elizabeth Myers
3a1f645bed misc solaris fixes 2016-03-23 12:04:46 -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
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
e23126c83b Cleanup warnings 2016-03-21 22:28:41 -04:00
William Pitcock
87b20cbb75 librb: use readlink(2) on linux for the direct path instead of dlinfo 2016-03-21 21:26:28 -05:00
William Pitcock
b7c7f290c7 librb: provide rb_path_to_self() on windows 2016-03-21 21:20:50 -05:00
William Pitcock
790e4dce4e librb: add rb_path_to_self(), which provides fairly reliable runtime path detection 2016-03-21 21:11:53 -05:00
William Pitcock
36b3cff77f configure: fix msys checks 2016-03-20 22:06:54 -05:00
William Pitcock
e452b26e46 librb: configure: tolerate older msys versions having wrong uname -a output 2016-03-20 22:01:17 -05:00
Elizabeth Myers
98793cc9e4 librb: remove an experiment I had.
This won't really work on 32-bit architectures due to pointer
truncation. In any case, I wasn't planning on using it for this reason,
it was simply something I tinkered with.
2016-03-20 10:28:35 -05:00
William Pitcock
eb55877548 librb: fix socklen_t check 2016-03-20 04:24:30 -05:00
William Pitcock
d24856d228 librb: commio: squelch setsockopt(3) warnings 2016-03-20 04:18:42 -05:00
William Pitcock
fe277230f9 librb: configure: also include ws2tcpip.h 2016-03-20 04:14:28 -05:00
William Pitcock
71b2af0611 acinclude: fix sockaddr_in6 checvk too 2016-03-20 04:10:33 -05:00
William Pitcock
ea83b018b5 librb: acinclude: check for ipv6 on win32 2016-03-20 04:08:12 -05:00
William Pitcock
38b68802a3 librb: rb_lib: undefine any previous errno consts on win32 2016-03-20 03:41:25 -05:00
William Pitcock
e0dc28c59f librb: rb_dictionary: temporary hack to shut up gcc on windows 2016-03-20 01:46:00 -05:00
William Pitcock
b1f7e4098f librb: win32: more cleanups 2016-03-20 00:41:01 -05:00
William Pitcock
e49147e56e commio: even more win32 fixes 2016-03-20 00:38:46 -05:00
William Pitcock
339150ec60 commio: further win32 fixes 2016-03-20 00:37:50 -05:00
William Pitcock
7dbf237f93 commio: win32 fixes 2016-03-20 00:36:35 -05:00
William Pitcock
17e4e6af83 librb: further cleanups 2016-03-20 00:35:13 -05:00
William Pitcock
dc7e6b42ca librb: some win32 fixes 2016-03-20 00:33:19 -05:00
William Pitcock
b68dee9bcb librb: only install WSA stubs if windows SDK does not provide them 2016-03-20 00:18:42 -05:00
Elizabeth Myers
2a9257c652 rb_dictionary: add include needed for int types. 2016-03-19 15:59:27 -05:00
William Pitcock
066b05dfe2 librb: use charybdis acinclude dir 2016-03-18 23:28:42 -05:00
Elizabeth Myers
36e803d93a crypt: fix strict-aliasing warnings by using an explicit alias. 2016-03-18 15:46:09 -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
Elizabeth Myers
1d89c9e945 Remove unnecessary autotools cruft and other detritus 2016-03-18 15:13:11 -05:00
Elizabeth Myers
617144af7a dns: remove unneeded defines 2016-03-14 22:15:28 -05:00
Elizabeth Myers
b22c6f101c rb_dictionary: add functions for uint64_t (long) variables. 2016-03-13 00:16:19 -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
3a29f678cf Rename RATBOX_PROFILE to RB_PROFILE. 2016-03-07 18:52:50 -06:00
Elizabeth Myers
4ea068e826 Try to fix stupid build error on Travis 2016-03-07 18:00:13 -06:00
Elizabeth Myers
749d697c98 Fix generation of serno.h
Due to reversed conditionals, it wasn't being generated properly.

This also actually fixes its generation in librb by just copying the
Charybdis version. Unbundlers will want to take note of this.
2016-03-07 17:15:39 -06:00
Elizabeth Myers
34dbd2d49b Makefile.am: make git serno generation a little nicer. 2016-03-07 05:15:35 -06:00
Elizabeth Myers
d9e4f6f074 librb: it's pretty obvious this has been updated since 2008.
Add code to properly generate SERNO accordingly.
2016-03-07 00:23:30 -06:00
William Pitcock
e09ee7faad librb: remove some files installed by libtoolize 2016-03-07 00:14:18 -06:00
William Pitcock
7ee96784c2 remove pregenerated librb/configure 2016-03-06 18:30:01 -06:00
William Pitcock
498b189340 librb: provide AC_TRY_RUN fallback for cross-compiling librb (closes #151) 2016-03-06 18:29:19 -06:00
Elizabeth Myers
a4bf26dd34 Move irc_* data structures to librb.
This makes the base ircd less cluttered up with data structures that can
go elsewhere.
2016-03-06 14:17:19 -06:00
Elizabeth Myers
eddf454cd3 librb: whoops, didn't realise this was needed... :x 2016-03-06 13:30:56 -06:00
Elizabeth Myers
90d3128863 librb: remove credits, they are redundant with charybdis's. 2016-03-06 13:21:47 -06:00
Elizabeth Myers
4966594cfa librb: remove ChangeLog, it hasn't been updated for 8 years. 2016-03-06 13:19:23 -06:00
Elizabeth Myers
cfa2362d80 librb: forgot this. 2016-03-06 13:18:55 -06:00