summaryrefslogtreecommitdiff
path: root/src/libostree/ostree-repo-pull-private.h
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: Run clang-formatColin Walters2023-05-021-121/+110
| | | | | This is a one-time tree wide reformatting to ensure consistency going forward.
* Update FSF license notices to use URL instead of addressJoseph Marrero2021-12-071-3/+1
|
* pull: Error on depth pull with missing head commitDan Nicholson2021-01-121-1/+1
| | | | | | | | | | | | | | | | | When pulling with depth, missing parent commits are ignored. However, the check was applying to any commit, which means that it would succeed even if the requested commit was missing. This might happen on a corrupted remote repo or when using ref data from a stale summary. To achieve this, the semantics of the `commit_to_depth` hash table is changed slightly to only ever includes parent commits. This makes it easy to detect when a parent commit is being referenced (although there is a minor bug there when multiple refs are being pulled) while keeping references to commits that need their `commitpartial` files cleaned up. It also means that the table is only populated on depth pulls, which saves some memory and processing in the common depth=0 case. Fixes: #2265
* pull: Allow disabling commit binding verificationDan Nicholson2020-12-171-0/+1
| | | | | | | | | | | | | | | | In some cases such as backups or mirroring you may want to pull commits from one repo to another even if there commits that have incorrect bindings. Fixing the commits in the source repository to have correct bindings may not be feasible, so provide a pull option to disable verification. For Endless we have several repositories that predate collection IDs and ref bindings. Later these repositories gained collection IDs to support the features they provide and ref bindings as the ostree tooling was upgraded. These repositories contain released commits that were valid to the clients they were targeting at the time. Correcting the bindings is not really an option as it would mean invalidating the repository history.
* pull: Only download summary if we need it for the pull operationAlexander Larsson2020-10-231-0/+1
| | | | | | | | | | If we have a commit id for all the refs we're pulling, and if we don't need the summary to list all the refs when mirroring then the only reason to download the summary is for the list of deltas. With the new "indexed-deltas" property in the config file (and mirrored to the summary file) we can detect when we don't need the summary for deltas and completely avoid downloading it then.
* deltas: Use delta indexes when pullingAlexander Larsson2020-10-231-1/+3
| | | | | | If there is no delta index in the summary, try to fetch the delta index for the commit we're going to and use that to find the delta (if any).
* lib/pull: Hook up HTTP caching headers for summary and summary.sigPhilip Withnall2020-10-221-0/+4
| | | | | | | | | | | | | | | | | | | As `summary` and `summary.sig` aren’t immutable, HTTP requests to download them can be optimised by sending the `If-None-Match` and `If-Modified-Since` headers to avoid unnecessarily re-downloading them if they haven’t changed since last being checked. Hook them up to the new support for that in the fetcher. The `ETag` and `Last-Modified` for each file in the cache are stored as the `user.etag` xattr and the mtime, respectively. For flatpak, for example, this affects the cached files in `~/.local/share/flatpak/repo/tmp/cache/summaries`. If xattrs aren’t supported, or if the server doesn’t support the caching headers, the pull behaviour is unchanged from before. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
* signapi: Change API to also return a success messageColin Walters2020-06-171-0/+2
| | | | | | | | | | | | | | | | | | | This is the dual of https://github.com/ostreedev/ostree/pull/2129/commits/1f3c8c5b3de978f6e069c24938967f823cce7ee8 where we output more detail when signapi fails to validate. Extend the API to return a string for success, which we output to stdout. This will help the test suite *and* end users validate that the expected thing is happening. In order to make this cleaner, split the "verified commit" set in the pull code into GPG and signapi verified sets, and have the signapi verified set contain the verification string. We're not doing anything with the verification string in the pull code *yet* but I plan to add something like `ostree pull --verbose` which would finally print this.
* pull: Add support for sign-verify=<list>Colin Walters2020-05-221-8/+8
| | | | | | | | | | | | | | | | | | | | | The goal here is to move the code towards a model where the *client* can explicitly specify which signature types are acceptable. We retain support for `sign-verify=true` for backwards compatibility. But in that configuration, a missing public key is just "no signatures found". With `sign-verify=ed25519` and no key configured, we can explicitly say `No keys found for required signapi type ed25519` which is much, much clearer. Implementation side, rather than maintaining `gboolean sign_verify` *and* `GPtrArray sign_verifiers`, just have the array. If it's `NULL` that means not to verify. Note that currently, an explicit list is an OR of signatures, not AND. In practice...I think most people are going to be using a single entry anyways.
* lib/pull: Add `timestamp-check-from-rev`Jonathan Lebon2020-05-141-0/+1
| | | | | | | | | | | The way `timestamp-check` works might be too restrictive in some situations. Essentially, we need to support the case where users want to pull an older commit than the current tip, but while still guaranteeing that it is newer than some even older commit. This will be used in Fedora CoreOS. For more information see: https://github.com/coreos/rpm-ostree/pull/2094 https://github.com/coreos/fedora-coreos-tracker/issues/481
* pull: Further cleanup signapi verificationColin Walters2020-05-121-10/+10
| | | | | | | | | | | | | | | | | | Previously in the pull code, every time we went to verify a commit we would re-initialize an `OstreeSign` instance of each time, re-parse the remote configuration and re-load its public keys etc. In most cases this doesn't matter really because we're pulling one commit, but if e.g. pulling a commit with history would get a bit silly. This changes things so that the pull code initializes the verifiers once, and reuses them thereafter. This is continuing towards changing the code to support explicitly configured verifiers, xref https://github.com/ostreedev/ostree/issues/2080
* lib: Move gpg/signapi bits into ostree-repo-pull-verify.cColin Walters2020-04-181-0/+28
| | | | | `ostree-repo-pull.c` is huge; separate some of the GPG/signing verification functions into their own file so they're more easily seen.
* lib: Move pull struct definition into repo-pull-private.hColin Walters2020-04-181-1/+112
| | | | Prep for further splitting up `ostree-repo-pull.c`.
* lib: Move internal binding verification API to repo.cColin Walters2020-04-171-5/+0
| | | | | | | | `ostree-repo-pull.c` is rather monstrous; I plan to split it up a bit. There's actually already a `pull-private.h` but that's just for the binding verification API. I think that one isn't really pull specific. Let's move it into the "catchall" `repo.c`.
* Add SPDX-License-Identifier to source filesMarcus Folkesson2018-01-301-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | SPDX License List is a list of (common) open source licenses that can be referred to by a “short identifier”. It has several advantages compared to the common "license header texts" usually found in source files. Some of the advantages: * It is precise; there is no ambiguity due to variations in license header text * It is language neutral * It is easy to machine process * It is concise * It is simple and can be used without much cost in interpreted environments like java Script, etc. * An SPDX license identifier is immutable. * It provides simple guidance for developers who want to make sure the license for their code is respected See http://spdx.org for further reading. Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com> Closes: #1439 Approved by: cgwalters
* lib/pull: Split verify_bindings() out into a cmdprivate methodPhilip Withnall2017-12-141-0/+32
It will be used by the fsck utility in future. We could expose it publicly in future too, if needed. Signed-off-by: Philip Withnall <withnall@endlessm.com> Closes: #1347 Approved by: cgwalters