From e250df1a623fd08f8a5afe2d94bd29a35e872725 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 21 Mar 2017 09:27:25 +0100 Subject: Show permission error if ProxyAutoDetect cmd can't be executed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As the proxy commands are not executed as root, a user can run into permission errors (s)he isn't expecting – as our switching is an implementation detail – so the error message in that case should really be better than a generic "error code 100" sending the user in the wrong direction as that implies the command was executed, but errored out. Closes: 857885 --- apt-pkg/contrib/proxy.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'apt-pkg/contrib') diff --git a/apt-pkg/contrib/proxy.cc b/apt-pkg/contrib/proxy.cc index 1b7a92c68..a26ab4fbc 100644 --- a/apt-pkg/contrib/proxy.cc +++ b/apt-pkg/contrib/proxy.cc @@ -13,7 +13,8 @@ #include #include -#include +#include +#include #include "proxy.h" /*}}}*/ @@ -41,6 +42,9 @@ bool AutoDetectProxy(URI &URL) if (Debug) std::clog << "Using auto proxy detect command: " << AutoDetectProxyCmd << std::endl; + if (faccessat(AT_FDCWD, AutoDetectProxyCmd.c_str(), R_OK | X_OK, AT_EACCESS) != 0) + return _error->Errno("access", "ProxyAutoDetect command '%s' can not be executed!", AutoDetectProxyCmd.c_str()); + std::string const urlstring = URL; std::vector Args; Args.push_back(AutoDetectProxyCmd.c_str()); -- cgit v1.2.3