-# $OpenBSD: cfginclude.sh,v 1.3 2021/06/08 06:52:43 djm Exp $
+# $OpenBSD: cfginclude.sh,v 1.4 2024/09/03 05:58:56 djm Exp $
# Placed in the Public Domain.
tid="config include"
# cleanup
rm -f $OBJ/ssh_config.i $OBJ/ssh_config.i.* $OBJ/ssh_config.out
-# $OpenBSD: cfginclude.sh,v 1.3 2021/06/08 06:52:43 djm Exp $
+# $OpenBSD: cfginclude.sh,v 1.4 2024/09/03 05:58:56 djm Exp $
# Placed in the Public Domain.
tid="config include"
${REAL_SSH} -F $OBJ/ssh_config.i -G a 2>/dev/null && \
fail "ssh include allowed infinite recursion?" # or hang...
+# Environment variable expansion
+cat > $OBJ/ssh_config.i << _EOF
+Include $OBJ/ssh_config.\${REAL_FILE}
+_EOF
+cat > $OBJ/ssh_config.i.x << _EOF
+Hostname xyzzy
+_EOF
+REAL_FILE=i.x
+export REAL_FILE
+trial a xyzzy
+
+# Environment variable expansion
+cat > $OBJ/ssh_config.i << _EOF
+Include $OBJ/ssh_config.i.%h%h
+_EOF
+cat > $OBJ/ssh_config.i.blahblah << _EOF
+Hostname mekmitastdigoat
+_EOF
+REAL_FILE=i.x
+export REAL_FILE
+trial blah mekmitastdigoat
+
# cleanup
rm -f $OBJ/ssh_config.i $OBJ/ssh_config.i.* $OBJ/ssh_config.out