summaryrefslogtreecommitdiff
path: root/methods/gzip.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@ubuntu.com>2014-10-13 10:57:30 +0200
committerMichael Vogt <mvo@ubuntu.com>2014-10-13 11:29:47 +0200
commit9983999d294887046abf386adc31190700d89b61 (patch)
tree441df32a5b9767c69b9517c4ae180b953d8dc283 /methods/gzip.cc
parent954d30df8d8b0fb4fa203d09674a4fe1e990e55c (diff)
downloadapt-9983999d294887046abf386adc31190700d89b61.tar.gz
Fix backward compatiblity of the new pkgAcquireMethod::DropPrivsOrDie()
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.
Diffstat (limited to 'methods/gzip.cc')
-rw-r--r--methods/gzip.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/methods/gzip.cc b/methods/gzip.cc
index 7ffcda60f..387c05f2e 100644
--- a/methods/gzip.cc
+++ b/methods/gzip.cc
@@ -33,12 +33,22 @@ const char *Prog;
class GzipMethod : public pkgAcqMethod
{
virtual bool Fetch(FetchItem *Itm);
+ virtual bool Configuration(std::string Message);
public:
GzipMethod() : pkgAcqMethod("1.1",SingleInstance | SendConfig) {};
};
+bool GzipMethod::Configuration(std::string Message)
+{
+ if (pkgAcqMethod::Configuration(Message) == false)
+ return false;
+
+ DropPrivsOrDie();
+
+ return true;
+}
// GzipMethod::Fetch - Decompress the passed URI /*{{{*/
// ---------------------------------------------------------------------
@@ -140,7 +150,5 @@ int main(int, char *argv[])
GzipMethod Mth;
- Mth.DropPrivsOrDie();
-
return Mth.Run();
}