summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib
Commit message (Collapse)AuthorAgeFilesLines
* show URI.Path in all acquire item descriptionsDavid Kalnischkies2015-06-112-4/+12
| | | | | | | | | | | | | | It is a rather strange sight that index items use SiteOnly which strips the Path, while e.g. deb files are downloaded with NoUserPassword which does not. Important to note here is that for the file transport Path is pretty important as there is no Host which would be displayed by Site, which always resulted in "interesting" unspecific errors for "file:". Adding a 'middle' ground between the two which does show the Path but potentially modifies it (it strips a pending / at the end if existing) solves this "file:" issue, syncs the output and in the end helps to identify which file is meant exactly in progress output and co as a single site can have multiple repositories in different paths.
* configureable acquire targets to download additional filesDavid Kalnischkies2015-06-092-11/+4
| | | | | | | | First pass at making the acquire system capable of downloading files based on configuration rather than hardcoded entries. It is now possible to instruct 'deb' and 'deb-src' sources.list lines to download more than just Packages/Translation-* and Sources files. Details on how to do that can be found in the included documentation file.
* support hashes for compressed pdiff filesDavid Kalnischkies2015-06-092-3/+15
| | | | | | | | At the moment we only have hashes for the uncompressed pdiff files, but via the new '$HASH-Download' field in the .diff/Index hashes can be provided for the .gz compressed pdiff file, which apt will pick up now and use to verify the download. Now, we "just" need a buy in from the creators of repositories…
* rework hashsum verification in the acquire systemDavid Kalnischkies2015-06-092-0/+19
| | | | | | | | | | | | | | | | | | | | | Having every item having its own code to verify the file(s) it handles is an errorprune process and easy to break, especially if items move through various stages (download, uncompress, patching, …). With a giant rework we centralize (most of) the verification to have a better enforcement rate and (hopefully) less chance for bugs, but it breaks the ABI bigtime in exchange – and as we break it anyway, it is broken even harder. It shouldn't effect most frontends as they don't deal with the acquire system at all or implement their own items, but some do and will need to be patched (might be an opportunity to use apt on-board material). The theory is simple: Items implement methods to decide if hashes need to be checked (in this stage) and to return the expected hashes for this item (in this stage). The verification itself is done in worker message passing which has the benefit that a hashsum error is now a proper error for the acquire system rather than a Done() which is later revised to a Failed().
* Merge branch 'debian/sid' into debian/experimentalMichael Vogt2015-05-221-1/+2
|\ | | | | | | | | | | | | | | | | Conflicts: apt-pkg/pkgcache.h debian/changelog methods/https.cc methods/server.cc test/integration/test-apt-download-progress
| * Merge remote-tracking branch 'upstream/debian/jessie' into debian/sidMichael Vogt2015-05-221-1/+1
| |\ | | | | | | | | | | | | Conflicts: apt-pkg/deb/dpkgpm.cc
| * | Move sysconf(_SC_OPEN_MAX); out of the for() loop to avoid unneeded syscallsMichael Vogt2015-04-281-1/+2
| | |
* | | implement VerifyFile as all-hashes checkDavid Kalnischkies2015-05-121-7/+14
| | | | | | | | | | | | | | | | | | | | | It isn't used much compared to what the methodname suggests, but in the remaining uses it can't hurt to check more than strictly necessary by calculating and verifying with all hashes we can compare with rather than "just" the best known hash.
* | | fix macro definition for very old GCC < 3David Kalnischkies2015-05-111-1/+1
| | | | | | | | | | | | Git-Dch: Ignore
* | | Merge branch 'debian/jessie' into debian/experimentalDavid Kalnischkies2015-04-191-1/+1
|\ \ \ | | |/ | |/| | | | | | | | | | | | | | | | | | | Conflicts: apt-pkg/acquire-item.cc cmdline/apt-key.in methods/https.cc test/integration/test-apt-key test/integration/test-multiarch-foreign
| * | demote VectorizeString gcc attribute from const to pureDavid Kalnischkies2015-04-071-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | g++-5 generates a slightly broken libapt which doesn't split architecture configurations correctly resulting in e.g. Packages files requested for the bogus architecture 'amd64,i386' instead of for amd64 and i386. The reason is an incorrectly applied attribute marking the function as const, while functions with pointer arguments are not allowed to be declared as such (note that char& is a char* in disguise). Demoting the attribute to pure fixes this issue – better would be dropping the & from char but that is an API change… Neither earlier g++ versions nor clang use this attribute to generate broken code, so we don't need a rebuild of dependencies or anything and g++-5 isn't even included in jessie, but the effect is so strange and apt popular enough to consider avoiding this problem anyhow.
| * allow options between command and -- on commandlineDavid Kalnischkies2014-11-101-8/+11
| | | | | | | | | | | | | | This used to work before we implemented a stricter commandline parser and e.g. the dd-schroot-cmd command constructs commandlines like this. Reported-By: Helmut Grohne
| * add a simple container for HashStringsDavid Kalnischkies2014-11-102-15/+187
| | | | | | | | | | | | | | | | | | | | | | | | | | APT supports more than just one HashString and even allows to enforce the usage of a specific hash. This class is intended to help with storage and passing around of the HashStrings. The cherry-pick here the un-const-ification of HashType() compared to f4c3850ea335545e297504941dc8c7a8f1c83358. The point of this commit is adding infrastructure for the next one. All by itself, it just adds new symbols. Git-Dch: Ignore
* | ensure lists/ files have correct permissions after apt-cdrom addDavid Kalnischkies2015-04-192-1/+31
| | | | | | | | | | | | | | | | Its a bit unpredictable which permissons and owners we will encounter on a CD-ROM (or a USB stick, as apt-cdrom is responsible for those too), so we have to ensure in this codepath as well that everything is nicely setup without waiting for a 'apt-get update' to fix up the (potential) mess.
* | calculate only expected hashes in methodsDavid Kalnischkies2015-04-192-19/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Methods get told which hashes are expected by the acquire system, which means we can use this list to restrict what we calculate in the methods as any extra we are calculating is wasted effort as we can't compare it with anything anyway. Adding support for a new hash algorithm is therefore 'free' now and if a algorithm is no longer provided in a repository for a file, we automatically stop calculating it. In practice this results in a speed-up in Debian as we don't have SHA512 here (so far), so we practically stop calculating it.
* | if we can, use gccs __builtin_swap methodsDavid Kalnischkies2015-04-191-0/+9
| | | | | | | | Git-Dch: Ignore
* | reimplement the last uses of sprintfDavid Kalnischkies2015-04-102-86/+71
| | | | | | | | | | | | | | | | Working with strings c-style is complicated and error-prune, so by converting to c++ style we gain some simplicity and avoid buffer overflows by later extensions. Git-Dch: Ignore
* | fix some new compiler warnings reported by gcc-5David Kalnischkies2015-03-161-5/+5
| | | | | | | | Git-Dch: Ignore
* | streamline display of --help in all toolsDavid Kalnischkies2014-11-092-0/+4
| | | | | | | | | | | | | | By convention, if I run a tool with --help or --version I expect it to exit successfully with the usage, while if I do call it wrong (like without any parameters) I expect the usage message shown with a non-zero exit.
* | explicit overload methods instead of adding parametersDavid Kalnischkies2014-11-082-0/+14
| | | | | | | | | | | | | | | | Adding a new parameter (with a default) is an ABI break, but you can overload a method, which is "just" an API break for everyone doing references to this method (aka: nobody). Git-Dch: Ignore
* | guard const-ification API changesDavid Kalnischkies2014-11-081-0/+2
| | | | | | | | Git-Dch: Ignore
* | use a abi version check similar to the gcc checkDavid Kalnischkies2014-11-081-0/+1
| | | | | | | | Git-Dch: Ignore
* | replace ignore-deprecated #pragma dance with _PragmaDavid Kalnischkies2014-11-083-28/+24
| | | | | | | | | | | | | | | | | | For compatibility we use/provide and fill quiet some deprecated methods and fields, which subsequently earns us a warning for using them. These warnings therefore have to be disabled for these codeparts and that is what this change does now in a slightly more elegant way. Git-Dch: Ignore
* | (error) va_list 'args' was opened but not closed by va_end()David Kalnischkies2014-11-081-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | The manpage of va_start and co additionally says: On some systems, va_end contains a closing '}' matching a '{' in va_start, so that both macros must occur in the same function, and in a way that allows this. So instead of return/breaking instantly, we save the return, make a proper turndown with va_end in all cases and only end after that. Reported-By: cppcheck Git-Dch: Ignore
* | Bump ABI to 4.15Michael Vogt2014-11-051-1/+1
| |
* | rewrite ReadMessages()David Kalnischkies2014-10-261-58/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | Central methods of our infrastructure like this one responsible for communication with our methods shouldn't be more complicated then they have to and not claim to have (albeit unlikely) bugs. While I am not sure about having improved the first part, the bug is now gone and a few explicit tests check that it stays that way, so nobody will notice the difference (hopefully) – expect that this should a very tiny bit faster as well as we don't manually proceed through the string. Git-Dch: Ignore
* | promote filesize to a hashstringDavid Kalnischkies2014-10-242-7/+29
| | | | | | | | | | | | | | | | | | It is a very simple hashstring, which is why it isn't contributing to the usability of a list of them, but it is also trivial to check and calculate, so it doesn't hurt checking it either as it can combined even with the simplest other hashes greatly complicate attacks on them as you suddenly need a same-size hash collision, which is usually a lot harder to achieve.
* | test if TMPDIR is accessible before usingDavid Kalnischkies2014-10-201-2/+4
| | | | | | | | | | | | | | | | | | | | Private temporary directories as created by e.g. libpam-tmpdir are nice, but they are also very effective in preventing our priviledge dropping to work as TMPDIR will be set to a directory only root has access to, so working with it as _apt will fail. We circumvent this by extending our check for a usable TMPDIR setting by checking access rights. Closes: 765951
* | set PR_SET_NO_NEW_PRIVS even if sandbox is disabledDavid Kalnischkies2014-10-151-6/+6
| | | | | | | | | | | | | | Similar to 8f45798d532223adc378a4ad9ecfc64b3be26e4f, there is no harm to set this, even if we don't drop privileges. Git-Dch: Ignore
* | Fix backward compatiblity of the new pkgAcquireMethod::DropPrivsOrDie()Michael Vogt2014-10-131-1/+6
| | | | | | | | | | | | | | | | Do not drop privileges in the methods when using a older version of libapt that does not support the chown magic in partial/ yet. To do this DropPrivileges() now will ignore a empty Apt::Sandbox::User. Cleanup all hardcoded _apt along the way.
* | Merge remote-tracking branch 'mvo/feature/acq-trans' into debian/experimentalMichael Vogt2014-10-081-1/+1
|\ \
| * \ Merge remote-tracking branch 'upstream/debian/experimental' into ↵Michael Vogt2014-10-075-18/+11
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | feature/acq-trans Conflicts: apt-pkg/acquire-item.cc
| * | | Adjust DestFile in ReverifyAfterIMS() to not include compr ExtensionMichael Vogt2014-09-291-1/+1
| | | |
* | | | set PR_SET_NO_NEW_PRIVS also if run as non-rootDavid Kalnischkies2014-10-071-11/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Changing user and co works only as root, but can do some things for methods run as normal user as well to protect them from being able to call setuid binaries like sudo to elevate their privileges. Also uses a cheap trick now to build with old unsupporting kernels.
* | | | fix foldmarkers in fileutl.ccDavid Kalnischkies2014-10-071-21/+14
| | | | | | | | | | | | | | | | Git-Dch: Ignore
* | | | Ignore EINVAL from prctl(PR_SET_NO_NEW_PRIVS)Michael Vogt2014-10-071-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ignore a EINVAL error here as it means that the kernel is too old to understand this option. We should not fail hard in this case but just ignore the error. closes: 764066
* | | | Rename DropPrivs() to DropPrivileges()Michael Vogt2014-10-072-2/+2
| |/ / |/| | | | | | | | Git-Dch: ignore
* | | Bump library version to libapt-pkg4.14Michael Vogt2014-10-031-1/+1
| | |
* | | support parsing of all hashes for pdiffDavid Kalnischkies2014-09-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fileformat of a pdiff index stores currently only SHA1 hashes. With this change, we look for all other hashes we support as well and take what we get, so that we can work after the release of jessie to get right of SHA1 if we want to. Note that the completely patched file is and was checked against the hashes collected from the Release file, so this transition isn't mission critical.
* | | mark private methods as hiddenDavid Kalnischkies2014-09-302-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We are the only possible users of private methods, so we are also the only users who can potentially export them via using them in inline methods. The point is: We don't need these symbols exported if we don't do this, so marking them as hidden removes some methods from the API without breaking anything as nobody could have used them. Git-Dch: Ignore
* | | fix Configuration::FindVector APIDavid Kalnischkies2014-09-292-11/+2
|/ / | | | | | | Git-Dch: Ignore
* | allow options between command and -- on commandlineDavid Kalnischkies2014-09-281-8/+11
| | | | | | | | | | | | | | This used to work before we implemented a stricter commandline parser and e.g. the dd-schroot-cmd command constructs commandlines like this. Reported-By: Helmut Grohne
* | fix: Consecutive return, break, continue, goto or throw statements are ↵David Kalnischkies2014-09-271-3/+1
| | | | | | | | | | | | | | unnecessary. Git-Dch: Ignore Reported-By: cppcheck
* | add and use 'apt-key verify' which prefers gpgv over gpgDavid Kalnischkies2014-09-271-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | gnupg/gnupg2 can do verify just fine of course, so we don't need to use gpgv here, but it is what we always used in the past, so there might be scripts expecting a certain output and more importantly the output of apt-cdrom contains messages from gpg and even with all the settings we activate to prevent it, it still shows (in some versions) a quiet scary: "gpg: WARNING: Using untrusted key!" message. Keeping the use of gpgv is the simplest way to prevent it. We are increasing also the "Breaks: apt" version from libapt as it requires a newer apt-key than might be installed in partial upgrades.
* | add --readonly option for apt-key advDavid Kalnischkies2014-09-271-0/+1
| | | | | | | | | | | | | | | | Some advanced commands can be executed without the keyring being modified like --verify, so this adds an option to disable the mergeback and uses it for our gpg calling code. Git-Dch: Ignore
* | use apt-key adv (+ gnupg) instead of gpgv for verifyDavid Kalnischkies2014-09-271-45/+18
| | | | | | | | | | | | | | | | apt-key does the keyring merge as we need it, so we just call it instead of reimplementing it to do the merging before gpgv. This means we don't use gpgv anymore (we never depended on it explicitly - bad style), but it also means that the message in apt-cdrom add is a bit less friendly as it says loudly "untrusted key", but for a one-time command its okay.
* | fix: Member variable 'X' is not initialized in the constructor.David Kalnischkies2014-09-271-1/+1
| | | | | | | | | | Reported-By: cppcheck Git-Dch: Ignore
* | DropPrivs: Document what it doesJulian Andres Klode2014-09-241-1/+11
| | | | | | | | Git-Dch: ignore
* | DropPrivs: Use APT::Sandbox::User instead of Apt::User::NobodyJulian Andres Klode2014-09-241-3/+3
| | | | | | | | Git-Dch: ignore
* | DropPrivs: Hard-fail if the user does not existJulian Andres Klode2014-09-241-1/+1
| | | | | | | | Git-Dch: ignore