mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-11-10 06:57:08 -08:00
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>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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:
|
||||
Reference in New Issue
Block a user