Commit graph

32223 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek af229d7a5b login,user-sessions: always warn when we fail to remove nologin file
This usually is very annoying to users who then cannot log in, so
make sure we always warn if that happens (selinux, or whatever other reason).

This reverts a790812cb3.
2018-02-16 10:44:22 +01:00
Zbigniew Jędrzejewski-Szmek 730f40eb57 Merge pull request #8184 from poettering/color-ask-pw
Trivial merge conflict resolved locally.
2018-02-15 17:14:59 +01:00
Zbigniew Jędrzejewski-Szmek 648461c07d Merge pull request #8125 from poettering/cgroups-migrate
Trivial merge conflict resolved locally.
2018-02-15 16:15:45 +01:00
Jakub Filak f45b801551 coredump: accept hostname on command line (#8033)
This commint adds a new command line parameter to sytemd-coredump. The
parameter should be mappend to core_pattern's placeholder %h - hostname.

The field _HOSTNAME holds the name from the kernel's namespaces which might be
different then the one comming from process' namespaces.

It is true that the real hostname is usually available in the field
COREDUMP_ENVIRON (environment variables) but I believe it is more reliable to
use the value passed by kernel.

----

The length of iovec is no longer static and hence I corrected the declarations
of the functions set_iovec_field and set_iovec_field_free.

Thank you @yuwata and @poettering!
2018-02-15 12:12:46 +01:00
Thomas Haller 2e016b98c3 dhcp6: fix uninitialized variable in returning from client_parse_message() (#8187)
Compiler warns about this with -Werror=maybe-uninitialized.

Fixes: 3bc424a3cc
2018-02-15 10:49:55 +01:00
Lennart Poettering 1496ceaf30 mkosi: add pcre2 to our build deps, as we can now link to it 2018-02-14 19:56:24 +01:00
Lennart Poettering fd6ac62c71 ask-password-api: many fixes to ask_password_tty()
A couple of fixes:

1. always bzero_explicit() away what we remove from the passphrase
   buffer. The UTF-8 code assumes the string remains NUL-terminated, and
   we hence should enforce that. memzero() would do too here, but let's
   be paranoid after all this is key material.

2. when clearing '*' characters from string, do so counting UTF-8
   codepoints properly. We already have code in place to count UTF-8
   codepoints when generating '*' characters, hence we should take the
   same care when clearing them again.

3. Treat NUL on input as an alternative terminator to newline or EOF.

4. When removing characters from the password always also reset the
   "codepoint" index properly.
2018-02-14 18:47:20 +01:00
Lennart Poettering 65ee8660df utf8: add utf8_n_codepoints() for counting complete utf8 codepoints in a string 2018-02-14 18:41:03 +01:00
Lennart Poettering 7b91264852 terminal-util: make resolve_dev_console() less weird
Let's normalize the behaviour: return a negative errno style error code,
and return the resolved string directly as argument.
2018-02-14 17:30:37 +01:00
Lennart Poettering bef41af233 terminal-util: modernize get_kernel_consoles() a bit
Also, make sure when we run in a container, we don't use the data from
/sys at all, but immediately fall back to /dev/console itself.
2018-02-14 14:56:17 +01:00
Lennart Poettering c2b3215941 tty-ask-password-agent: reenable color for boot-time password prompt
The password prompt used to be highlighted, and that was a good thing.
Let's fix things to make the prompt highlighted again.

Fixes: #3853
2018-02-14 14:30:30 +01:00
Lennart Poettering 0295642dda terminal-util: add some explanatory comments 2018-02-14 14:28:17 +01:00
Lennart Poettering 6b7b0f3947 update TODO 2018-02-14 14:28:00 +01:00
Lennart Poettering e70f445306 process: shortcut getenv_for_pid() for our own process 2018-02-14 14:27:31 +01:00
Lucas Werkmeister cac26f0bc8 man: make systemd-socket-activate point to systemd-run (#8151)
Now that systemd-run also supports socket units, it makes sense to link
to that command from the systemd-socket-activate manpage.
2018-02-14 14:11:24 +01:00
Boucman 49219a1c03 Allow timers to trigger timers (#8043)
Unlike any other unit type, it makes sense for a timer to start another
timer. It is an easy way to crate logical "and" between time conditions

for instance, every day but no less than 5' after boot can easily be
implemented by a OnBootSec triggering an OnCalendar.

This is particulary usefull with Persistant timers which tend to all fire
together at startup
2018-02-14 14:10:07 +01:00
Davide Cavalca c83812b1c4 meson: factor out daemon/event/id128 sources into variables (#8170) 2018-02-14 14:08:50 +01:00
Piotr Drąg b9658e6a08 po: update Polish translation (#8169) 2018-02-14 14:06:14 +01:00
Zbigniew Jędrzejewski-Szmek 04a5236233
Merge pull request #8144 from poettering/journal-inotify-fixes
various journal fixes
2018-02-14 13:52:17 +01:00
Jan Synacek f37a53b6ae man: link latest FHS spec in file-hierarchy(7) (#8178) 2018-02-14 19:34:47 +09:00
Sylvain Plantefève 09609000a5 po: update French translation 2018-02-14 09:55:27 +01:00
Zbigniew Jędrzejewski-Szmek 1288b5405f mailmap: one more person
For a083b4875e.
2018-02-14 09:43:49 +01:00
Lennart Poettering f612f8fb93 ask-password: pretty flags enum definition a bit 2018-02-14 00:13:26 +01:00
Lennart Poettering daa557208d tty-ask-password-agent: don't open terminal multiple times
We already have the terminal open, hence pass the fd we got to
ask_password_tty(), so that it doesn't have to reopen it a second time.

This is mostly an optimization, but it has the nice benefit of making us
independent from RLIMIT_NOFILE issues and so on, as we don't need to
allocate another fd needlessly.
2018-02-14 00:11:16 +01:00
Lennart Poettering 088dcd8e41 ask-password: derive pollfd array from enum
It's prettier that way!
2018-02-14 00:03:05 +01:00
Lennart Poettering c9eb4a0054 ask-password: round up when determining sleep time
We should rather sleep to much than too little. This otherwise might
result in a busy loop, because we slept too little and then recheck
again coming to the conclusion we need to go to sleep again, and so on.
2018-02-14 00:03:05 +01:00
Lennart Poettering 70dee4755a ask-password: let's use structure initialization properly 2018-02-14 00:03:04 +01:00
Lennart Poettering ac7a9674e4 ask-password: let's (void) cast where appropriate 2018-02-14 00:03:04 +01:00
Lennart Poettering a497a2966e ask-password: bypass clean-up if we don't need it 2018-02-13 23:56:57 +01:00
Lennart Poettering 0f13392851 ask-password: don't use ttyfd if it is not set 2018-02-13 23:55:58 +01:00
Lennart Poettering befd657b00 tty-ask-password-agent: show right TTY path in error message 2018-02-13 23:55:19 +01:00
Lennart Poettering 5439206bc7 tty-ask-password-agent: assing sendto() result to a ssize_t variable, not an int
We should be careful with these types, and if we do convert between
"int" and "ssize_t" we should do so explicitly rather than implicitly.
Otherwise this just looks like a bug.
2018-02-13 23:53:59 +01:00
Lennart Poettering 87964ec7d1 terminal-util: minor, trivial fixes and improvements 2018-02-13 23:53:34 +01:00
Lennart Poettering c6063244db terminal-util: when making /dev/null or the console stdio, forget cached terminal features
Let's forget all relevant terminal features we learnt when we make a
console or /dev/null stdin/stdout/stderr.

Also, while we are at it, let's drop the various _unlikely_ and
_likely_ annotiations around the terminal feature caches. In many cases
we call the relevant functions only once in which cases the annotations
are likely to do just harm and no good. After all we can't know if the
specific code will call us just once or many times...
2018-02-13 23:50:26 +01:00
Lennart Poettering 8854d79504 terminal-util: rework acquire_terminal()
This modernizes acquire_terminal() in a couple of ways:

1. The three boolean arguments are replaced by a flags parameter, that
   should be more descriptive in what it does.

2. We now properly handle inotify queue overruns

3. We use _cleanup_ for closing the fds now, to shorten the code quite a
   bit.

Behaviour should not be altered by this.
2018-02-13 21:24:37 +01:00
Lennart Poettering 149bc84aac tty-ask-password-agent: make code a tiny bit shorter 2018-02-13 19:17:17 +01:00
Alan Jenkins 8afabc5090 manager: avoid infinite loop for unexpected waitid() error (#8168)
I think if we log the error as being _ignored_, we should also consider
the event as handled and clear it.  This was the behaviour prior to
575b300b (PR #7968).

I don't think we particularly wanted to change behaviour and keep retrying.
Sometimes that's useful, other times you cause more problems by filling the
logs.

Plus a nearby typo fix.
2018-02-13 19:04:31 +01:00
AsciiWolf 372771c8d3 l10n: update POTFILES.in (#8163) 2018-02-13 12:05:22 +09:00
itsbill a083b4875e tmpfiles: age root-owned read-only files, by default (#7917)
[zj: The note in NEWS was added in 82c8e3e650
and released as part of systemd-237.]
2018-02-12 15:47:08 +01:00
Lennart Poettering 1e78432157 update TODO 2018-02-12 11:34:00 +01:00
Lennart Poettering 6592b9759c core: add new new bus call for migrating foreign processes to scope/service units
This adds a new bus call to service and scope units called
AttachProcesses() that moves arbitrary processes into the cgroup of the
unit. The primary user for this new API is systemd itself: the systemd
--user instance uses this call of the systemd --system instance to
migrate processes if itself gets the request to migrate processes and
the kernel refuses this due to access restrictions.

The primary use-case of this is to make "systemd-run --scope --user …"
invoked from user session scopes work correctly on pure cgroupsv2
environments. There, the kernel refuses to migrate processes between two
unprivileged-owned cgroups unless the requestor as well as the ownership
of the closest parent cgroup all match. This however is not the case
between the session-XYZ.scope unit of a login session and the
user@ABC.service of the systemd --user instance.

The new logic always tries to move the processes on its own, but if
that doesn't work when being the user manager, then the system manager
is asked to do it instead.

The new operation is relatively restrictive: it will only allow to move
the processes like this if the caller is root, or the UID of the target
unit, caller and process all match. Note that this means that
unprivileged users cannot attach processes to scope units, as those do
not have "owning" users (i.e. they have now User= field).

Fixes: #3388
2018-02-12 11:34:00 +01:00
Lennart Poettering 931e47547d core: in bus_init_system() make sure we setup the system bus even if we inherit the API bus
This corrects the control flow: when we reuse the API bus as system bus,
let's definitely invoke bus_init_system() too, so that it is called
regardless how we acquired the bus object.

(Note that this doesn't actually change anything, as we only inherit the
bus like this in system mode, and bus_init_system() doesn't do anything
in system bus, besides writing a log message)
2018-02-12 11:34:00 +01:00
Lennart Poettering 6edd281cb8 bus: in bus_foreach_bus() don't bother with api_bus if it is NULL
Let's better be safe than sorry, and validate that api_bus is not NULL
before we send messages to it. Of course, strictly speaking this
shouldn't actually be necessary, as the tracker object should not exist
without the bus, but let's be extra sure.
2018-02-12 11:34:00 +01:00
Lennart Poettering dfeff66499 bus: when destroying a bus, also destroy per-unit bus track objects associated with it
Let's not keep the old bus object pinned this way, let's destroy all
relevant trackers for units, the way we already destroy them for jobs.
2018-02-12 11:34:00 +01:00
Lennart Poettering 5f109056d5 core: delay bus name synchronization after reload/reexec into a later event loop iteration
Previously, we'd synchronize bus names immediately when we succeeded
connecting to the bus, potentially even before coldplugging the units.
This was problematic, as synchronizing bus names meant invoking the
per-unit name change handler function which might change the unit's
state — which will result in consistency when done before we coldplug
things.

With this change we instead enqueue a job for the event loop to resync
the names in a later loop iteration, i.e. at a point where we know
coldplugging has finished.
2018-02-12 11:34:00 +01:00
Lennart Poettering 030fa56c6e core: set a description on private bus connections
Let's make things easier to debug
2018-02-12 11:34:00 +01:00
Lennart Poettering 201e419aea sd-bus: synthesize a description for user/system bus if otherwise unset
Let's make debugging easier, by synthesizing a name when we have some
indication what kind of bus this is.
2018-02-12 11:34:00 +01:00
Lennart Poettering 96cc44539b core: generalize how we acquire the Unit objects for unit names in bus calls
This splits out the code that translates a unit name into a Unit* object
from method_get_unit(), and reuses it all other functions that operate
similar to it. This effectively means all those calls now optionally
take an empty unit string which now means the same as the client's unit.
This useful behaviour of the GetUnit() bus call is thus extended to all
other matching bus calls.

Similar, the same logic from method_load_unit() is also generalized and
reused wherever appropriate.
2018-02-12 11:34:00 +01:00
Lennart Poettering 7cb609115c user-util: also consider /bin/false and /bin/true as non-shell 2018-02-12 11:34:00 +01:00
Lennart Poettering a6011d1887 core: update dbus policy file
This patch does four things:

1. Adds more comments that clarify the order in which things appear in
   the file

2. All entries are placed in the order in which their SD_BUS_METHOD()
   macros appear in the C vtables.

3. A couple of missing entries are added that should be open to all or
   do polkit

4. Corrects the interface name for the GetProcesses() calls. They belong
   to the per-unit interface, not to Unit
2018-02-12 11:34:00 +01:00