summaryrefslogtreecommitdiff
path: root/src/import
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: Replace assert() by assert_se() when there is side effectBenjamin Robin2020-05-101-2/+2
|
* tree-wide: make sure our control buffers are properly alignedLennart Poettering2020-05-071-5/+2
| | | | | | | | | | | | | We always need to make them unions with a "struct cmsghdr" in them, so that things properly aligned. Otherwise we might end up at an unaligned address and the counting goes all wrong, possibly making the kernel refuse our buffers. Also, let's make sure we initialize the control buffers to zero when sending, but leave them uninitialized when reading. Both the alignment and the initialization thing is mentioned in the cmsg(3) man page.
* tree-wide: Fix, replace assert() by assert_se() when there is side effectBenjamin Robin2020-05-061-2/+2
|
* importd,logind: add --bus-introspect= optionZbigniew Jędrzejewski-Szmek2020-05-051-0/+2
|
* importd: convert to the new schemeZbigniew Jędrzejewski-Szmek2020-05-051-84/+83
|
* logind,importd,hostnamed,localed,timedated,machined,resolved: add option ↵Zbigniew Jędrzejewski-Szmek2020-05-031-5/+7
| | | | | | | | parsing stubs --help and --version are implemented in the usual style. help() prints full path, since the program is not expected to be in $PATH.
* importd: wrap long linesZbigniew Jędrzejewski-Szmek2020-05-031-18/+52
|
* socket-util: introduce type-safe, dereferencing wrapper CMSG_FIND_DATA ↵Lennart Poettering2020-04-231-8/+2
| | | | | | | around cmsg_find() let's take this once step further, and add type-safety to cmsg_find(), and imply the CMSG_DATA() macro for finding the cmsg payload.
* tree-wide: use recvmsg_safe() at various placesLennart Poettering2020-04-231-7/+5
| | | | | | | | | | | | | | | | | Let's be extra careful whenever we return from recvmsg() and see MSG_CTRUNC set. This generally means we ran into a programming error, as we didn't size the control buffer large enough. It's an error condition we should at least log about, or propagate up. Hence do that. This is particularly important when receiving fds, since for those the control data can be of any size. In particular on stream sockets that's nasty, because if we miss an fd because of control data truncation we cannot recover, we might not even realize that we are one off. (Also, when failing early, if there's any chance the socket might be AF_UNIX let's close all received fds, all the time. We got this right most of the time, but there were a few cases missing. God, UNIX is hard to use)
* tree-wide: implement new log control API dbus interface in all our daemonsLennart Poettering2020-04-211-0/+5
|
* Merge pull request #15396 from keszybz/dbus-api-docsLennart Poettering2020-04-171-12/+110
|\ | | | | D-bus API docs
| * importd: add dbus parameter namesZbigniew Jędrzejewski-Szmek2020-04-121-12/+110
| |
* | Remove unneded {}sZbigniew Jędrzejewski-Szmek2020-04-131-2/+1
| | | | | | | | | | | | $ perl -i -0pe 's|\s+{\n([^\n]*;)\n\s+}\n|\n\1\n|gms' **/*.c Inspired by ea7cbf5bdd68d7861ebf1570c439e8bbabd83f6c.
* | import: use our new btrfs_subvol_make_fallback() at two placesLennart Poettering2020-04-092-14/+8
|/
* import: Only keep RO copy if ETag header is setKevin Kuehler2020-03-231-7/+10
| | | | | | | | | | | | | | | | | | | | We fix the case when the webserver servers container images without setting the ETag header in the response. When an image is downloaded to image root, a read only copy is stored alongside it. The filename has the following form: .raw-<encoded-url-of-image>.\x22<ETAG-header>\22.raw. This is so, if the same resource is fetched multiple times, importd can avoid extra downloads by creating the new image using the local read-only copy. The current code assumes the ETag header is set because, if the server does not set the ETag header, the file is stored without the ETag value in the filename. When importd fetches a duplicate image, it will run rename_noreplace and fail: Failed to rename raw file to /var/lib/machines/.raw-http:\x2f\x2flocalhost:8000\x2fwalkthroughd.raw: File exists This patch makes importd only store a read-only image if the webserver has set the ETag header.
* Merge pull request #14633 from poettering/logind-switch-polkitZbigniew Jędrzejewski-Szmek2020-01-281-1/+1
|\ | | | | add polkit hookup for VT switching in logind
| * shared: split out polkit stuff from bus-util.c → bus-polkit.cLennart Poettering2020-01-221-1/+1
| | | | | | | | | | | | It's enough, complex stuff to warrant its own source file. No other changes, just splitting out.
* | import: let's disable UNIX signal generation from curlLennart Poettering2020-01-201-0/+3
| |
* | import: put a time-out on downloadsLennart Poettering2020-01-201-0/+6
| | | | | | | | | | | | | | Let's abort downloads when they are stuck by setting a download speed threshold (as suggested in the CURL docs) Fixes: #14215
* | import: don't complain if FS_NOCOW_FL is not availableLennart Poettering2020-01-202-23/+7
|/ | | | | Let's downgrade the log message to LOG_DEBUG if triggered by an fs that doesn't support the flag.
* [import] fix stdin/stdout pipe behavior in import/export tar/rawAnita Zhang2019-12-171-6/+12
| | | | | | | | | | | The code existed in machinectl to use stdin/stdout if the path for import/export tar/raw was empty or dash (-) but a check to `fd_verify_regular` in importd prevented it from working. Update the check instead to explicitly check for regular file or pipe/fifo. Fixes #14346
* include missing_fcntl.h where neededAnita Zhang2019-11-071-0/+1
| | | | | | | f5947a5e925117c55b390460d592f57504277bf9 dropped missing.h and replaced with the more specific headers but did not add missing_fcntl.h in places that use O_TMPFILE. This is needed for some older versions of glibc.
* tree-wide: drop missing.hYu Watanabe2019-10-312-2/+1
|
* tree-wide: say "ratelimit" not "rate_limit"Zbigniew Jędrzejewski-Szmek2019-09-204-12/+12
| | | | | | "ratelimit" is a real word, so we don't need to use the other form anywhere. We had both forms in various places, let's standarize on the shorter and more correct one.
* Drop RATELIMIT macrosZbigniew Jędrzejewski-Szmek2019-09-205-9/+5
| | | | | Using plain structure initialization is both shorter _and_ more clearer. We get type safety for free.
* tree-wide: get rid of strappend()Lennart Poettering2019-07-121-1/+1
| | | | | It's a special case of strjoin(), so no need to keep both. In particular as typing strjoin() is even shoert than strappend().
* importd: Avoid need for fd translation tableDave Reisner2019-07-092-51/+5
| | | | | | | Make use of curl_multi_assign to associate each IO sd_event_source with a CURL object. This means we always get passed the right event source and don't need to worry about looking up the associated CURL object, particularly in the case where the FD has been closed on a REMOVE event.
* tree-wide: replace strjoina() with prefix_roota()Yu Watanabe2019-06-253-3/+3
|
* tree-wide: use _cleanup_ attribute and strv_consume() + TAKE_PTR()Yu Watanabe2019-06-241-5/+3
|
* Merge pull request #12836 from yuwata/tree-wide-replace-strjoinLennart Poettering2019-06-221-1/+1
|\ | | | | tree-wide: replace strjoin() with path_join()
| * tree-wide: replace strjoin() with path_join()Yu Watanabe2019-06-211-1/+1
| |
* | util: introduce format_bytes_full()Yu Watanabe2019-06-192-1/+2
|/ | | | And move it into format-util.c.
* Use sd_event_source_disable_unref()Zbigniew Jędrzejewski-Szmek2019-05-101-2/+1
|
* Merge pull request #12420 from mrc0mmand/coccinelle-tweaksLennart Poettering2019-04-301-1/+1
|\ | | | | Coccinelle improvements
| * tree-wide: code improvements suggested by CoccinelleFrantisek Sumsal2019-04-301-1/+1
| |
* | codespell: fix spelling errorsBen Boeckel2019-04-292-2/+2
|/
* basic: add new helper call empty_or_dash_to_null()Lennart Poettering2019-04-084-20/+10
| | | | | We have a function like this at two places already. Let's unify it in one generic location and let's port a number of users over.
* tree-wide: introduce empty_or_dash() helperLennart Poettering2019-04-084-10/+10
| | | | | At quite a few places we check isempty() || streq(…, "-"), let's add a helper to simplify that, and replace that by a single function call.
* util-lib: when copying files make sure to apply some chattrs early, some lateLennart Poettering2019-03-282-2/+2
| | | | | | | Some chattrs only work sensible if you set them right after opening a file for create (think: FS_NOCOW_FL). Others only work when they are applied when the file is fully written (think: FS_IMMUTABLE_FL). Let's take that into account when copying files and applying a chattr to them.
* tree-wide: (void)ify a few unlink() and rmdir()Lennart Poettering2019-03-272-4/+4
| | | | | | Let's be helpful to static analyzers which care about whether we knowingly ignore return values. We do in these cases, since they are usually part of error paths.
* headers: remove unneeded includes from util.hZbigniew Jędrzejewski-Szmek2019-03-278-1/+13
| | | | | This means we need to include many more headers in various files that simply included util.h before, but it seems cleaner to do it this way.
* import: do not try to set selinux related attributes if selinux is disabledYu Watanabe2019-03-111-2/+11
| | | | Closes #11940.
* copy: don't synthesize a 'user.crtime_usec' xattr on copy unless explicitly ↵Lennart Poettering2019-03-013-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | requested Previously, when we'd copy an individual file we'd synthesize a user.crtime_usec xattr with the source's creation time if we can determine it. As the creation/birth time was until recently not queriable form userspace this effectively just propagated the same xattr on the source to the same xattr on the destination. However, current kernels now allow to query the birthtime using statx() and we do make use of that now. Which means that suddenly we started synthesizing these xattrs much more regularly. Doing this actually does make sense, but only in very few cases: not for the typical regular files we copy, but certainly when dealing with disk images. Hence, let's keep this kind of propagation, but let's make it a flag and default to off. Then turn it on whenever we deal with disk images, and leave it off otherwise. This is particularly relevant as overlayfs combining a real fs, and a tmpfs on top will result in EOPNOTSUPP when it is attempted to open a file with xattrs for writing, as tmpfs does not support xattrs, and hence the copy-up cannot work. Hence, let's avoid synthesizing this needlessly, to increase compat with overlayfs.
* curl-util: fix use after freeYu Watanabe2019-02-061-1/+1
| | | | This fixes a bug introduced by c3e658004a66115fa09abcf602d573e65e577aa9.
* pull: fix invalid error checkYu Watanabe2019-02-061-1/+1
| | | | This fixes a bug introduced by 0d94088e4e9e00f5ca9afdb8e68c94558fe23268.
* meson: generate version tag from gitZbigniew Jędrzejewski-Szmek2018-12-211-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | $ build/systemctl --version systemd 239-3555-g6178cbb5b5 +PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN +PCRE2 default-hierarchy=hybrid $ git tag v240 -m 'v240' $ ninja -C build ninja: Entering directory `build' [76/76] Linking target fuzz-unit-file. $ build/systemctl --version systemd 240 +PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN +PCRE2 default-hierarchy=hybrid This is very useful during development, because a precise version string is embedded in the build product and displayed during boot, so we don't have to guess answers for questions like "did I just boot the latest version or the one from before?". This change creates an overhead for "noop" builds. On my laptop, 'ninja -C build' that does nothing goes from 0.1 to 0.5 s. It would be nice to avoid this, but I think that <1 s is still acceptable. Fixes #7183. PACKAGE_VERSION is renamed to GIT_VERSION, to make it obvious that this is the more dynamically changing version string. Why save to a file? It would be easy to generate the version tag using run_command(), but we want to go through a file so that stuff gets rebuilt when this file changes. If we just defined an variable in meson, ninja wouldn't know it needs to rebuild things.
* Merge pull request #10935 from poettering/rlimit-nofile-safeZbigniew Jędrzejewski-Szmek2018-12-061-0/+3
|\ | | | | | | Merged by hand to resolve a trivial conflict in TODO.
| * tree-wide: invoke rlimit_nofile_safe() before various exec{v,ve,l}() invocationsLennart Poettering2018-12-011-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Whenever we invoke external, foreign code from code that has RLIMIT_NOFILE's soft limit bumped to high values, revert it to 1024 first. This is a safety precaution for compatibility with programs using select() which cannot operate with fds > 1024. This commit adds the call to rlimit_nofile_safe() to all invocations of exec{v,ve,l}() and friends that either are in code that we know runs with RLIMIT_NOFILE bumped up (which is PID 1 and all journal code for starters) or that is part of shared code that might end up there. The calls are placed as early as we can in processes invoking a flavour of execve(), but after the last time we do fd manipulations, so that we can still take benefit of the high fd limits for that.
* | util-lib: split out all temporary file related calls into tmpfiles-util.cLennart Poettering2018-12-028-7/+9
|/ | | | | | | | This splits out a bunch of functions from fileio.c that have to do with temporary files. Simply to make the header files a bit shorter, and to group things more nicely. No code changes, just some rearranging of source files.
* import: properly fail if tar exited non-zero, not just when it segfaulted or ↵Lennart Poettering2018-11-261-0/+2
| | | | such