Commit Graph

33 Commits

Author SHA1 Message Date
Omar Polo 08e6d6ed7a mark private function as static 2024-01-07 18:59:10 +00:00
Omar Polo 0c5dd8ffe9 remove explicit #include endian.h
unfortunately that's not portable.  config.h will include the right
stuff however.
2024-01-07 18:58:26 +00:00
Omar Polo ebfc578491 sync libtls 2024-01-07 18:52:51 +00:00
Omar Polo 12eb29d878 sync imsg 2024-01-07 18:27:41 +00:00
Omar Polo 74c6900c91 fix previous; check for getentropy only when arc4random is missing
on macos we have the situation where we have arc4random available
but no getentropy().
2023-08-23 19:22:22 +00:00
Omar Polo 21b4a5163c comment out seed_from_prngd
it's not used (we define OPENSSL_PRNG_ONLY) and fails the build
with -Werror.  Keep the function commented instead of deleting it
just in case we need to undefine OPENSSL_PRNG_ONLY in the future.
2023-08-23 19:13:46 +00:00
Omar Polo f9ab77a898 bundle libtls
gmid (like all other daemons that want to do privsep crypto) has a
very close relationship with libtls and need to stay in sync with
it.

OpenBSD' libtls was recently changed to use OpenSSL' EC_KEY_METHOD
instead of the older ECDSA_METHOD, on the gmid side we have to do
the same otherwise failures happens at runtime.  In a similar manner,
privsep crypto is silently broken in the current libretls (next
version should fix it.)

The proper solution would be to complete the signer APIs so that
applications don't need to dive into the library' internals, but
that's a mid-term goal, for the immediate bundling the 'little'
libtls is the lesser evil.

The configure script has gained a new (undocumented for the time
being) flag `--with-libtls=bundled|system' to control which libtls
to use.  It defaults to `bundled' except for OpenBSD where it uses
the `system' one.  Note that OpenBSD versions before 7.3 (inclusive)
ought to use --with-libtls=bundled too since they still do ECDSA_METHOD.
2023-08-23 17:38:49 +00:00
Omar Polo 877b479bcc add missing include of config.h in vis.c 2023-08-07 17:57:24 +00:00
Omar Polo 9e6fc13b35 drop the __bounded__ attribute
breaks the build with -Werror depending on the compiler.
2023-08-07 17:54:34 +00:00
Omar Polo 36363b011c drop #include <sys/cdefs.h> from vis.h
Doesn't seem to be available on many systems.  It is also not strictly
needed since we include vis.h only after headers like stdlib.h that
already pulls in the type it needs.
2023-08-07 16:09:00 +00:00
Omar Polo d13b044d59 address the strnvis(3) portability fiasco
strnvis originates on OpenBSD.  When NetBSD added it to their libc
they decided to swap the argument.  Without starting a holy war on
the "best" argument order, adding an implementation of a function
that's widely available and making its signature purposefully
incompatible is beyond justification.  FreeBSD (and so macos too?)
followed NetBSD in this, so we end up with *two* major and incompatible
strnvis implementations.  libbsd is in a limbo, they started with
the OpenBSD version but they'll probably switch to the NetBSD version
in the future.

That's why we can't have nice things.

Do the right thing(tm) and check for the presence of the original
strnvis(3), if not available or broken use the bundled one.
2023-08-07 15:39:57 +00:00
Omar Polo c9c44c6571 update imsg 2023-07-02 08:55:38 +00:00
Omar Polo 2d0a2b21f5 add missing include of ../config.h in regress/*.c
otherwise we get a nice 'no previous prototype' due to
-Wmissing-prototypes.
2023-06-23 22:40:09 +00:00
Omar Polo 1610f9541d rework the configure script
now it resembles less oconfigure and more the configure scripts I'm
using in my recent projects.  I'd argue it's more easy to use it.
2023-06-13 16:36:10 +00:00
Omar Polo bd8683d0fd add tests and compat for setresuid and setresgid 2022-12-02 11:53:35 +00:00
Omar Polo 19a8d9fe74 add memmem compat 2022-10-31 22:53:16 +00:00
Omar Polo 4b93be289b rework `make dist' 2022-10-31 22:53:16 +00:00
Omar Polo 225686d7fd fix getprogname shim
HAVE_PROGRAM_INVOCATION_SHORT_NAME is always defined; look at wether
it's zero or not.
2022-07-04 13:43:27 +00:00
Omar Polo 894e998423 sync imsg-buffer.c
original commit from eric@:

 change the barrier so that fd's are always passed and received with
 the first byte of the imsg they belong to.

 idea, tweaks and ok claudio@
2022-03-19 14:54:31 +00:00
Omar Polo c7949fd545 sync recallocarary.c
original commit from claudio@:

 Type-cast getpagesize() from int to size_t for the comparison with d.
 getpagesize() will only return positive numbers (there is no negative
 page size system) and it can not fail.
 Should fix some compiler warnings seen in -portable projects.
 OK otto@
2022-03-19 14:52:11 +00:00
Omar Polo 151af94eba only memcpy into imsg->data if datalen is not zero
Passing a NULL pointer to memcpy is UB no matter if len is 0 (commit by
claudio@, backporting for gmid.)
2022-01-28 12:34:42 +00:00
Omar Polo 492a274fd7 add compat for sys/tree.h 2021-10-07 11:36:25 +00:00
Omar Polo 578f13e4b2 add compat for reallocarray 2021-04-25 12:50:19 +00:00
Omar Polo 4f8128452c
fix various error in compat/err.c 2021-02-23 13:43:53 +01:00
Omar Polo 6b191ed52a
tests and compat for imsg 2021-02-23 13:43:14 +01:00
Omar Polo 7689871446 include config.h first 2021-02-12 12:49:36 +00:00
Omar Polo a72cc6be31 improve compat/getprogname on GNU libc
but why'd they called it program_invocation_short_name?  They couldn't
find a longer name?
2021-02-11 09:13:58 +00:00
Omar Polo fe90d24fd0 add compat for setproctitle
This adds a check for setproctitle and for the (linux) prctl
PR_SET_NAME.  If setproctitle is not available, on linux we provide an
implementation that use prctl (taken from tmux compat layer.)
2021-02-04 13:42:35 +00:00
Omar Polo 7e26256394 fixing compat compilation
include headers if needed and include config.h
2021-01-22 17:00:56 +00:00
Omar Polo 5c342d059f more OpenBSD goodies 2021-01-21 15:37:02 +00:00
Omar Polo 20c9ff466b typo 2021-01-21 14:51:09 +00:00
Omar Polo 642b37d5ac don't include config.h there 2021-01-21 14:48:26 +00:00
Omar Polo 12042ad700 add a configure script and some compat
tested on openbsd, alpine and void
2021-01-21 11:57:46 +00:00