~emersion/basu

build: bump version to 0.2.1
Workaround build failure by -Wpedantic with GCC 12

With GCC 12, even with -std=gnu99, -Wpedantic complains about %m in format
strings, __PRETTY_FUNCTION__, braces inside expressions, etc.; and it
makes some of these into errors.

Closes: https://todo.sr.ht/~emersion/basu/18
Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
build: fix whitespace in project()
5fa970e8 — Fangrui Song 1 year, 6 months ago
LLD 13 and GNU ld 2.37 support -z start-stop-gc which allows garbage
collection of C identifier name sections despite the __start_/__stop_
references.  Simply set the retain attribute so that GCC 11 (if
configure-time binutils is 2.36 or newer)/Clang 13 will set the
SHF_GNU_RETAIN section attribute to prevent garbage collection.

Without the patch, there are linker errors like the following with -z
start-stop-gc.

```
ld: error: undefined symbol: __start_SYSTEMD_BUS_ERROR_MAP
>>> referenced by bus-error.c:93 (../src/libsystemd/sd-bus/bus-error.c:93)
>>>               sd-bus_bus-error.c.o:(bus_error_name_to_errno) in archive src/libsystemd/libsystemd_static.a
```

Co-authored-by: Evgeniy Khramtsov <evgeniy@khramtsov.org>
meson: convert audit option to feature object

features are more idiomatic and ubiquitous
meson: add libcap option

it's better to provide the user with this choice instead of
unconditionally magically depending on it
meson: Link basuctl with libbasu dynamically

This reduces the installed size significantly. I don't know about any
reason for bundling libbasu in basuctl when they both come from the
same package.
readme: reference mailing list and issue tracker
meson: Allow to build both shared and static library

See https://mesonbuild.com/Build-targets.html for more information.
readme: update IRC channel
freebsd: Do not use cr_pid from LOCAL_PEERCRED

LOCAL_PEERCRED is used as substitute for SO_PEERCRED on FreeBSD. One of
the fields needed from there is the PID of the peer process. However,
while SO_PEERCRED returns the PID at the time of connect(2),
LOCAL_PEERCRED returns the PID at the time of listen(2). If the dbus
daemon fork(2)'d after listen(2) to daemonize, then the PID returned
will no longer exist, which breaks basu.

Remove the use of cr_pid for now, as it cannot be used.
4277dfe8 — Jan Beich 2 years ago
test: switch to getprogname on FreeBSD

`program_invocation_short_name` is an alias for `__progname` in glibc.
FreeBSD also has `__progname` defined by startup code but (like `environ`)
it's not declared in any system header. Consumers are encouraged to
use `getprogname()` instead.
Bump to v0.2.0
license: Remove GPL2 text

There are no GPL2 licensed files left in the repository at the time of
this commit, leaving the repo solely LGPL2.1+ licensed.

Delete the GPL2 license text as it no longer has any relevance.

Closes: https://github.com/emersion/basu/issues/33
ci: Mount linprocfs on FreeBSD

This allow the credential test to run correctly. This does not mean that
linprocfs is required for basu to work, just that this particular
functionality uses it.
bus-creds: Handle ESRCH from get_process_comm

FreeBSD's linprocfs does not have a comm file, so get_process_comm
returns ESRCH. Handle this gracefully instead of throwing in the towel.
basic/macro: Undef align on FreeBSD

This silences a lot of warnings.
bus-creds: Skip parse caps instead of -ENOTSUP

This means that we just interpret processes as having no capabilities,
rather than causing errors that terminate bus_cred setup.
bus-socket: Skip cap check instead of -ENOSYS

Returning -ENOSYS meant that any permission check would fail if we
didn't have capabilities, which lead us to fail before seeing that
server/client were the same PID, which is special-cased to be okay.

Instead set -1, so that we just skip capability tests.
Next