Commit Graph

31558 Commits

Author SHA1 Message Date
Lennart Poettering 46099c9e36 update TODO 2018-01-04 13:28:24 +01:00
Lennart Poettering 99c61f6b00 fileio: minor tweak to executable_is_script()
If read_line() returns ENOBFUS this means the line was overly long. When
we use this for checking whether an executable is a script, then this
shouldn't be propagated as-is, but simply as "this is not a script".
2018-01-04 13:28:24 +01:00
Lennart Poettering 91dc2bf74d fileio: tweak write_string_stream_ts() to write out trailing \n in one go even if buffering is off
This tweaks write_string_stream_ts() in one minor way: when stdio
buffering has been turned off, let's append the newline we shall append
to the buffer we write ourselves so that the kernel only gets one
syscall for the result. When buffering is enabled stdio will take care
of that anyway.

Follow-up for #7750.
2018-01-04 13:28:24 +01:00
Lennart Poettering 3e641e361d sd-bus: port one use of SO_PEERCRED by getpeercred() 2018-01-04 13:28:24 +01:00
Lennart Poettering 86ed6d1b1f sd-bus: let's use mfree() where we can 2018-01-04 13:28:24 +01:00
Lennart Poettering 18ac4643cb sd-bus: use SO_PEERGROUPS when available to identify groups of peer 2018-01-04 13:28:24 +01:00
Lennart Poettering 2fce06b0d6 journald: introduce new uid_for_system_journal() helper
We use the same check at two places, let's add a tiny helper function
for it, since it's not entirely trivialy, and we changes this before
multiple times, and it's a good thing if we can change it at one place
only instead of multiple.
2018-01-04 13:28:24 +01:00
Lennart Poettering 217d896782 socket-util: slight rework of getpeersec()
Let's call getsockopt() in a loop, so that we can deal correctly with
the label changing while we are trying to read it.

(also, while we are at it, let's make sure that there's always one
trailing NUL byte at the end of the buffer, after all SO_PEERSEC has
zero documentation, and multiple implementing backends, hence let's
better be safe than sorry)
2018-01-04 13:28:24 +01:00
Lennart Poettering bbcc701ee7 tree-wide: use {pid,uid,gid}_is_valid() where appropriate
Also, drop UID/GID validity checks from getpeercred() as the kernel will
never pass us invalid UID/GID on userns, but the overflow UID/GID
instead. Add a comment about this.
2018-01-04 13:27:54 +01:00
Lennart Poettering 10e859a2f3 calenderspec: when normalizing, flush out UTC timezone 2018-01-04 13:27:27 +01:00
Lennart Poettering 2dc894541f user-util: minor updates of in_gid()
Let's use newa() and use the right type for storing sysconf() return
values.
2018-01-04 13:27:27 +01:00
Lennart Poettering 43f2c88df0 socket-util: add new getpeergroups() call
It's a wrapper around the new SO_PEERGROUPS sockopt, similar in style as
getpeersec() and getpeercred().
2018-01-04 13:27:27 +01:00
Lennart Poettering 5e9f01e8a6 tree-wide: in all threads we fork off in library code, block all signals
This ensures that in all threads we fork off in the background in our
code we mask out all signals, so that our thread won't end up getting
signals delivered the main process should be getting.

We always set the signal mask before forking off the thread, so that the
thread has the right mask set from its earliest existance on.
2018-01-04 13:27:27 +01:00
Lennart Poettering be39f6ee31 process-util: add new FORK_NEW_MOUNTNS flag to safe_fork()
That way we can move one more code location to use safe_fork()
2018-01-04 13:27:27 +01:00
Lennart Poettering 3f60395254 pager: let's move static variables up, to the rest of them
let's keep static variables together, and before the function
definitions.
2018-01-04 13:27:27 +01:00
Lennart Poettering 85afeae88c pager,agent: insist that we are called from the main thread
We maintain static process-wide variables in these subsystems without
locking, hence let's refuse operation unless we are called from the main
thread (which we do anyway) just as a safety precaution.
2018-01-04 13:27:27 +01:00
Lennart Poettering b4a343112e tree-wide: use EXIT_SUCCESS when comparing child process exit statuses
When we check the exit status of a subprocess, let's compare it with
EXIT_SUCCESS rather than 0 when looking for success.

This clarifies in code what kind of variable we are looking at and what
we are doing.
2018-01-04 13:27:27 +01:00
Lennart Poettering d2e0ac3d1e tree-wide: unify the process name we pass to wait_for_terminate_and_check() with the one we pass to safe_fork() 2018-01-04 13:27:27 +01:00
Lennart Poettering 2e87a1fde9 tree-wide: make use of wait_for_terminate_and_check() at various places
Using wait_for_terminate_and_check() instead of wait_for_terminate()
let's us simplify, shorten and unify the return value checking and
logging of waitid().  Hence, let's use it all over the place.
2018-01-04 13:27:27 +01:00
Lennart Poettering 1f5d1e0247 process-spec: add another flag FORK_WAIT to safe_fork()
This new flag will cause safe_fork() to wait for the forked off child
before returning. This allows us to unify a number of cases where we
immediately wait on the forked off child, witout running any code in the
parent after the fork, and without direct interest in the precise exit
status of the process, except recgonizing EXIT_SUCCESS vs everything
else.
2018-01-04 13:27:27 +01:00
Lennart Poettering 66fb11423b exec-util: drop redundant log message in do_spawn()
safe_fork() logs that anyway, hence no need to do this twice.
2018-01-04 13:27:27 +01:00
Lennart Poettering 7d4904fe7a process-util: rework wait_for_terminate_and_warn() to take a flags parameter
This renames wait_for_terminate_and_warn() to
wait_for_terminate_and_check(), and adds a flags parameter, that
controls how much to log: there's one flag that means we log about
abnormal stuff, and another one that controls whether we log about
non-zero exit codes. Finally, there's a shortcut flag value for logging
in both cases, as that's what we usually use.

All callers are accordingly updated. At three occasions duplicate logging
is removed, i.e. where the old function was called but logged in the
caller, too.
2018-01-04 13:27:27 +01:00
Lennart Poettering b6e1fff13d process-util: add another fork_safe() flag for enabling LOG_ERR/LOG_WARN logging 2018-01-04 13:27:26 +01:00
Lennart Poettering 799a960d1f raw-clone: beef up raw_clone() wrapper a bit
First of all, let's return pid_t, which appears to be the correct type
given that we return PIDs, and it#s what fork() uses too.

Most importantly though, flush out our PID cache, so that the call
becomes compatible with our getpid_cached() logic.
2018-01-04 13:27:26 +01:00
Lennart Poettering 3139096321 vconsole-setup: add some void casts 2018-01-04 13:27:26 +01:00
Lennart Poettering 8ed7742aa2 ip-address-access: let's exit the loop after invalidating our entry a (#7803)
CID#1382967
2018-01-04 13:24:40 +01:00
Mike Gilbert 2fa645f1cc meson: don't search PATH for telinit (#7770)
On a typical system running systemd, the telinit in PATH is very likely to be a symlink
to systemctl. Setting TELINIT to this may result in an infinite recursion if telinit is called
and sd_booted() == 0. This may commonly occur in a chroot environment.

Bug: https://bugs.gentoo.org/642724

[zj:
The path was originally hardcoded as "/lib/upstart/telinit", but was made configurable without
changing the default in 4ad61fd180. Then the default was
changed to `/lib/sysvinit/telinit` in abaaabf40a. Then it
started being  autodetected when meson support was added in 
5c23128dab. This patch restores the behaviour that was 
implemented in configure.ac at the time of its removal.]
2018-01-04 13:14:20 +01:00
Lennart Poettering 3046b6db1d
main: don't bother with the return value of invoke_mainloop() (#7802)
We don't use the return value, and we don't have to, as the call already
initializes &ret, which is the one we return as exit code from the
process.

CID#1384230
2018-01-04 12:55:21 +01:00
Lennart Poettering 3282774050
Merge pull request #7801 from keszybz/docs-and-coverity
Docs and coverity
2018-01-04 12:38:27 +01:00
Shawn Landden 7ddc2dc5e6 fix machinectl shell (in machined) (#7785)
4c253ed broke machined
$machinectl shell arch
Failed to get shell PTY: Input/output error

Closes: #7779

v2: do not drop DEATHSIG flag
2018-01-04 12:37:15 +01:00
Zbigniew Jędrzejewski-Szmek 97149f405c core: fix mac_selinux_setup return value check
Introduced in 74da609f0d. CID #1384210.
2018-01-04 11:31:37 +01:00
Zbigniew Jędrzejewski-Szmek 1330648562 core: double free in bus_timer_set_transient_property
Introduced in 3e3c5a4571. CID #1384233.
2018-01-04 11:31:37 +01:00
Zbigniew Jędrzejewski-Szmek 1893972894 run: double free
Introduced in f2b9f2c83e. CID #1384218.
2018-01-04 11:31:30 +01:00
Zbigniew Jędrzejewski-Szmek 85f8fa4dee test-sizeof: also add uid_t
We had gid_t, and pid_t, but not uid_t. Add for completeness.
2018-01-04 11:16:19 +01:00
Zbigniew Jędrzejewski-Szmek 7f8b3d1d32 man: drop --arch from debootstrap invocation
Nowadays people use systemd on many different architectures, so we
shouldn't presuppose that they are using amd64. debootstrap defaults
to the native architecture and this should be good enough.
2018-01-04 11:16:19 +01:00
Patrik Flykt 7ac6c26a22 dhcp6: Fix DHCPv6 client file descriptor and event handling (#7796)
Close DHCPv6 client socket file descriptor when
sd_dhcp6_client_stop() is called and not when client_reset() is
called. If left in client_reset(), any internal temporary stopping
of the DHCPv6 client with client_stop() will call client_reset()
after which the DHCPv6 client will not be able to receive any further
DHCPv6 messages.

Similarly, client_start() needs to enable events for the DHCPv6
socket file descriptor since a call to client_stop() will call
client_reset() which will remove it from the main loop. Events should
be turned off when no DHCPv6 messages are expected.
2018-01-04 11:02:52 +01:00
George G 0ceced3d9a README: EXT4_POSIX_ACL -> EXT4_FS_POSIX_ACL (#7799)
EXT4_POSIX_ACL doesn't exist.
2018-01-04 08:53:44 +01:00
Lennart Poettering 4ab02a0d36
Merge pull request #7793 from rojkov/fix-6456
resolved: fix refcounting DnsScope's conflict_queue
2018-01-03 18:43:14 +01:00
Lennart Poettering fb92330ccc
Merge pull request #7759 from yuwata/dbus-api
DBus-API: add more options in transient units
2018-01-03 18:41:32 +01:00
Lennart Poettering 7f9ac71c76
Merge pull request #7705 from keszybz/redo-linking
Redo linking
2018-01-03 18:37:00 +01:00
Paul Cercueil 04a0ea93cb hwdb: Add accelerometer orientation entry for Teclast X98 Plus II tablet (#7766) 2018-01-03 15:54:06 +01:00
Boucman da933f7dcf fix systemd-analyze time when default.target is not reached (#7764)
Also, better error messages.
2018-01-03 15:52:13 +01:00
Dmitry Rozhkov c1227a1840 resolved: use DNS_ANSWER_FOREACH instead of for 2018-01-03 15:04:20 +02:00
Dmitry Rozhkov cfcc8dcc86 resolved: skip conflict notifications for DNS-SD PTR RRs
Enumerating DNS-SD PTR resource records are a special case and
are supposed to have non-unique keys pointing to services of the
same type running on different hosts. There's no need for them
to be checked for conflicts.

Thus don't check for conflicts such RRs.
2018-01-03 15:04:20 +02:00
Dmitry Rozhkov 432d108c25 resolved: fix refcounting DnsScope's conflict_queue
Refcounting for a RR's key is done separately from refcounting
for the RR itself, but in dns_scope_notify_conflict() we don't
do that. This may lead to a situation when a RR key put in the
conflict_queue hash as a value's key gets freed upon
cache reduction when it's still referenced by the hash.

Thus increase refcount for the key when putting it into the hash
and unreference it upon removing from the hash.

Closes #6456
2018-01-03 15:04:20 +02:00
Zbigniew Jędrzejewski-Szmek 7f1ea2cc94 meson: add a single .h file to shared libs with no sources
Otherwise stuff doesn't build on old Ubuntu with meson-0.42.1-1~xenial.
2018-01-03 12:09:46 +01:00
Zbigniew Jędrzejewski-Szmek 568a4ff8b1 meson: use a convenience lib for shared resolve files
This reduces the man=false meson target count from 1281 to 1253.

--

A fully scientific test:
  git grep _sources, :/*.build|cut -d: -f2|tr -d ' '|sort|uniq -c
reveals that libudev_sources is the only source list now reused twice.  There's
some ugly circular dependency between libudev and libshared, and anyway I'm not
sure if we don't want to use different compilation options (LOG_REALM_…) in
those two cases, so I'm leaving that alone for now.
2018-01-03 12:09:46 +01:00
Zbigniew Jędrzejewski-Szmek 0c06b50662 meson: rename libudev_internal to libudev_static and link into libudev
This reduces the meson man=false target count to 1281.

v2:
- link test-engine with libshared instead of libsystemd_static
Previous version built fine on F27, but fails on F26 with the following error:
/usr/bin/ld: /tmp/ccr8HRGw.ltrans6.ltrans.o: undefined reference to symbol '__start_BUS_ERROR_MAP@@SD_SHARED'
/home/zbyszek/fedora/systemd/systemd-9d5aae75c64f5583a110f03b94816aacc03bbf4d/x86_64-redhat-linux-gnu/src/shared/libsystemd-shared-236.so: error adding symbols: DSO missing from command line

v3:
- add libudev_basic
2018-01-03 12:09:46 +01:00
Zbigniew Jędrzejewski-Szmek 5e3cec87be meson: use a convenience lib for journal user sources
Instead of compiling those files twice, once for libsystemd and once for
libshared, compile once as a static archive and then link into both.
This reduce the meson target for man=no compile to 1291.
2018-01-03 12:09:46 +01:00
Zbigniew Jędrzejewski-Szmek a8e559d4c6 meson: link libsystemd_static in libshared instead of recompiling
This is similar to the great-grandpa commit. This time the number
of meson targets compilation without man is reduced from 1347 to 1302.
2018-01-03 12:09:46 +01:00