summaryrefslogtreecommitdiff
path: root/apt-pkg
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | Merge branch 'debian/sid' into debian/experimentalMichael Vogt2014-11-051-2/+21
|\ \ \ \ \ | |_|/ / / |/| | / / | | |/ / | |/| | Conflicts: debian/changelog
| * | | Fix incorrect comparison between signed/unsignedMichael Vogt2014-10-231-1/+1
| | | | | | | | | | | | | | | | Git-Dch: ignore
| * | | Use sysconf(_SC_ARG_MAX) to find the size of Dpkg::MaxArgBytesMichael Vogt2014-10-231-2/+21
| | | | | | | | | | | | | | | | | | | | Instead of hardcoding Dpkg::MaxArgBytes find out about it using the sysconf(_SC_ARG_MAX) call.
* | | | apt-pkg/acquire-item.h: make friend declaration compatible with older gccMichael Vogt2014-11-041-1/+1
| | | |
* | | | Call "Dequeue()" for items in AbortTransaction() to fix raceMichael Vogt2014-11-042-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | The pkgAcquire::Run() code works uses a while(ToFetch > 0) loop over the items queued for fetching. This means that we need to Deqeueue the item if we call AbortTransaction() to avoid a hang.
* | | | move permission changing from -item to -workerDavid Kalnischkies2014-10-262-45/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The worker is the part closest to the methods, which will call the item methods according to what it gets back from the methods, it is therefore a better place to change permissions as it is very central and can do it now at the point the item is assigned to a method rather than then it is queued for download (and as before while dequeued via Done/Failure). Git-Dch: Ignore
* | | | 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-243-7/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | chown finished partial files earlierDavid Kalnischkies2014-10-234-65/+89
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | partial files are chowned by the Item baseclass to let the methods work with them. Now, this baseclass is also responsible for chowning the files back to root instead of having various deeper levels do this. The consequence is that all overloaded Failed() methods now call the Item::Failed base as their first step. The same is done for Done(). The effect is that even in partial files usually don't belong to _apt anymore, helping sneakernets and reducing possibilities of a bad method modifying files not belonging to them. The change is supported by the framework not only supporting being run as root, but with proper permission management, too, so that privilege dropping can be tested with them.
* | | check that auth.conf exists before chowning itDavid Kalnischkies2014-10-221-3/+4
| | | | | | | | | | | | Git-Dch: Ignore
* | | Ensure /etc/apt/auth.conf has _apt:root ownerMichael Vogt2014-10-211-2/+10
| | | | | | | | | | | | | | | Ensure in SetupAPTPartialDirectory() that the /etc/apt/auth.conf file can be read by the priv sep apt methods.
* | | 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
* | | check for failure message in testsuccess/failureDavid Kalnischkies2014-10-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | These functions check the exit code of the command, but for apt commands we can go further and require an error message for non-zero exits and none for zero exits. Git-Dch: Ignore
* | | use c++ style instead of the last two c-arraysDavid Kalnischkies2014-10-201-21/+21
| | | | | | | | | | | | Git-Dch: Ignore
* | | aborted reverify restores file owner and permissionDavid Kalnischkies2014-10-201-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we get an IMS hit for an InRelease file we use the file we already have and pass it into reverification, but this changes the permissions and on abort of the transaction they weren't switched back. This is now done, additionally, every file in partial which hasn't failed gets permission and owner changed for root access as well, as it is very well possible that the next invocation will (re)use these files.
* | | run acquire transactions only onceDavid Kalnischkies2014-10-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Transactions are run and completed from multiple places, so it happens for unsigned repos that the Release file was commited even if it was previously aborted (due to --no-allow-insecure-repositories). The reason is simply that the "failure" of getting an InRelease/Release.gpg is currently ignored, so that the acquire process believes that nothing bad happened and commits the transaction even though the same transaction was previously aborted.
* | | mark --allow-insecure-repositories message as translateableDavid Kalnischkies2014-10-201-18/+15
| | | | | | | | | | | | | | | | | | | | | Refactors a bit to ensure the same message is used in all three cases as well. Git-Dch: Ignore
* | | ignore Acquire::GzipIndexes for cdrom sourcesDavid Kalnischkies2014-10-151-20/+27
| | | | | | | | | | | | | | | | | | We do not support compressed indexes for cdrom sources as we rewrite some of them, so supporting it correctly could be hard. What we do instead in the meantime is probably disabling it for cdrom sources.
* | | Merge branch 'debian/sid' into debian/experimentalDavid Kalnischkies2014-10-151-5/+5
|\| | | | | | | | | | | | | | | | | | | | | | | The acquire code changed completely, so this is more an import of the testcase and a new fix than the merge of an existent fix. Conflicts: apt-pkg/acquire-item.cc
| * | don't cleanup cdrom files in apt-get updateDavid Kalnischkies2014-10-151-8/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Regression from merging 801745284905e7962aa77a9f37a6b4e7fcdc19d0 and b0f4b486e6850c5f98520ccf19da71d0ed748ae4. While fine by itself, merged the part fixing the filename is skipped if a cdrom source is encountered, so that our list-cleanup removes what seems to be orphaned files. Closes: 765458
* | | 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
* | | Merge branch 'debian/sid' into debian/experimentalMichael Vogt2014-10-141-57/+73
|\| |
| * | Update Status field values handlingGuillem Jover2014-10-081-12/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove long obsolete (hold, hold-reinstreq, removal-failed) or just wrong (post-inst-failed vs postinst-failed) values, that have been autoconverted by dpkg at run-time to their new equivalents, so there should not be any such instance in any recent system (removal-failed since dpkg 1.1.4 in Apr 1996, hold and hold-reinstreq since dpkg 1.2.0 in May 1996). dpkg even stopped doing the mapping in 1.15.4 and 1.15.8 respectively. At the same time sort the list in the same order as they appear in the dpkg code.
| * | implement the updated build profile specjosch2014-10-061-45/+67
| | |
* | | Change default of Acquire::AllowInsecureRepositories to "true"Michael Vogt2014-10-131-1/+4
| | | | | | | | | | | | | | | This change is made for backward compatiblity and should be reverted once jessie is out.
* | | do not load filesize in pkgAcqIndexTrans explicitlyDavid Kalnischkies2014-10-131-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | The constructor is calling the baseclass pkgAcqIndex which does this already – and also does it correctly for compressed files which would overwise lead to the size of uncompressed files to be expected. Git-Dch: Ignore
* | | fix compile and tests errorDavid Kalnischkies2014-10-135-10/+10
| | | | | | | | | | | | | | | | | | I am pretty sure I did that before committing broken stuff… Git-Dch: Ignore
* | | Fix backward compatiblity of the new pkgAcquireMethod::DropPrivsOrDie()Michael Vogt2014-10-134-6/+21
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | trusted=yes sources are secure, we just don't know whyDavid Kalnischkies2014-10-134-14/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Do not require a special flag to be present to update trusted=yes sources as this flag in the sources.list is obviously special enough. Note that this is just disabling the error message, the user will still be warned about all the (possible) failures the repository generated, it is just triggering the acceptance of the warnings on a source-by-source level. Similarily, the trusted=no flag doesn't require the user to pass additional flags to update, if the repository looks fine in the view of apt it will update just fine. The unauthenticated warnings will "just" be presented then the data is used. In case you wonder: Both was the behavior in previous versions, too.
* | | do not inline virtual destructors with d-pointersDavid Kalnischkies2014-10-1318-29/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reimplementing an inline method is opening a can of worms we don't want to open if we ever want to us a d-pointer in those classes, so we do the only thing which can save us from hell: move the destructors into the cc sources and we are good. Technically not an ABI break as the methods inline or not do the same (nothing), so a program compiled against the old version still works with the new version (beside that this version is still in experimental, so nothing really has been build against this library anyway). Git-Dch: Ignore
* | | display a warning for unsigned reposDavid Kalnischkies2014-10-131-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | The same message is used for InRelease if fails in gpgv, but the Release/Release.gpg duo needs to handle the failing download case as well (InRelease just defers to the duo if download fails) and print a message accompaning the insecure error to provide a hint on what is going on.
* | | make --allow-insecure-repositories message an errorDavid Kalnischkies2014-10-131-3/+3
| | | | | | | | | | | | | | | | | | | | | Not using this option, but using unsigned (and co) repositories will cause these repositories to be ignored and data acquiring from them fails, so this is very well in the realms of an error and helps in making 'apt-get update' fail with a non-zero error code as well.
* | | remove useless pdiff filename outputDavid Kalnischkies2014-10-101-4/+3
| | | | | | | | | | | | | | | | | | | | | Looks like a leftover from debugging. Absolutely no need for it and destroys progess reporting completely. Closes: 764737
* | | Only rename StatError files in AbortTransaction()Michael Vogt2014-10-081-4/+7
| | | | | | | | | | | | | | | | | | | | | This fixes a race that we see in travis when two copy operations finish at about the same time but the bad one first. This lead to a rename of the good one and triggers a error when apt tries to verify the good version but can no longer find it.
* | | pkgAcqArchive::QueueNext(): change owner/permission of DestFileMichael Vogt2014-10-081-1/+1
| | | | | | | | | | | | | | | The code was using FinalFile before but we only test the existance of DestFile so we use that instead.
* | | Merge remote-tracking branch 'mvo/feature/expected-size' into ↵Michael Vogt2014-10-085-29/+46
|\ \ \ | | | | | | | | | | | | debian/experimental
| * \ \ Merge remote-tracking branch 'donkult/feature/acq-trans' into ↵Michael Vogt2014-10-081-1/+4
| |\ \ \ | | | | | | | | | | | | | | | feature/expected-size
| * | | | Send "Fail-Reason: MaximumSizeExceeded" from the methodMichael Vogt2014-10-071-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | Communicate the fail reason from the methods to the parent and Rename() failed files.
| * | | | Add new Acquire::MaxReleaseFileSize=10*1000*1000 optionMichael Vogt2014-10-072-28/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This option controls the maximum size of Release/Release.gpg/InRelease files. The rational is that we do not know the size of these files in advance and we want to protect against a denial of service attack where someone sends us endless amounts of data until the disk is full (we do know the size all other files (Packages/Sources/debs)).
| * | | | Merge branch 'feature/acq-trans' into feature/expected-sizeMichael Vogt2014-10-079-1073/+1300
| |\ \ \ \
| * | | | | make expected-size a maximum-size check as this is what we want at this pointMichael Vogt2014-10-073-6/+11
| | | | | |
| * | | | | make http size check workMichael Vogt2014-10-0665-1352/+2835
| |\ \ \ \ \
| * | | | | | Pass ExpectedSize to tthe backend methodMichael Vogt2014-08-263-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This ensures that we can stop downloading if the server send too much data by accident (or by a malicious attempt)
* | | | | | | Merge remote-tracking branch 'mvo/feature/acq-trans' into debian/experimentalMichael Vogt2014-10-0810-1074/+1304
|\ \ \ \ \ \ \ | | |_|_|/ / / | |/| | | | |
| * | | | | | do not show IP in output of testcasesDavid Kalnischkies2014-10-071-1/+4
| | |_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On travis-ci connect.cc detects a rotation, triggering it store the IP which is later appended to the error message, which is all nice and great if we deal with a real server, but in the testcases it just triggers failures as strings do not match. Git-Dch: Ignore
| * | | | | Merge remote-tracking branch 'upstream/debian/experimental' into ↵Michael Vogt2014-10-0727-300/+423
| |\ \ \ \ \ | | | |/ / / | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | feature/acq-trans Conflicts: apt-pkg/acquire-item.cc
| * | | | | UpperCase some functions for consistencyMichael Vogt2014-10-071-25/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | changeOwnerAndPermissionOfFile->ChangeOwnerAndPermissionOfFile preparePartialFile->GetPartialFileName preparePartialFileFromURI->GetPartialFileNameFromURI Git-Dch: ignore
| * | | | | display errortext for all Err as well as Ign logsDavid Kalnischkies2014-10-071-41/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | consistently using Item::Failed in all specializec classes helps setting up some information bits otherwise unset, so some errors had an empty reason as an error. Ign is upgraded to display the error message we ignored to further help in understanding what happens.
| * | | | | use _apt:root only for partial directoriesDavid Kalnischkies2014-10-073-59/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using a different user for calling methods is intended to protect us from methods running amok (via remotely exploited bugs) by limiting what can be done by them. By using root:root for the final directories and just have the files in partial writeable by the methods we enhance this in sofar as a method can't modify already verified data in its parent directory anymore. As a side effect, this also clears most of the problems you could have if the final directories are shared without user-sharing or if these directories disappear as they are now again root owned and only the partial directories contain _apt owned files (usually none if apt isn't running) and the directory itself is autocreated with the right permissions.
| * | | | | ensure partial dirs are 0700 and owned by _apt:rootDavid Kalnischkies2014-10-073-31/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reworks the API involved in creating and setting up the fetcher to be a bit more pleasent to look at and work with as e.g. an empty string for no lock isn't very nice. With the lock we can also stop creating all our partial directories "just in case". This way we can also be a bit more aggressive with the partial directory itself as with a lock, we know we will gone need it.