summaryrefslogtreecommitdiff
path: root/methods/basehttp.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2026-05-17 18:53:37 +0000
committerJulian Andres Klode <jak@debian.org>2026-05-17 18:53:37 +0000
commitc28202d199f46fb31d8b510d2fe74c4a1d0c014e (patch)
tree7c71a2aa92ca07d49990230a67f56d1b5ee634e2 /methods/basehttp.cc
parent1514ddad0e542c325c55c93866507dcc96ff5c29 (diff)
parent45f1fd73d0b62ce6422365a935abc317718ea142 (diff)
Merge branch 'lp2150631' into 'main'
Warn if auth.conf is unreadable (LP: #2150631) See merge request apt-team/apt!580
Diffstat (limited to 'methods/basehttp.cc')
-rw-r--r--methods/basehttp.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/methods/basehttp.cc b/methods/basehttp.cc
index db0ed228f..8dd596f8f 100644
--- a/methods/basehttp.cc
+++ b/methods/basehttp.cc
@@ -506,6 +506,18 @@ BaseHttpMethod::DealWithHeaders(FetchResult &Res, RequestState &Req)
std::string err;
strprintf(err, "HttpError%u", Req.Result);
SetFailReason(err);
+ if (Req.Result == 401 && inaccessibleAuthConfs.empty() == false)
+ {
+ std::string conflist;
+ std::string msg;
+ for (auto const &path : inaccessibleAuthConfs)
+ conflist += (conflist.empty() ? "" : ", ") + path;
+ strprintf(msg, _("Authentication credentials may be configured in %s, "
+ "but the file(s) are not readable by the current user. "
+ "Try running this command as root."),
+ conflist.c_str());
+ Warning(std::move(msg));
+ }
_error->Error("%u %s", Req.Result, Req.Code);
}
if (Req.haveContent == HaveContent::TRI_TRUE)