aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-09-11 22:53:37 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-09-12 14:08:23 +0300
commitc289f73d6fdc9f86b90e0986ba3b0da0c29e7927 (patch)
tree22ffa690dd1ef9f53cbf12923ec27a5eb2b0f70d
parent4c93cc56234f34947c94710a7d6940ef327089d4 (diff)
Match certificate fingerprints case-insensitively
-rw-r--r--bpkg/auth.cxx13
-rw-r--r--bpkg/common.cli2
-rw-r--r--bpkg/repository-types.cli2
-rw-r--r--bpkg/types.hxx4
4 files changed, 12 insertions, 9 deletions
diff --git a/bpkg/auth.cxx b/bpkg/auth.cxx
index e661ad0..0693abc 100644
--- a/bpkg/auth.cxx
+++ b/bpkg/auth.cxx
@@ -61,14 +61,14 @@ namespace bpkg
p /= ".";
- // If this is a remote location then use the canonical name prefix. For
- // a local location this doesn't always work. Consider:
+ // If this is a remote location then use the canonical name prefix. For a
+ // local location this doesn't always work. Consider:
//
// .../pkg/1/build2.org/common/hello
//
- // In this case we will end with an empty canonical name (because of
- // the special pkg/1 treatment). So in case of local locations we will
- // use the location rather than the name prefix.
+ // In this case we will end with an empty canonical name (because of the
+ // special pkg/1 treatment). So in case of local locations we will use the
+ // location rather than the name prefix.
//
if (rl.remote ())
return repository_location (
@@ -527,7 +527,8 @@ namespace bpkg
return cert_auth {move (cert), true};
}
- if (dependent_trust && *dependent_trust == cert->fingerprint)
+ if (dependent_trust &&
+ icasecmp (*dependent_trust, cert->fingerprint) == 0)
{
if (verb >= 2)
info << "certificate for repository " << rl.canonical_name () <<
diff --git a/bpkg/common.cli b/bpkg/common.cli
index 4537961..49a7788 100644
--- a/bpkg/common.cli
+++ b/bpkg/common.cli
@@ -310,7 +310,7 @@ namespace bpkg
\cb{none}."
}
- std::set<string> --trust
+ std::set<string, icase_compare_string> --trust
{
"<fingerprint>",
"Trust repository certificate with a SHA256 <fingerprint>. Such a
diff --git a/bpkg/repository-types.cli b/bpkg/repository-types.cli
index ad8f09d..21ddaf9 100644
--- a/bpkg/repository-types.cli
+++ b/bpkg/repository-types.cli
@@ -32,7 +32,7 @@ cannot be guessed from the URL. See \l{bpkg-rep-add(1)} for details.
A \cb{pkg} repository is \i{archive}-based. That is, it contains a collection
of various packages/versions as archive files. For more information on the
structure of \cb{pkg} repositories refer to \l{bpkg The \cb{build2} Package
-Manager Manual}. The \cb{dir} repository location can be a local directory
+Manager Manual}. The \cb{pkg} repository location can be a local directory
path or an \cb{http(s)://} URL.
diff --git a/bpkg/types.hxx b/bpkg/types.hxx
index 4f0cc98..65dba60 100644
--- a/bpkg/types.hxx
+++ b/bpkg/types.hxx
@@ -24,7 +24,8 @@
#include <libbutl/url.mxx>
#include <libbutl/path.mxx>
#include <libbutl/process.mxx>
-#include <libbutl/utility.mxx> // compare_reference_target
+#include <libbutl/utility.mxx> // icase_compare_string,
+ // compare_reference_target
#include <libbutl/optional.mxx>
#include <libbutl/fdstream.mxx>
#include <libbutl/small-vector.mxx>
@@ -71,6 +72,7 @@ namespace bpkg
// <libbutl/utility.mxx>
//
+ using butl::icase_compare_string;
using butl::compare_reference_target;
// <libbutl/optional.mxx>