Commit Graph

44944 Commits

Author SHA1 Message Date
Lennart Poettering 90810f7a37 sd-dhcp-server: some function prototype fix-ups
Let's use size_t for numbers of entries in memory.

Let's use const wherever appropriate.

Drop `_server` suffix from function name where we don't have it for
similar other cases.
2020-05-14 17:11:44 +02:00
Evgeny Vereshchagin 4b129fba30 cifuzz: set allowed-broken-targets-percentage to 0 2020-05-14 10:33:54 +02:00
Lennart Poettering 2b8c2fbb2d
Merge pull request #15765 from benjarobin/fix_kw
Various bug fixes
2020-05-14 09:08:47 +02:00
Lennart Poettering 3250501865
Merge pull request #15660 from benjarobin/perf_barrier_fd
Faster manager_process_barrier_fd and drop message if BARRIER=1 found
2020-05-14 09:07:41 +02:00
Lennart Poettering de07add2c9
Merge pull request #15801 from poettering/journal-pid-change-fix
journald: stream pid change newline fix
2020-05-14 09:04:23 +02:00
Christian Göttsche 9bf4984a2a selinux: add parenthesis to function names in log messages 2020-05-14 09:03:51 +02:00
Evgeny Vereshchagin 5141b4e3b6 ci: install fdisk on Debian
To judge from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=947134 and
44ec91ef11,
`util-linux` no longer depends on `fdisk` so it seems it should be installed
manually.
2020-05-14 04:24:49 +03:00
Benjamin Robin 243945e95e test: Add return 0 to main() function (even it is not strictly necessary) 2020-05-13 22:56:42 +02:00
Benjamin Robin fbb0b66577 systemctl: Check clean_or_freeze_unit(): Add assert if unknown method 2020-05-13 22:56:42 +02:00
Benjamin Robin 81c5a5961f network: 'cur' variable cannot be null, so simplify code 2020-05-13 22:56:42 +02:00
Benjamin Robin b9c54c4665 tree-wide: Initialize _cleanup_ variables if needed 2020-05-13 22:56:42 +02:00
Benjamin Robin 179b4db439 netlink: Fix assert condition on n_containers 2020-05-13 22:56:42 +02:00
Benjamin Robin 5151b4ccd2 core: Parse the tags list sooner, and use it for multiple function
- Parse the tags list using strv_split_newlines() which remove any
   unnecessary empty string at the end of the strv.
 - Use this parsed list for manager_process_barrier_fd() and every call
   to manager_invoke_notify_message().
 - This also allow to simplify the manager_process_barrier_fd() function.
2020-05-13 22:44:12 +02:00
Lennart Poettering a3d9aee14f man: document the new _LINE_BREAK= type 2020-05-13 21:32:49 +02:00
Benjamin Robin d38b3b74db test: Stricter test case for #15654 (Add more checks)
Check:
 - There is only 3 messages logged with type stdout
 - Check all messages logged does not have new line: LINE_BREAK=eof
 - Check that the 3 messages are logged from a different PID
 - Check the 3 MESSAGE= content
2020-05-13 21:32:45 +02:00
Benjamin Robin c11d8fd1da test: Add a test case for #15654 2020-05-13 21:32:42 +02:00
Lennart Poettering 45ba1ea5e9 journald: rework pid change handling
Let's introduce an explicit line ending marker for line endings due to
pid change.

Let's also make sure we don't get confused with buffer management.

Fixes: #15654
2020-05-13 21:32:38 +02:00
Lennart Poettering 020b4a023c journald: use the fact that client_context_release() returns NULL 2020-05-13 21:32:34 +02:00
Lennart Poettering 549b7379ba journald: rework end of line marker handling to use a field table 2020-05-13 21:32:30 +02:00
Lennart Poettering 5fe7fb0bf6 journald: use log_warning_errno() where appropriate 2020-05-13 21:32:25 +02:00
Benjamin Robin 034e9719ac journald: Increase stdout buffer size sooner, when almost full
If the previous received buffer length is almost equal to the allocated
buffer size, before this change the next read can only receive a couple
of bytes (in the worst case only 1 byte), which is not efficient.
2020-05-13 21:31:58 +02:00
Evgeny Vereshchagin e65848175f semaphore: use dots instead of dashes
Borrowed from https://salsa.debian.org/systemd-team/systemd/-/commit/511d5d5452d29bd3af7.
2020-05-13 18:36:10 +02:00
Lennart Poettering 0271e9b10c man: complete vtable flag documentation 2020-05-13 16:57:44 +02:00
Lennart Poettering 491ce16103 sd-bus: introduce new SD_BUS_VTABLE_ABSOLUTE_OFFSET vtable flag
When set, the offset specified for the vtable entry is passed to the
handler as-is, and is not added to the userdata pointer. This is useful
in case methods/properties are mixed on the same vtable, that expect to
operate relative to some object in memory and that expect pointers to
absolute memory, or that just want a number passed.
2020-05-13 16:57:44 +02:00
Lennart Poettering 61c12865f5 resolved: port to stat_inode_unmodified() 2020-05-13 16:57:44 +02:00
Lennart Poettering fee5c52ac2 stat-util: add stat_inode_unmodified() helper that checks if an inode was modified 2020-05-13 16:57:44 +02:00
Дамјан Георгиевски 5a0173147b
docs: add some backticks and more formatting to PASSWORD_AGENTS.md (#15803)
docs: add some backticks and more formatting to PASSWORD_AGENTS.md
2020-05-13 14:52:09 +02:00
Zbigniew Jędrzejewski-Szmek 053fbf54fc
Merge pull request #15795 from gdamjan/master
docs: import password agents documentation
2020-05-13 08:32:57 +02:00
Lennart Poettering 266dd55505 systemctl: fix indentation of 'Active:' field in status output
Somehow two spaces got lost in d9e45bc3ab here, which made the status
output all unaligned. Let's put them back in.
2020-05-13 08:32:40 +02:00
Jeremy Cline 8284f81bf7 Tidy up the Fedora mkosi Package list
libzstd is a new dependency for systemd that's not in a stable release
yet, so it's not pulled in by the RPM package dependency. Manually
include it in the package section so the image mkosi produces works. It
can be removed when the RPM depends on it.

Additionally, a number of packages in the list appear to be pulled in
because they're dependencies in the systemd rpm, so remove them.
Finally, mkosi v5 adds the proper fs utilities for bootable images type
so drop that dependency as well.
2020-05-13 08:23:51 +02:00
Дамјан Георгиевски 8623836502 fix WikiWord not-links 2020-05-13 04:56:50 +02:00
Topi Miettinen 7d85383edb tree-wide: add size limits for tmpfs mounts
Limit size of various tmpfs mounts to 10% of RAM, except volatile root and /var
to 25%. Another exception is made for /dev (also /devs for PrivateDevices) and
/sys/fs/cgroup since no (or very few) regular files are expected to be used.

In addition, since directories, symbolic links, device specials and xattrs are
not counted towards the size= limit, number of inodes is also limited
correspondingly: 4MB size translates to 1k of inodes (assuming 4k each), 10% of
RAM (using 16GB of RAM as baseline) translates to 400k and 25% to 1M inodes.

Because nr_inodes option can't use ratios like size option, there's an
unfortunate side effect that with small memory systems the limit may be on the
too large side. Also, on an extremely small device with only 256MB of RAM, 10%
of RAM for /run may not be enough for re-exec of PID1 because 16MB of free
space is required.
2020-05-13 00:37:18 +02:00
Lennart Poettering 7cc8fb3ef0 update TODO 2020-05-12 23:56:26 +02:00
Lennart Poettering 08d50deaf8 core: don't bind varlink socket if running in test mode
Fixes: #15748
2020-05-12 22:10:49 +02:00
Дамјан Георгиевски 67a40f217c docs: import password agents documentation
imported from:
https://cgit.freedesktop.org/wiki/www/plain/Software/systemd/PasswordAgents.mdwn
2020-05-12 20:31:44 +02:00
Lennart Poettering 6c8428bb8b pam_systemd_home: also store acquirement fd per user
We might pin a home through authentication and a different one through a
session, all from the same PAM context, like sudo does. Hence also store
the referencing fd keyed by the user name.
2020-05-12 17:38:32 +02:00
Lennart Poettering dbe7fff476 pam_systemd/pam_systemd_home: rework how we cache user records
Since acquiring user records involves plenty of IPC we try to cache user
records in the PAM context between our various hooks. Previously we'd
just cache whatever we acquired, and use it from the on, forever until
the context is destroyed.

This is problematic however, since some programs (notably sudo) use the
same PAM context for multiple different operations. Specifically, sudo
first authenticates the originating user before creating a session for
the destination user, all with the same PAM context. Thankfully, there
was a safety check for this case in place that re-validated that the
cached user record actually matched our current idea of the user to
operate on, but this just meant the hook would fail entirely.

Let's rework this: let's key the cache by the user name, so that we do
not confused by the changing of the user name during the context's
lifecycle and always, strictly use the cached user record of the user we
operate on.

Essentially this just means we now include the user name in the PAM data
field.

Secondly, this gets rid of the extra PAM data field that indicates
whether a user record is from homed or something else. To simplify
things we instead just cache the user record twice: once for consumption
by pam_systemd_home (which only wants homed records) and once shared by
pam_systemd and pam_systemd_home (and whoever else wants it). The cache
entries simply have different field names.
2020-05-12 17:38:32 +02:00
Lennart Poettering 0289b4ec69
Merge pull request #15785 from poettering/pam-sudo-fixes-part1
some simple PAM fixes split out of #15742
2020-05-12 15:54:42 +02:00
Zbigniew Jędrzejewski-Szmek cd8fdc2c73
Merge pull request #15789 from poettering/homed-bus-api
man: document homed bus API
2020-05-12 11:42:40 +02:00
Lennart Poettering 3d9237d666 update TODO 2020-05-12 11:10:34 +02:00
Lennart Poettering 45c5fa253a pam_systemd: also print debug lines when ending a session 2020-05-12 11:10:30 +02:00
Lennart Poettering 3400bc866d pam_systemd: drop unused uid argument from export_legacy_dbus_address() 2020-05-12 11:10:27 +02:00
Lennart Poettering da4340fd43 pam_systemd_home: use correct macro for converting ptr to fd 2020-05-12 11:10:10 +02:00
Lennart Poettering 2dffb32309 man: document homed D-Bus API 2020-05-12 11:07:01 +02:00
Lennart Poettering 55842c7326 homed: fix parameter names on D-Bus methods
These arguments contain UserRecord structures serialized to JSON,
however only the "secret" part of it, not a whole user record. We do
this since the secret part is conceptually part of the user record and
in some contexts we need a user record in full with both secret and
non-secret part, and in others just the secret and in other just the
non-secret part, but we want to keep this in memory in the same logic.

Hence, let's rename the arguments where we expect a user record
consisting only of the secret part to "secret".
2020-05-12 11:06:46 +02:00
Lennart Poettering 671fee1873 man: run man/update-dbus-docs again 2020-05-12 11:06:28 +02:00
Lennart Poettering 9e45fb09bf netlink: port to recvmsg_safe()
This also makes sure the control buffer is properly aligned. This
matters, as otherwise the control buffer might not be aligned and the
cmsg buffer counting might be off. The incorrect alignment is becoming
visible by using recvmsg_safe() as we suddenly notice the MSG_CTRUNC bit
set because of this.

That said, apparently this isn't enough to make this work on all
kernels. Since I couldn't figure this out, we now add 1K to the buffer
to be sure. We do this once already, also for a pktinfo structure
(though an IPv4/IPv6) one. I am puzzled by this, but this shouldn't
matter much. it works locally just fine, except for those ubuntu CI
kernels...

While we are at it, make some other changes too, to simplify and
modernize the function.
2020-05-12 10:47:06 +02:00
Joel Shapiro d423294394 Fix misuse of PAM_PROMPT_ECHO_OFF in systemd-homed
Previously pam_systemd_home.so was relying on `PAM_PROMPT_ECHO_OFF` to
display error messages to the user and also display the next prompt.
`PAM_PROMPT_ECHO_OFF` was never meant as a way to convey information to
the user, and following the example set in pam_unix.so you can see that
it's meant to _only_ display the prompt. Details about why the
authentication failed should be done in a `PAM_ERROR_MSG` before
displaying a short prompt as per usual using `PAM_PROMPT_ECHO_OFF`.
2020-05-12 00:27:08 +02:00
Zbigniew Jędrzejewski-Szmek 9b107000ab
Merge pull request #15762 from keszybz/gcc-10-build
Fix build with -O3 with gcc 10
2020-05-11 19:43:40 +02:00
Andrew Doran e7d5fe17db DHCP client: make SendOption work for DHCPv6 too. 2020-05-11 16:31:08 +02:00