diff options
author | Viorel Munteanu <ceamac@gentoo.org> | 2024-04-06 20:47:56 +0300 |
---|---|---|
committer | Viorel Munteanu <ceamac@gentoo.org> | 2024-04-06 20:50:55 +0300 |
commit | a8fa1aff3bcbb91cbdee0344a251f44110376747 (patch) | |
tree | 89ad2d87dcbf34f311125496096a688dca4f08eb /net-misc | |
parent | profiles/arch/s390: mask net-misc/dropbear[test] (diff) | |
download | gentoo-a8fa1aff3bcbb91cbdee0344a251f44110376747.tar.gz gentoo-a8fa1aff3bcbb91cbdee0344a251f44110376747.tar.bz2 gentoo-a8fa1aff3bcbb91cbdee0344a251f44110376747.zip |
net-misc/dropbear: fix client-server tests
Use sys-libs/nss_wrapper to fake home dir for dropbear server.
Signed-off-by: Viorel Munteanu <ceamac@gentoo.org>
Diffstat (limited to 'net-misc')
-rw-r--r-- | net-misc/dropbear/dropbear-2024.84.ebuild | 4 | ||||
-rw-r--r-- | net-misc/dropbear/files/dropbear-2024.84-fix-channels-tests.patch | 36 |
2 files changed, 39 insertions, 1 deletions
diff --git a/net-misc/dropbear/dropbear-2024.84.ebuild b/net-misc/dropbear/dropbear-2024.84.ebuild index 68f1c4674d72..83d23fbcf782 100644 --- a/net-misc/dropbear/dropbear-2024.84.ebuild +++ b/net-misc/dropbear/dropbear-2024.84.ebuild @@ -43,6 +43,7 @@ DEPEND=" RDEPEND+=" pam? ( >=sys-auth/pambase-20080219.1 )" BDEPEND=" test? ( + sys-libs/nss_wrapper $(python_gen_any_dep ' dev-python/attrs[${PYTHON_USEDEP}] dev-python/iniconfig[${PYTHON_USEDEP}] @@ -63,6 +64,7 @@ PATCHES=( "${FILESDIR}"/${PN}-2024.84-dbscp.patch "${FILESDIR}"/${PN}-2022.82-tests.patch "${FILESDIR}"/${PN}-2024.84-non-interactive-tests.patch + "${FILESDIR}"/${PN}-2024.84-fix-channels-tests.patch ) set_options() { @@ -106,7 +108,7 @@ src_prepare() { restore_config localoptions.h # remove tests that fail - rm test/test_aslr.py test/test_channels.py || die + rm test/test_aslr.py || die # dropbearconver is not build with USE minimal if use minimal; then diff --git a/net-misc/dropbear/files/dropbear-2024.84-fix-channels-tests.patch b/net-misc/dropbear/files/dropbear-2024.84-fix-channels-tests.patch new file mode 100644 index 000000000000..0db292da8332 --- /dev/null +++ b/net-misc/dropbear/files/dropbear-2024.84-fix-channels-tests.patch @@ -0,0 +1,36 @@ +dbclient obeys $HOME, but dropbear (the server) resolves HOME using getpwnam. +Use sys-libs/nss_wrapper to fake it during tests. + +--- a/test/Makefile.in ++++ b/test/Makefile.in +@@ -4,7 +4,15 @@ SHELL=bash + + all: test + ++uid:=$(shell id -u) ++gid:=$(shell id -g) + test: fakekey ++ mkdir -p ~/.ssh ++ ../dropbearkey -t ecdsa -f ~/.ssh/id_dropbear ++ ../dropbearkey -y -f ~/.ssh/id_dropbear | grep ^ecdsa > ~/.ssh/authorized_keys ++ echo "$(LOGNAME)::$(uid):$(gid):$(USER):$(HOME):/bin/bash" >> ~/passwd ++ echo "$(LOGNAME)::$(gid):" >> ~/group ++ chmod 0700 ~ ~/.ssh ~/.ssh/authorized_keys ~/passwd ~/group + pytest --hostkey=fakekey --dbclient=../dbclient --dropbear=../dropbear $(srcdir) + + one: fakekey +--- a/test/test_dropbear.py ++++ b/test/test_dropbear.py +@@ -27,7 +27,11 @@ def dropbear(request): + ] + print("subprocess args: ", args) + +- p = subprocess.Popen(args, stderr=subprocess.PIPE, text=True) ++ env = os.environ ++ env['LD_PRELOAD'] = 'libnss_wrapper.so' ++ env['NSS_WRAPPER_PASSWD'] = env['HOME'] + '/passwd' ++ env['NSS_WRAPPER_GROUP'] = env['HOME'] + '/group' ++ p = subprocess.Popen(args, stderr=subprocess.PIPE, text=True, env=env) + # Wait until it has started listening + for l in p.stderr: + if "Not backgrounding" in l: |