Commit Graph

31082 Commits

Author SHA1 Message Date
Yu Watanabe db9ecf0501 license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
Lennart Poettering eaa269484b resolved: fix non-initialized memory access
Fix for bug introduced in 1ed314087f.
2020-11-06 13:58:20 -08:00
Lennart Poettering 76f772298e resolved: slightly extend debug log output about outgoing messages 2020-11-06 14:43:05 +01:00
Lennart Poettering 088648d081 resolved: don't resolve "local." via LLMNR
It's the mDNS top-level domain, hence don't consider it for LLMNR, ever.

Fixes: #16233
2020-11-06 14:43:01 +01:00
Lennart Poettering dc194dce80 resolved: add comments for various query flags 2020-11-06 14:42:56 +01:00
Lennart Poettering 5cdcac6cf6 resolved: show all answer flags when dumping answer 2020-11-06 14:42:53 +01:00
Lennart Poettering 032b398224 resolved: add minor optimization path to dns_answer_merge() 2020-11-06 14:42:49 +01:00
Lennart Poettering 02c205359b resolved: suppress misleading debug message about ignored resolv.conf line 2020-11-06 14:42:45 +01:00
Lennart Poettering 8d50c14252 errno: ETIMEDOUT is also a connection error 2020-11-06 14:42:18 +01:00
Ronan Pigott ea394d48cc journalctl: show boot id in the reboot context separator 2020-11-06 12:17:03 +01:00
Lennart Poettering ce8f6d478e seccomp: allow turning off of seccomp filtering via env var
Fixes: #17504

(While we are it, also move $SYSTEMD_SECCOMP_LOG= env var description
into the right document section)

Also suggested in: https://github.com/systemd/systemd/issues/17245#issuecomment-704773603
2020-11-05 20:22:19 +01:00
Zbigniew Jędrzejewski-Szmek 961b341e85 selinux: also try the netlink-based fallback and continue on permission error
Fedora Rawhide still has the old policy, so selinux prevents our selinux code
from checking if selinux is enabled. But it seems smart to fall back to the old
API anyway.

Follow-up for fd5e402fa9.

Both the reference policy [1] and Fedora selinux policy [2] needed to be
updated, so it's likely that this will impact other distros too.

[1] https://github.com/SELinuxProject/refpolicy/pull/308
[2] https://github.com/fedora-selinux/selinux-policy/pull/464
2020-11-04 09:49:53 +01:00
Topi Miettinen ae5e9bf46f shared/seccomp-util: move stime() to @obsolete
Quoting the manual page of stime(2): "Starting with glibc 2.31, this function
is no longer available to newly linked applications and is no longer declared
in <time.h>."
2020-11-04 09:48:33 +01:00
Zbigniew Jędrzejewski-Szmek 04bd604fb9 sd-login: fix parsing in sd_uid_is_on_seat
Bug introduced in 81823e6c12771721e9a729f6280a9de26fd70bad:
logind uses spaces not commas to separate items.
2020-11-04 09:46:59 +01:00
Zbigniew Jędrzejewski-Szmek 585d7a893e
Merge pull request #17521 from poettering/resolved-more-fixes
six fixes to resolved
2020-11-04 09:38:09 +01:00
Zbigniew Jędrzejewski-Szmek 24309e6683
Merge pull request #17493 from Villemoes/va-arg-simplifications
Some vararg simplifications
2020-11-04 09:22:15 +01:00
Lennart Poettering 2f4c2db20a resolved: handle RRs where we don't have a signer
If we encounter an RR that has no matching signature, then we don't know
whether it was expanded from a wildcard or not. We need to accept that
and not make the NSEC test fail, just skip over the RR.
2020-11-03 20:36:02 +01:00
Lennart Poettering de4a0138e7 resolved: drop unused family argument from manager_routable() 2020-11-03 20:35:09 +01:00
Lennart Poettering 014e8cc131 resolved: fix dumping of DnsAnswer objects 2020-11-03 20:35:09 +01:00
Lennart Poettering 398c611833 resolved: put size limit in DnsAnswer size to UINT16_MAX
The three answer sections can only carry up to UINT16_MAX entries, hence
put a hard upper limit on how far DnsAnswer can grow. The three count
fields in the DNS packet header are 16 bit only, hence the limit.

If code actually tries to add more than 64K RRs it will get ENOSPC with
this new checking.

And similar to DnsQuestion.
2020-11-03 20:35:04 +01:00
Lennart Poettering a63a1252b5 resolved: check return value of memdup() correctly for OOM 2020-11-03 20:05:46 +01:00
Rasmus Villemoes 3d2b1fa473 strv.c: simplify strv_new_ap
Instead of duplicating the code for x and the varargs, handle them all the same
way by using for loops.
2020-11-03 14:26:08 +01:00
Rasmus Villemoes bd8e699c27 signal-util: make sigaction_many_ap a little more concise
There's no reason to duplicate the stop condition sig < 0, nor the sigaction()
call.
2020-11-03 14:26:08 +01:00
Rasmus Villemoes 6ced0770c7 string-util: improve overflow checking
The current overflow checking is broken in the corner case of the strings'
combined length being exactly SIZE_MAX: After the loop, l would be SIZE_MAX,
but we're not testing whether the l+1 expression overflows.

Fix it by simply pre-accounting for the final '\0': initialize l to 1 instead
of 0.
2020-11-03 14:26:08 +01:00
Rasmus Villemoes 020003f235 string-util: simplify logic in strjoin_real()
The loops over (x, then all varargs, until a NULL is found) can be written much
simpler with an ordinary for loop. Just initialize the loop variable to x, test
that, and in the increment part, fetch the next va_arg(). That removes a level
of indentation, and avoids doing a separate strlen()/stpcpy() call for x.

While touching this code anyway, change (size_t)-1 to the more readable
SIZE_MAX.
2020-11-03 14:25:28 +01:00
Lennart Poettering d3dcf4e3b9 fileio: beef up READ_FULL_FILE_CONNECT_SOCKET to allow setting sender socket name
This beefs up the READ_FULL_FILE_CONNECT_SOCKET logic of
read_full_file_full() a bit: when used a sender socket name may be
specified. If specified as NULL behaviour is as before: the client
socket name is picked by the kernel. But if specified as non-NULL the
client can pick a socket name to use when connecting. This is useful to
communicate a minimal amount of metainformation from client to server,
outside of the transport payload.

Specifically, these beefs up the service credential logic to pass an
abstract AF_UNIX socket name as client socket name when connecting via
READ_FULL_FILE_CONNECT_SOCKET, that includes the requesting unit name
and the eventual credential name. This allows servers implementing the
trivial credential socket logic to distinguish clients: via a simple
getpeername() it can be determined which unit is requesting a
credential, and which credential specifically.

Example: with this patch in place, in a unit file "waldo.service" a
configuration line like the following:

    LoadCredential=foo:/run/quux/creds.sock

will result in a connection to the AF_UNIX socket /run/quux/creds.sock,
originating from an abstract namespace AF_UNIX socket:

    @$RANDOM/unit/waldo.service/foo

(The $RANDOM is replaced by some randomized string. This is included in
the socket name order to avoid namespace squatting issues: the abstract
socket namespace is open to unprivileged users after all, and care needs
to be taken not to use guessable names)

The services listening on the /run/quux/creds.sock socket may thus
easily retrieve the name of the unit the credential is requested for
plus the credential name, via a simpler getpeername(), discarding the
random preifx and the /unit/ string.

This logic uses "/" as separator between the fields, since both unit
names and credential names appear in the file system, and thus are
designed to use "/" as outer separators. Given that it's a good safe
choice to use as separators here, too avoid any conflicts.

This is a minimal patch only: the new logic is used only for the unit
file credential logic. For other places where we use
READ_FULL_FILE_CONNECT_SOCKET it is probably a good idea to use this
scheme too, but this should be done carefully in later patches, since
the socket names become API that way, and we should determine the right
amount of info to pass over.
2020-11-03 09:48:04 +01:00
Purushottam choudhary 92b555aaab network: selinux hook handling to enumerate nexthop
When selinux is enabled, the call of
manager_rtnl_enumerate_nexthop() fails.

This fix is to facilitate selinux hook handling for enumerating
nexthop.

In manager_rtnl_enumerate_nexthop() there is a check
if "Not supported" is returned by the send_netlink() call.

This check expects that -EOPNOTSUPP is returned,
the selinux hook seems to return -EINVAL instead.

This happens in kernel older than 5.3
(more specificallytorvalds/linux@65ee00a) as it does not support
nexthop handling through netlink.

And if SELinux is enforced in the order kernel, callingRTM_GETNEXTHOP
returns -EINVAL.

Thus adding a call in the manager_rtnl_enumerate_nexthop for the
extra return -EINVAL.
2020-11-01 23:28:21 +09:00
Lennart Poettering acd156d197 automount: make user unmounting for automount units more debuggable
Let's add an explicit log message plus an error state for automount
units, if users explicitly unmounted our autofs mount.

Prompted by: #17448
2020-10-30 13:10:42 +01:00
Lennart Poettering bfeb927a55 pid1: various minor watchdog modernizations
Just some clean-ups.
2020-10-30 13:02:06 +01:00
Yu Watanabe 819a555bc5
Merge pull request #17399 from afq984/udev-escaped-string
Allow escaped string in udev rules
2020-10-30 09:52:45 +09:00
Zbigniew Jędrzejewski-Szmek 58f848148f
Merge pull request #17444 from BtbN/fix_ib_dhcp4
networkd: fix DHCP on InfiniBand interfaces
2020-10-29 19:27:29 +01:00
Zbigniew Jędrzejewski-Szmek e61f999755
Merge pull request #17472 from keszybz/spdx-license-headers
More SPDX license headers
2020-10-29 19:05:05 +01:00
Zbigniew Jędrzejewski-Szmek ae7e5d2037
Merge pull request #17476 from poettering/resolved-tweaks
three small resolved cleanups
2020-10-29 18:58:56 +01:00
Yu, Li-Yu c32d562da5 udev: add fuzzer for udev_rule_parse_value 2020-10-29 20:19:29 +08:00
Yu, Li-Yu 9abfd759d2 udev: test udev_rule_parse_value() 2020-10-29 20:19:29 +08:00
Yu, Li-Yu aea3253e71 udev: escaped string syntax e"..." in rule files
* Existing valid rule files written with KEY="value" are not affected
* Now, KEY=e"value\n" becomes valid. Where `\n` is a newline character
* Escape sequences supported by src/basic/escape.h:cunescape() is
  supported
2020-10-29 20:15:23 +08:00
Zbigniew Jędrzejewski-Szmek c062cd9dde headers: use custom LicenseRef- spdx tag for various "public domain" files
There is no spdx tag defined for those versions of "public domain", but we can
add a custom tag, see
https://spdx.github.io/spdx-spec/6-other-licensing-information-detected/.

crc32.h is updated to match crc32.c.
2020-10-29 11:41:27 +01:00
Zbigniew Jędrzejewski-Szmek 448e7440c2 headers: add spdx tags to imported files with a known license
I added the header in the cases where the license text is present and it is
easy to find the appropriate SPDX header.

For "public domain" stuff: SDPX treats each "public domain" license as unique [1],
but luckily the one in siphash24.c is one of the identified variants. There are
some other cases which specify "public domain" but there doesn't seem to be a
SPDX identifier.

[1] https://wiki.spdx.org/view/Legal_Team/Decisions/Dealing_with_Public_Domain_within_SPDX_Files

gunicode.[ch] are imported from glib, which is licensed as LGPL2.1+,
see https://gitlab.gnome.org/GNOME/glib/-/blob/master/glib/gunicode.h.
2020-10-29 11:32:24 +01:00
Zbigniew Jędrzejewski-Szmek 59a711c2cd time-wait-sync: drop gpl snail mail boilerplate
No idea why this chunk was left when we removed the other copies.
2020-10-29 10:47:28 +01:00
Zbigniew Jędrzejewski-Szmek 4368277c74 tree-wide: use the usual SPDX header for our own files 2020-10-29 10:47:20 +01:00
Yu Watanabe 7b6c92e6bb journalctl: drop format_journal_url() if gcrypt is not used
Follow-up for f1b823596f.
2020-10-29 00:28:28 -07:00
Zbigniew Jędrzejewski-Szmek 23b13549fa
Merge pull request #17435 from poettering/event-shuffle-refactor
sd-event: split up sd_event_source_set_enable() function
2020-10-28 18:21:13 +01:00
Zbigniew Jędrzejewski-Szmek a1989bd84b
Merge pull request #17454 from keszybz/journal-dlopen-cleanup
Journal dlopen cleanup and qrcode printing test
2020-10-28 18:20:27 +01:00
Zbigniew Jędrzejewski-Szmek 32c3a623ce
Merge pull request #17467 from keszybz/unconditionally-pull-in-cryptsetup-remote
Unconditionally pull in cryptsetup-remote.target in the initramfs
2020-10-28 18:00:04 +01:00
Timo Rothenpieler f1f1714411 networkctl: use and print full hardware address
Intentionally not checking the iftype for the ieee_oui lookup to support
other ethernet-like devices.
2020-10-28 15:18:01 +01:00
Timo Rothenpieler 14b66dbc92 dhcp4: fix DHCP on InfiniBand interfaces
With these patches applied, networkd is successfully able to get an
address from a DHCP server on an IPoIB interface.

1)
Makes networkd pass the actual interface type to the dhcp client,
instead of hardcoding it to Ethernet.

2)
Fixes some issues in handling the larger (20 Byte) IB MAC addresses in
the dhcp code.

3)
Add a new field to networkds Link struct, which holds the interface
broadcast address.

3.1)
Modify the DHCP code to also expect the broadcast address as parameter.
On an Ethernet-Interface the Broadcast address never changes and is always
all 6 bytes set to 0xFF.
On an IB one however it is not neccesarily always the same, thus
fetching the actual address from the interface is neccesary.

4)
Only the last 8 bytes of an IB MAC are stable, so when using an IB MAC to
generate a client ID, only pass those 8 bytes.
2020-10-28 14:44:43 +01:00
Timo Rothenpieler b8162cd200 network: store full hardware address in Link struct
This passes the legacy ethernet address to functions in a lot of places,
which all will need migrated to handle arbitrary size hardware addresses
eventually.
2020-10-28 14:44:43 +01:00
Timo Rothenpieler 4fc8a29a7e sd-netlink: introduce netlink_message_{read,append}_hw_addr
Hardware addresses come in various shapes and sizes, these new functions
and accomapying data structures account for that instead of hard-coding
a hardware address to the 6 bytes of an ethernet MAC.
2020-10-28 14:44:43 +01:00
Lennart Poettering b370adb593 resolved: advertise smaller UDP datagram size on extra stubs 2020-10-28 10:01:07 +01:00
Lennart Poettering 8facd1ce4f resolved: remove redundant conditionalization
If all protocols are listed there's no point in having the if check.

Follow-up for 8b4198373b
2020-10-28 10:01:03 +01:00