summaryrefslogtreecommitdiff
path: root/src/import
Commit message (Collapse)AuthorAgeFilesLines
...
* | shared: rename machine-image.[ch] → discover-image.[ch]Lennart Poettering2021-02-034-4/+4
|/ | | | | | | | | | The old name originates when this was used to discover "machine" images, as managed by machined/machinectl. But nowadays this is also used by portable services and system extensions, hence let's use a more generic name for this API. Taking inspiration from "dissect-image.[ch]", let's call this "discover-image.[ch]". This is pure renaming, no other changes.
* import: properly verify roothash_signature + verity download, tooLennart Poettering2021-01-294-17/+28
| | | | | | | | | Follow-up for 133b34f69a72dc90d4e336837d699245390c9f50 where this was forgotten. While we are at it, bring the parameters into the same order as we declare them in the PullRaw/PullTar objects, i.e. match them to the canonical order.
* import: make sure we can import empty filesLennart Poettering2021-01-294-36/+45
|
* import: don't invoke compress callbacks with empty dataLennart Poettering2021-01-291-9/+15
| | | | | It's pointless if no data was generated. (This happens if an empty file is compressed)
* import: use unlink_and_free() + rm_rf_subvolume_and_free() moreLennart Poettering2021-01-292-8/+2
|
* import: fix typo in help textLennart Poettering2021-01-291-1/+2
|
* import-common: when mangling OS trees, propagate ownership/mode from subdir ↵Lennart Poettering2021-01-261-3/+22
| | | | | | | | to parent After all we want to remove the top-level dir, and make it look like the only subdir, hence propagate the attributes from the subdir to the top-level dir.
* import-common: fix log message stringLennart Poettering2021-01-261-2/+2
| | | | | The trees do look like directory trees, obviously. But they don't like OS trees.
* import: downgrade error messages we ignore to LOG_WARNINGLennart Poettering2021-01-221-2/+2
|
* import: set up btrfs qgroups on correct hierarchyLennart Poettering2021-01-223-2/+7
| | | | | Also, simplify import_assign_pool_quota_and_warn(), don't do the same thing twice. Let's just allow the caller call this twice.
* import: drop redundant {}, as per coding styleLennart Poettering2021-01-221-4/+2
|
* import: introduce ImportFlags flags fieldLennart Poettering2021-01-226-24/+32
| | | | | | | | | | | This merges the two flags that are passed to the ImportTar/ImportRaw objects into a single flags parameter, which we then can extend more easily later on. No change in behaviour. This is inspired by 133b34f69a72dc90d4e336837d699245390c9f50 which does the same for PullTar/PullRaw.
* import: don't apply empty_or_dash_to_null() to stuff we know is NULL anywayLennart Poettering2021-01-221-8/+4
|
* import: refactor how we do gpg validationLennart Poettering2021-01-194-67/+82
| | | | | Let's split out the actual gpg logic into a helper function, so that we can add alternative validations later on.
* import: optionally pull .verity + .roothash.p7s data when downloadingLennart Poettering2021-01-197-138/+254
| | | | | | | | | | | We already had support for downlading a .nspawn and a .roothash file, let's make the set complete, and also download .verity + roothash.p7s if it exists, as nspawn consumes that. Since there are now four kinds of additional resources to acquire, let's introduce a PullFlags flags value for this instead of separate 'bool' variables, it's just too many to always pass those around on the function parameter list.
* import: ignore non-successful HTTP codes for collecing image metadataLennart Poettering2021-01-191-1/+15
| | | | | | Previously we'd collect the data from redirects too, which wasn't particularly terrible, since these typically don't carry the data we were interested in, but it's still incorrect to do so.
* import: turn on HTTP logging in debug modeLennart Poettering2021-01-191-1/+2
|
* import: small memory management simplificationLennart Poettering2021-01-191-4/+2
|
* import: reset PullJob properlyLennart Poettering2021-01-191-0/+19
| | | | | | Properly reset all fields that have to do with the current GET job when we restart things. Previously we freed/reset only some stuff, leaking some memory even.
* import: rework how verification worksLennart Poettering2021-01-196-38/+133
| | | | | | | | | | | | | | | | | | | | | | Previously the PullJob object took internal care of rerequested the SHA256SUMS file, if requesting <image>.sha256 didn't work. This was a weird a non-abstraction only used when actually getting the checksum files. Let's move this out of the PullJob, so that it is generic again, and does roughly the same stuff for all resources it is used for: let's define a generic .on_not_found() handler that can be set on a PullJob object, and is called whenever with see HTTP 404, and may be used to provide a new URL to try if the first didn't work. This is also preparation for later work to support PKCS#7 signatures instead of gpg signatures, where a similar logic is needed, and we thus should have a generic infrastructure place. This gets rid of the VerificationStyle field in the PullJob object: instead of storing this non-generic field we just derive the same information from the URL itself, which is safe, since we generated it ourselves earlier.
* import: use TAKE_PTR() where availableLennart Poettering2021-01-191-4/+2
|
* import: make scope of variable smallerLennart Poettering2021-01-191-1/+1
|
* import: comment indent fixLennart Poettering2021-01-191-1/+1
|
* machine-image: properly support searching for images below some --root= pathLennart Poettering2021-01-194-7/+7
| | | | | systemd-sysext supports --root= for everything but the image discovery. Fix that.
* Merge pull request #18038 from yuwata/meson-splitYu Watanabe2021-01-191-2/+2
|\ | | | | meson: various cleanups
| * meson: make the second and third elements of tests or fuzzers optionalYu Watanabe2021-01-191-2/+2
| | | | | | | | Then, we can shorten many test definitions.
* | import: use - hashmap_ensure_putSusant Sahani2021-01-181-5/+1
|/
* import: mangle untarred OS images after pull-tar, tooLennart Poettering2021-01-121-3/+6
| | | | | | | We do this for import-tar and import-fs, we should do it for pull-tar, too. Fixes: #17563
* hostname-util: flagsify hostname_is_valid(), drop machine_name_is_valid()Lennart Poettering2020-12-159-15/+15
| | | | | | | | | | | | Let's clean up hostname_is_valid() a bit: let's turn the second boolean argument into a more explanatory flags field, and add a flag that accepts the special name ".host" as valid. This is useful for the container logic, where the special hostname ".host" refers to the "root container", i.e. the host system itself, and can be specified at various places. let's also get rid of machine_name_is_valid(). It was just an alias, which is confusing and even more so now that we have the flags param.
* curl-util: fix callback prototypeEtienne Doms2020-11-231-1/+1
| | | CURLMOPT_SOCKETFUNCTION callback is an easy handle, not a multi.
* curl-util: fix type CURL -> CURLMYu Watanabe2020-11-212-2/+2
|
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-0934-34/+34
|
* tree-wide: assorted coccinelle fixesFrantisek Sumsal2020-10-094-46/+47
|
* Add CLOSE_AND_REPLACE helperZbigniew Jędrzejewski-Szmek2020-09-182-6/+2
| | | | | | Similar to free_and_replace. I think this should be uppercase to make it clear that this is a macro. free_and_replace should probably be uppercased too.
* tree-wide: define iterator inside of the macroZbigniew Jędrzejewski-Szmek2020-09-081-8/+4
|
* import: make sure gnu tar complains on tar files with trailing garbageLennart Poettering2020-09-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | By default GNU tar will only read the first archive if multiple archives are concatenated and ignore the rest. If an archive contains trailing garbage this will hence not be recognized by tar as error, it simply stops reading when the first archive is done (which might escalate to SIGPIPE when invoked via a pipe). Let's add --ignore-zeros to the tar command line when extracting. This means: 1) if a tar archive was concatenated (i.e. generated with tar -A) we'll process it correctly. 2) if a tar archive contains trailing garbage tar will now generate an error message about it, instead of just throwing EPIPE, which makes things easier to debug as broken files are not silently processed. I think it's OK for gnu tar to ignore trailing garbage when dealing with classic tapes drives, i.e. mediums that do not have a size limit built-in. However, this is not what we are dealing with: we are dealing with OS images here, that hopefully someone generated with a clean build system, that were signed and validated and hence should not contain trailing garbage. Hence it's better to refuse and complain thant to silently eat up like for classic tape drives. Fixes: #16605
* tree-wide: make use of new relative time events in sd-event.hLennart Poettering2020-07-281-3/+3
|
* import: always prefer GNU tar, to avoid cmdline incompatibilitiesLennart Poettering2020-07-211-4/+34
| | | | Fixes: #16506
* shared: split out property get helpersLennart Poettering2020-06-301-2/+2
| | | | No code changes, just some refactoring.
* 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