summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: use coccinelle to patch a lot of code to use mfree()Lennart Poettering2015-09-0941-173/+80
| | | | | | | | | | | | | | This replaces this: free(p); p = NULL; by this: p = mfree(p); Change generated using coccinelle. Semantic patch is added to the sources.
* Merge pull request #1190 from poettering/rework-virtDaniel Mack2015-09-0829-293/+316
|\ | | | | basic: rework virtualization detection API
| * basic: rework virtualization detection APILennart Poettering2015-09-0729-293/+316
| | | | | | | | | | | | Introduce a proper enum, and don't pass around string ids anymore. This simplifies things quite a bit, and makes virtualization detection more similar to architecture detection.
* | sd-login: fix sd_seat_get_active() to return ENODATAv226David Herrmann2015-09-082-3/+3
| | | | | | | | | | | | | | | | This seems to be an oversight from: 707b66c66381c899d7ef640e158ffdd5bcff4deb We have to return ENODATA instead of ENOENT if a requested entry is non-present. Also fix the call-site in udev to check for these errors.
* | Merge pull request #1201 from torstehu/fix-typoDavid Herrmann2015-09-083-3/+3
|\ \ | | | | | | treewide: fix typos
| * | treewide: fix typosTorstein Husebø2015-09-083-3/+3
| | |
* | | Merge pull request #1192 from poettering/sd-bus-containerDaniel Mack2015-09-082-16/+42
|\ \ \ | |/ / |/| | sd-bus: pass container bus errors up to calling process
| * | machined: improve error message when trying to get a bus in bus-less containersLennart Poettering2015-09-071-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | Now that we get useful error messages from sd-bus for container connections, let's make use of this and report better errors back to machined clients. Fixes #685.
| * | sd-bus: when connecting to a container AF_UNIX bus, return errorLennart Poettering2015-09-071-13/+37
| | | | | | | | | | | | | | | | | | | | | | | | When forking of a child process for connecting to a container, pass the preicse connection error to the calling process. We already did this correctly for kdbus busses, let's do so for dbus1 busses, too.
* | | Merge pull request #1196 from evverx/systemctl-add-consists-ofLennart Poettering2015-09-081-0/+1
|\ \ \ | | | | | | | | systemctl: add ConsistsOf as the inverse of PartOf
| * | | systemctl: add ConsistsOf as the inverse of PartOfEvgeny Vereshchagin2015-09-081-0/+1
| | | |
* | | | Merge pull request #1198 from martinpitt/masterLennart Poettering2015-09-081-1/+1
|\ \ \ \ | | | | | | | | | | cgroup-util: fix devices controller
| * | | | cgroup-util: fix devices controllerMartin Pitt2015-09-081-1/+1
| |/ / / | | | | | | | | | | | | | | | | Commit efdb0237 accidentally changed the name of the "devices" cgroup controller to "device".
* | | | nspawn: also close uid shift socket in the parentLennart Poettering2015-09-081-0/+1
| | | | | | | | | | | | | | | | | | | | We should really close all parent sides of our child/parent socket pairs.
* | | | nspawn: short reads do not set errno, hence don't try to print itLennart Poettering2015-09-081-2/+2
| | | |
* | | | inspawn: switch from SOCK_DGRAM to SOCK_SEQPACKET for internal socketpairsLennart Poettering2015-09-081-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SOCK_DGRAM and SOCK_SEQPACKET have very similar semantics when used with socketpair(). However, SOCK_SEQPACKET has the advantage of knowing a hangup concept, since it is inherently connection-oriented. Since we use socket pairs to communicate between the nspawn main process and the nspawn child process, where the child might die abnormally it's interesting to us to learn about this via hangups if the child side of the pair is closed. Hence, let's switch to SOCK_SEQPACKET for these internal communication sockets. Fixes #956.
* | | | nspawn: properly propagate errors when we fail to set soemthing upLennart Poettering2015-09-081-2/+4
|/ / /
* | | nspawn: sort and clean up included header listLennart Poettering2015-09-071-56/+44
| | | | | | | | | | | | | | | Let's remove unnecessary inclusions, and order the list alphabetically as suggested in CODING_STYLE now.
* | | nspawn: remove nspawn.h, it's empty nowLennart Poettering2015-09-0711-32/+1
| | |
* | | nspawn: split out --uid= logic into nspawn-setuid.[ch]Lennart Poettering2015-09-073-242/+299
| | |
* | | nspawn: split out machined registration code to nspawn-register.[ch]Lennart Poettering2015-09-073-218/+294
| | |
* | | nspawn: split out cgroup related calls into nspawn-cgroup.[ch]Lennart Poettering2015-09-073-140/+200
| | |
* | | nspawn: split out network related code to nspawn-network.[ch]Lennart Poettering2015-09-073-439/+504
| | |
* | | nspawn: split all port exposure code into nspawn-expose-port.[ch]Lennart Poettering2015-09-076-271/+337
| | |
* | | nspawn: split out mount related functions into a new nspawn-mount.c fileLennart Poettering2015-09-075-835/+949
|/ /
* | unit: move "not supported" check after condition check in unit_start()Lennart Poettering2015-09-071-4/+9
|/ | | | | | | | | | | | Make sure we always check conditions before checking whether the unit type is supported in unit_start(), since condition checks are "clean errors", while "not supported" errors are fatal. This cleans up the boot output of systemd in containers, where a lot of NOTSUPP lines were shown befor this fix. This partially reverts 8ff4d2ab0d4758e914aea6d86154d85f2b2c787f which reorder the checks.
* Merge pull request #1178 from poettering/gpt-auto-fixesDaniel Mack2015-09-072-22/+97
|\ | | | | handle LUKS root partitions better in gpt-auto, plus other fixes
| * systemctl: a number of cleanups regarding error handling in systemctlLennart Poettering2015-09-071-14/+13
| |
| * gpt-auto: minor simplificatin handling the no-auto GPT flagLennart Poettering2015-09-071-6/+7
| | | | | | | | | | Let's query the flags only once, and document why we ignore it for the ESP.
| * gpt-auto: try to handle LUKS root partitions betterLennart Poettering2015-09-071-2/+77
| | | | | | | | | | | | | | | | | | If the root file system is located on an encrypted root disk, we'll not find the GPT partition table for it. Let's fix that by following the slaves/ symlinks in /sys for the device. We only handle devices having exactly one backing device. Also see: #1167
* | tests: Skip test-cgroup-util test_mask_supported() when not running under ↵Martin Pitt2015-09-071-1/+1
| | | | | | | | | | | | | | | | systemd Commit 5f4c5fef6 introduced this new test case, but this does not work in build chroots where cgroupfs is not mounted. So skip the test if systemd is not running.
* | Merge pull request #1179 from poettering/sd-event-sigchld-fixTom Gundersen2015-09-071-1/+1
|\ \ | | | | | | sd-event: make sure to create a signal queue for the right signal
| * | sd-event: make sure to create a signal queue for the right signalLennart Poettering2015-09-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | We should never access the "signal" part of the event source unless the event source is actually for a signal. In this case it's a child pid handler however, hence make sure to use the right signal. This is a fix for PR #1177, which in turn was a fix for 9da4cb2be260ed123f2676cb85cb350c527b1492.
* | | Merge pull request #1165 from poettering/nspawn-filesTom Gundersen2015-09-0716-307/+1123
|\ \ \ | |/ / |/| | various fixes to the core, logind, machined, nspawn
| * | nspawn: add new .nspawn files for container settingsLennart Poettering2015-09-0612-290/+1086
| | | | | | | | | | | | | | | | | | | | | .nspawn fiels are simple settings files that may accompany container images and directories and contain settings otherwise passed on the nspawn command line. This provides an efficient way to attach execution data directly to containers.
| * | machine: make sure to call unlockpt() even for local host pty connectionsLennart Poettering2015-09-051-2/+12
| | | | | | | | | | | | | | | | | | | | | This fixes breakage for local host pty handling, introduced in 395745ba533ac91fe118f43ec83f13a752c0b473. Fixes #1139
| * | logind: make scope of wall message handling smallerLennart Poettering2015-09-051-10/+12
| | |
| * | unit: make unit_can_start() more accurateLennart Poettering2015-09-051-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | This funciton is exposed via CanStart on the bus, and should be as accurate as possible. Hence: make sure to return false for units of unit types not supported on the system, and for unit types where configuration failed to load. Also see #1105.
| * | core: don't use uninitialized errnoLennart Poettering2015-09-051-1/+1
| | |
| * | machine: clarify that /var/lib/containers is legacyLennart Poettering2015-09-051-1/+1
| | |
* | | sd-event: fix call to event_make_signal_dataThomas Hindoe Paaboel Andersen2015-09-061-1/+1
| |/ |/| | | | | This looks like a typo from commit 9da4cb2b where it was added.
* | Merge pull request #1153 from evverx/dot-alias-handlingLennart Poettering2015-09-061-1/+48
|\ \ | | | | | | analyze: add "alias" handling to dot subcommand
| * | analyze: add "alias" handling to dot subcommandEvgeny Vereshchagin2015-09-061-1/+48
| | | | | | | | | | | | `systemd-analyze dot default.target` works fine
* | | Merge pull request #1159 from AnchorCat/polkit-details/v2Lennart Poettering2015-09-0617-38/+178
|\ \ \ | | | | | | | | Provide unit name and operation in manage-units polkit checks (v2)
| * | | core: pass details to polkit for some unit actionsMichael Chapman2015-09-064-10/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following details are passed: - unit: the primary name of the unit upon which the action was invoked (i.e. after resolving any aliases); - verb: one of 'start', 'stop', 'reload', 'restart', 'try-restart', 'reload-or-restart', 'reload-or-try-restart', 'kill', 'reset-failed', or 'set-property', corresponding to the systemctl verb used to invoke the action. Typical use of these details in a polkit policy rule might be: // Allow alice to manage example.service; // fall back to implicit authorization otherwise. polkit.addRule(function(action, subject) { if (action.id == "org.freedesktop.systemd1.manage-units" && action.lookup("unit") == "example.service" && subject.user == "alice") { return polkit.Result.YES; } }); We also supply a custom polkit message that includes the unit's name and the requested operation.
| * | | bus-util: support details in CheckAuthorization callsMichael Chapman2015-09-0614-29/+112
| | |/ | |/| | | | | | | | | | | | | Extra details for an action can be supplied when calling polkit's CheckAuthorization method. Details are a list of key/value string pairs. Custom policy can use these details when making authorization decisions.
* | | Merge pull request #1162 from dvdhrm/bus-recursive-nodesLennart Poettering2015-09-061-7/+15
|\ \ \ | | | | | | | | sd-bus: make introspection data non-recursive
| * | | sd-bus: make introspection data non-recursiveDavid Herrmann2015-09-051-7/+15
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, our introspection data looks like this: <node> <interface name="org.freedesktop.DBus.Peer"> ... </interface> <interface name="org.freedesktop.DBus.Introspectable"> ... </interface> <interface name="org.freedesktop.DBus.Properties"> ... </interface> <node name="org"/> <node name="org/freedesktop"/> <node name="org/freedesktop/login1"/> <node name="org/freedesktop/login1/user"/> <node name="org/freedesktop/login1/user/self"/> <node name="org/freedesktop/login1/user/_1000"/> <node name="org/freedesktop/login1/seat"/> <node name="org/freedesktop/login1/seat/self"/> <node name="org/freedesktop/login1/seat/seat0"/> <node name="org/freedesktop/login1/session"/> <node name="org/freedesktop/login1/session/self"/> <node name="org/freedesktop/login1/session/c1"/> </node> (ordered alphabetically for better visibility) This is grossly incorrect. The spec says that we're allowed to return non-directed children, however, it does not allow us to return data recursively in multiple parents. If we return "org", then we must not return anything else that starts with "org/". It is unclear, whether we can include child-nodes as a tree. Moreover, it is usually not what the caller wants. Hence, this patch changes sd-bus to never return introspection data recursively. Instead, only a single child-layer is returned. This patch relies on enumerators to never return hierarchies. If someone registers an enumerator via sd_bus_add_enumerator, they better register sub-enumerators if they support *TRUE* hierarchies. Each enumerator is treated as a single layer and not filtered. Enumerators are still allowed to return nested data. However, that data is still required to be a single hierarchy. For instance, returning "/org/foo" and "/com/bar" is fine, but including "/com" or "/org" in that dataset is not. This should be the default for enumerators and I see no reason to filter in sd-bus. Moreover, filtering that data-set would require to sort the strv by path and then do prefix-filtering. This is O(n log n), which would be fine, but still better to avoid. Fixes #664.
* | | sd-bus: derive uid from cgroup if possibleDavid Herrmann2015-09-051-2/+8
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Whenever we run in a user context, sd_bus_{default_user,open_user}() and friends should always connect to the user-bus of the current context, instead of deriving the uid from getuid(). This allows us running programs via sudo/su, without the nasty side-effect of accidentally connecting to the root user-bus. This patch enforces the idea of making su/sudo *not* opening sessions by default. That is, all they do is raising privileges, but keeping everything set as before. You can still use su/sudo to open real sessions by requesting a login-session (or loading pam_systemd otherwise). However, in this case XDG_RUNTIME_DIR= will not be set (as usual in these cases), hence, you will not be able to connect to *any* user-bus. Long story short: With this patch applied, both: - ./busctl --user - sudo ./busctl --user ..will successfully connect to the user-bus of the local user. Fixes #390.
* | Merge pull request #1140 from poettering/sd-event-signalsDavid Herrmann2015-09-0520-306/+679
|\ \ | | | | | | A variety of sd-event, sd-login and cgroup fixes