summaryrefslogtreecommitdiff
path: root/methods
diff options
context:
space:
mode:
Diffstat (limited to 'methods')
-rw-r--r--methods/ftp.cc7
-rw-r--r--methods/gpgv.cc14
-rw-r--r--methods/gzip.cc12
-rw-r--r--methods/http.cc2
-rw-r--r--methods/http_main.cc1
-rw-r--r--methods/https.cc12
-rw-r--r--methods/https.h2
7 files changed, 39 insertions, 11 deletions
diff --git a/methods/ftp.cc b/methods/ftp.cc
index 5b739ea06..0504e5872 100644
--- a/methods/ftp.cc
+++ b/methods/ftp.cc
@@ -988,6 +988,10 @@ bool FtpMethod::Configuration(string Message)
return false;
TimeOut = _config->FindI("Acquire::Ftp::Timeout",TimeOut);
+
+ // no more active ftp, sorry
+ DropPrivsOrDie();
+
return true;
}
/*}}}*/
@@ -1141,8 +1145,5 @@ int main(int, const char *argv[])
FtpMethod Mth;
- // no more active ftp, sorry
- Mth.DropPrivsOrDie();
-
return Mth.Run();
}
diff --git a/methods/gpgv.cc b/methods/gpgv.cc
index 7e8500c51..488c16826 100644
--- a/methods/gpgv.cc
+++ b/methods/gpgv.cc
@@ -44,12 +44,22 @@ class GPGVMethod : public pkgAcqMethod
protected:
virtual bool Fetch(FetchItem *Itm);
-
+ virtual bool Configuration(string Message);
public:
GPGVMethod() : pkgAcqMethod("1.0",SingleInstance | SendConfig) {};
};
+bool GPGVMethod::Configuration(string Message)
+{
+ if (pkgAcqMethod::Configuration(Message) == false)
+ return false;
+
+ DropPrivsOrDie();
+
+ return true;
+}
+
string GPGVMethod::VerifyGetSigners(const char *file, const char *outfile,
vector<string> &GoodSigners,
vector<string> &BadSigners,
@@ -265,7 +275,5 @@ int main()
GPGVMethod Mth;
- Mth.DropPrivsOrDie();
-
return Mth.Run();
}
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();
}
diff --git a/methods/http.cc b/methods/http.cc
index c00b439b7..a5de13511 100644
--- a/methods/http.cc
+++ b/methods/http.cc
@@ -770,6 +770,8 @@ bool HttpMethod::Configuration(string Message)
if (ServerMethod::Configuration(Message) == false)
return false;
+ DropPrivsOrDie();
+
AllowRedirect = _config->FindB("Acquire::http::AllowRedirect",true);
PipelineDepth = _config->FindI("Acquire::http::Pipeline-Depth",
PipelineDepth);
diff --git a/methods/http_main.cc b/methods/http_main.cc
index f21a5709c..cd52c42e8 100644
--- a/methods/http_main.cc
+++ b/methods/http_main.cc
@@ -15,6 +15,5 @@ int main()
HttpMethod Mth;
- Mth.DropPrivsOrDie();
return Mth.Loop();
}
diff --git a/methods/https.cc b/methods/https.cc
index 16d564b34..366148e19 100644
--- a/methods/https.cc
+++ b/methods/https.cc
@@ -37,6 +37,16 @@
/*}}}*/
using namespace std;
+bool HttpsMethod::Configuration(std::string Message)
+{
+ if (pkgAcqMethod::Configuration(Message) == false)
+ return false;
+
+ DropPrivsOrDie();
+
+ return true;
+}
+
size_t
HttpsMethod::parse_header(void *buffer, size_t size, size_t nmemb, void *userp)
{
@@ -452,8 +462,6 @@ int main()
HttpsMethod Mth;
curl_global_init(CURL_GLOBAL_SSL) ;
- Mth.DropPrivsOrDie();
-
return Mth.Run();
}
diff --git a/methods/https.h b/methods/https.h
index 0387cb9b5..9df18e83a 100644
--- a/methods/https.h
+++ b/methods/https.h
@@ -58,6 +58,8 @@ class HttpsMethod : public pkgAcqMethod
static const int DL_MIN_SPEED = 10;
virtual bool Fetch(FetchItem *);
+ virtual bool Configuration(std::string Message);
+
static size_t parse_header(void *buffer, size_t size, size_t nmemb, void *userp);
static size_t write_data(void *buffer, size_t size, size_t nmemb, void *userp);
static int progress_callback(void *clientp, double dltotal, double dlnow,