summaryrefslogtreecommitdiff
path: root/methods
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2014-09-24 21:49:19 +0200
committerJulian Andres Klode <jak@debian.org>2014-09-24 21:49:19 +0200
commit7b18d5592fd5e0bb173e193d1e6693a66065f971 (patch)
treec7485a668a96e6b644adae4b5f46a78827878d98 /methods
parentf1e3c8f002be54617656fc4ca525c3f1e57323f3 (diff)
methods: Fail if we cannot drop privileges
Diffstat (limited to 'methods')
-rw-r--r--methods/copy.cc4
-rw-r--r--methods/ftp.cc6
-rw-r--r--methods/gpgv.cc4
-rw-r--r--methods/gzip.cc5
-rw-r--r--methods/http_main.cc4
-rw-r--r--methods/https.cc4
6 files changed, 14 insertions, 13 deletions
diff --git a/methods/copy.cc b/methods/copy.cc
index 18d70e153..3883c822b 100644
--- a/methods/copy.cc
+++ b/methods/copy.cc
@@ -118,8 +118,8 @@ int main()
{
setlocale(LC_ALL, "");
- DropPrivs();
-
CopyMethod Mth;
+
+ Mth.DropPrivsOrDie();
return Mth.Run();
}
diff --git a/methods/ftp.cc b/methods/ftp.cc
index 9d58aa3b9..a658b5657 100644
--- a/methods/ftp.cc
+++ b/methods/ftp.cc
@@ -1107,9 +1107,6 @@ int main(int, const char *argv[])
{
setlocale(LC_ALL, "");
- // no more active ftp, sorry
- DropPrivs();
-
/* See if we should be come the http client - we do this for http
proxy urls */
if (getenv("ftp_proxy") != 0)
@@ -1134,6 +1131,9 @@ 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 159417883..4071cbac6 100644
--- a/methods/gpgv.cc
+++ b/methods/gpgv.cc
@@ -262,10 +262,10 @@ bool GPGVMethod::Fetch(FetchItem *Itm)
int main()
{
setlocale(LC_ALL, "");
-
- DropPrivs();
GPGVMethod Mth;
+ Mth.DropPrivsOrDie();
+
return Mth.Run();
}
diff --git a/methods/gzip.cc b/methods/gzip.cc
index 518e58f82..7ffcda60f 100644
--- a/methods/gzip.cc
+++ b/methods/gzip.cc
@@ -135,11 +135,12 @@ int main(int, char *argv[])
{
setlocale(LC_ALL, "");
- DropPrivs();
-
Prog = strrchr(argv[0],'/');
++Prog;
GzipMethod Mth;
+
+ Mth.DropPrivsOrDie();
+
return Mth.Run();
}
diff --git a/methods/http_main.cc b/methods/http_main.cc
index 788582632..d7724701a 100644
--- a/methods/http_main.cc
+++ b/methods/http_main.cc
@@ -12,8 +12,8 @@ int main()
// closes the connection (this is dealt with via ServerDie())
signal(SIGPIPE, SIG_IGN);
- DropPrivs();
-
HttpMethod Mth;
+
+ Mth.DropPrivsOrDie();
return Mth.Loop();
}
diff --git a/methods/https.cc b/methods/https.cc
index a40f37710..a74d2a38b 100644
--- a/methods/https.cc
+++ b/methods/https.cc
@@ -443,11 +443,11 @@ int main()
{
setlocale(LC_ALL, "");
- DropPrivs();
-
HttpsMethod Mth;
curl_global_init(CURL_GLOBAL_SSL) ;
+ Mth.DropPrivsOrDie();
+
return Mth.Run();
}