From 18c4e5eaf4d400ebee86caafe34f18aa5734c3ca Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 3 Dec 2019 20:56:42 +0000 Subject: [PATCH] stest: Transfer pubkeys from test-example We are going to have tests which use the peer-keys site config key, which refers to external key files from a pubkeys directory. In the case of stest, these are pubkeys from test-example. Because secnet may rename files etc. in this directory, we need a private one per test. So, for each test, when making the config file, make a copy of the pubkeys directory. Of course this means that directory needs to exist, so mkdir it (and clean it), although the machinery for populating it doesn't exist yet. Also, when copying the sites.conf file, adjust references to test-example to refer to the copy. (Currently there won't be any such references.) Signed-off-by: Ian Jackson --- .gitignore | 1 + stest/common.tcl | 9 +++++++++ test-example/Dir.sd.mk | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/.gitignore b/.gitignore index a8320c9..651e93b 100644 --- a/.gitignore +++ b/.gitignore @@ -45,6 +45,7 @@ debian/secnet.substvars test-example/*.key test-example/*.privkeys +test-example/pubkeys test-example/sites.conf test-example/bogus-setup-request build-stamp diff --git a/stest/common.tcl b/stest/common.tcl index 7891e1d..5b87e73 100644 --- a/stest/common.tcl +++ b/stest/common.tcl @@ -96,13 +96,22 @@ exec cat transform eax-serpent { }, serpent256-cbc { }; } + set pubkeys $tmp/$site.pubkeys + file delete -force $pubkeys + exec cp -rl $builddir/test-example/pubkeys $pubkeys + set f [open $builddir/test-example/sites.conf r] + while {[gets $f l] >= 0} { + regsub {\"[^\"]*test-example/pubkeys/} $l "\"$pubkeys/" l + append cfg $l "\n" + } set sites [read $f] close $f append cfg $sites append cfg { sites map(site,all-sites); } + return $cfg } diff --git a/test-example/Dir.sd.mk b/test-example/Dir.sd.mk index 59d54e8..763e169 100644 --- a/test-example/Dir.sd.mk +++ b/test-example/Dir.sd.mk @@ -6,8 +6,12 @@ include common.make base64 -d <$< >$@.new && mv -f $@.new $@ &sites.conf: $(src)/make-secnet-sites &^/sites &/Dir.mk + mkdir -p &pubkeys $(src)/make-secnet-sites &^/sites $@ +&clean:: + rm -rf &pubkeys + define privkey &/$1.privkeys/priv.$2: &/$3 mkdir -p $$(dir $$@) && cp $$< $$@.tmp && mv -f $$@.tmp $$@ -- 2.30.2