Mercurial > hg-stable
view tests/test-subrepo-paths.t @ 29258:6315c1e14f75
sslutil: introduce a function for determining host-specific settings
This patch marks the beginning of a series that introduces a new,
more configurable, per-host security settings mechanism. Currently,
we have global settings (like web.cacerts and the --insecure argument).
We also have per-host settings via [hostfingerprints].
Global security settings are good for defaults, but they don't
provide the amount of control often wanted. For example, an
organization may want to require a particular CA is used for a
particular hostname.
[hostfingerprints] is nice. But it currently assumes SHA-1.
Furthermore, there is no obvious place to put additional per-host
settings.
Subsequent patches will be introducing new mechanisms for defining
security settings, some on a per-host basis. This commits starts
the transition to that world by introducing the _hostsettings
function. It takes a ui and hostname and returns a dict of security
settings. Currently, it limits itself to returning host fingerprint
info.
We foreshadow the future support of non-SHA1 hashing algorithms
for verifying the host fingerprint by making the "certfingerprints"
key a list of tuples instead of a list of hashes.
We add this dict to the hgstate property on the socket and use it
during socket validation for checking fingerprints. There should be
no change in behavior.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 28 May 2016 11:12:02 -0700 |
parents | ee07f9d142c9 |
children | 4441705b7111 |
line wrap: on
line source
$ hg init outer $ cd outer $ echo '[paths]' >> .hg/hgrc $ echo 'default = http://example.net/' >> .hg/hgrc hg debugsub with no remapping $ echo 'sub = libfoo' > .hgsub $ hg add .hgsub $ hg debugsub path sub source libfoo revision hg debugsub with remapping $ echo '[subpaths]' >> .hg/hgrc $ printf 'http://example.net/lib(.*) = C:\\libs\\\\1-lib\\\n' >> .hg/hgrc $ hg debugsub path sub source C:\libs\foo-lib\ revision test cumulative remapping, the $HGRCPATH file is loaded first $ echo '[subpaths]' >> $HGRCPATH $ echo 'libfoo = libbar' >> $HGRCPATH $ hg debugsub path sub source C:\libs\bar-lib\ revision test absolute source path -- testing with a URL is important since standard os.path.join wont treat that as an absolute path $ echo 'abs = http://example.net/abs' > .hgsub $ hg debugsub path abs source http://example.net/abs revision $ echo 'abs = /abs' > .hgsub $ hg debugsub path abs source /abs revision test bad subpaths pattern $ cat > .hg/hgrc <<EOF > [subpaths] > .* = \1 > EOF $ hg debugsub abort: bad subrepository pattern in $TESTTMP/outer/.hg/hgrc:2: invalid group reference (glob) [255] $ cd ..