summaryrefslogtreecommitdiff
path: root/net-misc/dropbear/files/dropbear-2024.84-fix-channels-tests.patch
diff options
context:
space:
mode:
Diffstat (limited to 'net-misc/dropbear/files/dropbear-2024.84-fix-channels-tests.patch')
-rw-r--r--net-misc/dropbear/files/dropbear-2024.84-fix-channels-tests.patch36
1 files changed, 36 insertions, 0 deletions
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: