summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib
Commit message (Collapse)AuthorAgeFilesLines
* Run unifdef -DAPT_{8,9,10,15}_CLEANER_HEADERSJulian Andres Klode2019-06-1217-106/+0
|
* Allow comparing string to StringViewJulian Andres Klode2019-06-111-0/+2
|
* Make APT::StringView publicJulian Andres Klode2019-06-114-26/+5
|
* Change soname to libapt-pkg.so.5.90Julian Andres Klode2019-05-061-2/+2
| | | | | This is a bit experimental, and we'll go through a few stages before reaching libapt-pkg.so.6.0.
* Merge libapt-inst into libapt-pkgJulian Andres Klode2019-05-064-0/+595
|
* Prevent shutdown while running dpkgJulian Andres Klode2019-05-032-0/+50
| | | | | | | As long as we are running dpkg, keep an inhibitor that blocks us from shutting down. LP: #1820886
* apt-pkg: URI: Add 'explicit' to single argument constructorJulian Andres Klode2019-04-301-2/+2
| | | | | This needs a fair amount of changes elsewhere in the code, hence this is separate from the previous commits.
* apt-pkg: hashes: Add 'explicit' to single argument constructorsJulian Andres Klode2019-04-301-5/+5
| | | | | This avoids funny code where strings get implicitly converted to HashString or HashStringList.
* Add 'explicit' to most single argument constructorsJulian Andres Klode2019-04-304-6/+6
| | | | | | | | | | | This prevents implicit conversions that we do not want, such as having a FileFd* being converted to a debListParser. Two cases are not yet handled because they require changes in code using them: 1. The classes in hashes.h 2. The URI class - this one is used quite a lot
* Merge tag '1.8.0'Julian Andres Klode2019-03-081-2/+16
|\ | | | | | | apt Debian release 1.8.0
| * Add explicit message for unsupported binary signatureDavid Kalnischkies2019-03-031-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Verifying the content of Release.gpg made us fail on binary signatures which were never officially supported (apt-secure manpage only documents only the generation of ASCII armored), but silently accepted by gpgv as we passed it on unchecked before. The binary format is complex and is itself split into old and new formats so adding support for this would not only add lots of code but also a good opportunity for bugs and dubious benefit. Reporting this issue explicitly should help repository creators figure out the problem faster than the default NODATA message hinting at captive portals. Given that the binary format has no file magic or any other clear and simple indication that this is a detached signature we guess based on the first two bits only – and by that only supporting the "old" binary format which seems to be the only one generated by gnupg in this case. References: e2965b0b6bdd68ffcad0e06d11755412a7e16e50 Closes: #921685
* | fileutl: Merge Popen variantsJulian Andres Klode2019-02-262-13/+1
| |
* | fileutl: Remove deprecated functions such as gzFd()Julian Andres Klode2019-02-262-28/+0
| |
* | strutl: Remove deprecated functionsJulian Andres Klode2019-02-262-57/+0
| |
* | sptr: Remove deprecated smart pointer classesJulian Andres Klode2019-02-262-75/+0
| | | | | | | | Please use the standard C++ variants instead.
* | netrc: Remove deprecated function maybe_add_auth()Julian Andres Klode2019-02-262-11/+0
| |
* | hashes: Remove deprecated functionsJulian Andres Klode2019-02-262-58/+6
| | | | | | | | | | | | This keeps the members in the class, but makes them private. We want to migrate to libgcrypt eventually, since we already use libgcrypt through gpgv anyway.
* | Bump SONAMEs in preparation for ABI breaksJulian Andres Klode2019-02-261-2/+2
|/
* Fix various typos in the documentationJakub Wilk2019-02-101-1/+1
|
* Use std::to_string() for HashStringList::FileSize() getterJulian Andres Klode2019-02-041-3/+1
| | | | | | | | This slightly improves performance, as std::to_string() (as in gcc's libstdc++) avoids a heap allocation. This is surprisingly performance critical code, so we might want to improve things further in 1.9 by manually calculating the string - that would also get rid of issues with locales changing string formatting, if any.
* gpgv: Use buffered writes for splitting clearsigned filesJulian Andres Klode2019-02-043-2/+13
| | | | | | This is safe here, as the code ensures that the file is flushed before it is being used. The next series should probably make GetTempFile() buffer writes by default.
* Merge branch 'pu/dead-pin' into 'master'Julian Andres Klode2019-02-042-0/+48
|\ | | | | | | | | A pin of -32768 overrides any other, disables repo See merge request apt-team/apt!40
| * Add a Packages-Require-Authorization Release file fieldJulian Andres Klode2019-02-012-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This new field allows a repository to declare that access to packages requires authorization. The current implementation will set the pin to -32768 if no authorization has been provided in the auth.conf(.d) files. This implementation is suboptimal in two aspects: (1) A repository should behave more like NotSource repositories (2) We only have the host name for the repository, we cannot use paths yet. - We can fix those after an ABI break. The code also adds a check to acquire-item.cc to not use the specified repository as a download source, mimicking NotSource.
* | Drop buffered writing from clearsigned message extractionDavid Kalnischkies2019-02-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | It is dropped in the merged code, but the extraction of the clearsigned message code was the only one who had it previously, so the short-desc explains the change from a before-after merge of the branch PoV. It would make sense to enable it, but as we aren't in a time critical paths here we can delay this for after buster to avoid problems. References: 73e3459689c05cd62f15c29d2faddb0fc215ef5e Suggested-By: Julian Andres Klode
* | Avoid boolean flags by splitting writeTo functionsDavid Kalnischkies2019-02-011-14/+20
| | | | | | | | | | Suggested-By: Julian Andres Klode Gbp-Dch: Ignore
* | Reuse APT::StringView more in LineBufferDavid Kalnischkies2019-01-291-32/+9
| | | | | | | | | | | | | | No effective change in behaviour, just simplifying and reusing code. Suggested-By: Julian Andres Klode Gbp-Dch: Ignore
* | Rework ifs to use not instead of == false/trueDavid Kalnischkies2019-01-291-54/+66
| | | | | | | | | | | | | | | | No change in the logic itself, just dropping "== true", replacing "== false" with not and moving lines around to make branches more obvious. Suggested-By: Julian Andres Klode Gbp-Dch: Ignore
* | Refuse files with lines unexpectedly starting with a dashDavid Kalnischkies2019-01-281-9/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We support dash-encoding even if we don't really work with files who would need it as implementations are free to encode every line, but otherwise a line starting with a dash must either be a header we parse explicitly or the file is refused. This is against the RFC which says clients should warn on such files, but given that we aren't expecting any files with dash-started lines to begin with this looks a lot like a we should not continue to touch the file as it smells like an attempt to confuse different parsers by "hiding" headers in-between others. The other slightly more reasonable explanation would be an armor header key starting with a dash, but no existing key does that and it seems unlikely that this could ever happen. Also, it is recommended that clients warn about unknown keys, so new appearance is limited.
* | Use more abstraction to handle the current line bufferDavid Kalnischkies2019-01-281-83/+133
| | | | | | | | | | | | | | This is C++, so we can use a bit more abstraction to let the code look a tiny bit nicer hopefully improving readability a bit. Gbp-Dch: Ignore
* | Explicitly remove the whitespaces defined by RFCDavid Kalnischkies2019-01-281-4/+20
| | | | | | | | | | | | | | | | | | | | RFC 4880 section 7.1 "Dash-Escaped Text" at the end defines that only space and tab are allowed, so we should remove only these even if due to use complaining (or now failing) you can't really make use of it. Note that strrstrip was removing '\r\n\t ', not other whitespaces like \v or \f and another big reason to do it explicitly here now is to avoid that a future change adding those could have unintended consequences.
* | Merge and reuse tmp file handling across the boardDavid Kalnischkies2019-01-242-55/+29
| | | | | | | | | | | | Having many rather similar implementations especially if one is exported while others aren't (and the rest of it not factored out at all) seems suboptimal.
* | Fail on non-signature lines in Release.gpgDavid Kalnischkies2019-01-231-20/+64
| | | | | | | | | | | | | | | | | | | | The exploit for CVE-2019-3462 uses the fact that a Release.gpg file can contain additional content beside the expected detached signature(s). We were passing the file unchecked to gpgv which ignores these extras without complains, so we reuse the same line-reading implementation we use for InRelease splitting to detect if a Release.gpg file contains unexpected data and fail in this case given that we in the previous commit we established that we fail in the similar InRelease case now.
* | Fail instead of warn for unsigned lines in InReleaseDavid Kalnischkies2019-01-231-106/+99
|/ | | | | | | | | | | | The warnings were introduced 2 years ago without any reports from the wild about them actually appearing for anyone, so now seems to be an as good time as any to switch them to errors. This allows rewritting the code by failing earlier instead of trying to keep going which makes the diff a bit hard to follow but should help simplifying reasoning about it. References: 6376dfb8dfb99b9d182c2fb13aa34b2ac89805e3
* Remove `register` keywordKhem Raj2019-01-221-1/+1
| | | | | | | | | | | | | | | | | | In C++17 `register` keyword was removed. Current gcc 8.1.0 produces following warning if `-std=c++17` flag is used: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] GCC almost completely ignores `register` keyword, with rare exception of `-O0` when additional copy from/to stack may be generated. For simplicity of the codebase it is better to just remove this problematic keyword where it is not strictly required. See: http://en.cppreference.com/w/cpp/language/storage_duration Signed-off-by: Khem Raj <raj.khem@gmail.com>
* configuration: Compare size first during lookupJulian Andres Klode2018-12-261-1/+1
|
* Override FileFd copy constructor to prevent copyingJulian Andres Klode2018-12-041-0/+1
| | | | | FileFd could be copied using the default copy constructor, which does not work, and then causes code to crash.
* Use quoted tagnames in config dumpsDavid Kalnischkies2018-11-291-1/+1
| | | | | | | | | | | | | | Tagnames in configuration can include spaces (and other nasties) e.g. in repository-specific configuration options due to Origin/Label potentially containing a space. The configuration file format supports parsing quoted as well as encoded spaces, but the output generated by apt-config and other places which might be feedback into apt via parsing (e.g. before calling apt-key in our gpgv method) do not quote and hence produce invalid configuration files. Changing the default to be an encoded tagname ensures that the output of dump can be used as a config file, but other users might not expect this so that is technically a backward-breaking change.
* Fix typo reported by codespell in code commentsDavid Kalnischkies2018-11-252-2/+2
| | | | | | | | No user visible change expect for some years old changelog entries, so we don't really need to add a new one for this… Reported-By: codespell Gbp-Dch: Ignore
* Merge branch 'feature/subkeys' into 'master'Julian Andres Klode2018-10-141-4/+7
|\ | | | | | | | | Support subkeys and multiple keyrings in Signed-By options See merge request apt-team/apt!27
| * Support multiple keyrings in sources.list Signed-ByDavid Kalnischkies2018-09-111-4/+7
| | | | | | | | | | | | | | A user can specify multiple fingerprints for a while now, so its seems counter-intuitive to support only one keyring, especially if this isn't really checked or enforced and while unlikely mixtures of both should work properly, too, instead of a kinda random behaviour.
* | Set DPKG_FRONTEND_LOCKED when running {pre,post}-invoke scriptsJulian Andres Klode2018-10-051-0/+3
|/ | | | | | | | | Some post-invoke scripts install packages, which fails because the environment variable is not set. This sets the variable for all three kinds of scripts {pre,post-}invoke and pre-install-pkgs, but we will only allow post-invoke at a later time. Gbp-Dch: full
* Use a steady clock source for progress reportingDavid Kalnischkies2018-05-281-5/+12
| | | | | | Clock changes while apt is running can result in strange reports confusing (and amusing) users. Sadly, to keep the ABI for now the code is a bit more ugly than it would need to be.
* don't try SRV requests based on IP addressesDavid Kalnischkies2018-05-111-0/+10
| | | | | IP addresses are by definition not a domain so in the best case the requests will just fail; we can do better than that on our own.
* Remove obsolete RCS keywordsGuillem Jover2018-05-0729-29/+0
| | | | Prompted-by: Jakub Wilk <jwilk@debian.org>
* Fix various typos reported by spellcheckersDavid Kalnischkies2018-05-052-3/+3
| | | | | Reported-By: codespell & spellintian Gbp-Dch: Ignore
* Avoid implicitly promotion of float to doubleDavid Kalnischkies2018-05-051-1/+1
| | | | | Reported-By: gcc -Wdouble-promotion Gbp-Dch: Ignore
* zstd: Implement support for multi-frame filesJulian Andres Klode2018-04-131-4/+12
| | | | | | This implements support for multi frame files while keeping error checking for unexpected EOF working correctly. Files with multiple frames are generated by pzstd, for example.
* Implement compression level handling for zstdJulian Andres Klode2018-04-131-1/+18
| | | | | This is a simplified variant of the code for xz, adapted to support multiple digit integers.
* apt-pkg: Add support for zstdJulian Andres Klode2018-03-122-2/+209
| | | | | | | zstd is a compression algorithm developed by facebook. At level 19, it is about 6% worse in size than xz -6, but decompression is multiple times faster, saving about 40% install time, especially with eatmydata on cloud instances.
* Support cleartext signed InRelease files with CRLF line endingsDavid Kalnischkies2018-01-021-6/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 89c4c588b275 ("fix from David Kalnischkies for the InRelease gpg verification code (LP: #784473)") amended verification of cleartext signatures by a check whether the file to be verified actually starts with "-----BEGIN PGP SIGNATURE-----\n". However cleartext signed InRelease files have been found in the wild which use \r\n as line ending for this armor header line, presumably generated by a Windows PGP client. Such files are incorrectly deemed unsigned and result in the following (misleading) error: Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?) RFC 4880 specifies in 6.2 Forming ASCII Armor: That is to say, there is always a line ending preceding the starting five dashes, and following the ending five dashes. The header lines, therefore, MUST start at the beginning of a line, and MUST NOT have text other than whitespace following them on the same line. RFC 4880 does not seem to specify whether LF or CRLF is used as line ending for armor headers, but CR is generally considered whitespace (e.g. "man perlrecharclass"), hence using CRLF is legal even under the assumption that LF must be used. SplitClearSignedFile() is stripping whitespace (including CR) on lineend already before matching the string, so StartsWithGPGClearTextSignature() is adapted to use the same ignoring. As the earlier method is responsible for what apt will end up actually parsing nowadays as signed/unsigned this change has no implications for security. Thanks: Lukas Wunner for detailed report & initial patch! References: 89c4c588b275d098af33f36eeddea6fd75068342 Closes: 884922