[openssh-commits] [openssh] 03/04: upstream: Add a sshd debug wrapper

git+noreply at mindrot.org git+noreply at mindrot.org
Tue Oct 22 19:20:07 AEDT 2024


This is an automated email from the git hooks/post-receive script.

dtucker pushed a commit to branch master
in repository openssh.

commit 307ab3c7720f8879b835614b02687358ee4df9b9
Author: dtucker at openbsd.org <dtucker at openbsd.org>
AuthorDate: Tue Oct 22 06:16:26 2024 +0000

    upstream: Add a sshd debug wrapper
    
    ... to run all of the subprograms from the build directory while
    developing and debugging.  Should help prevent accidentally testing
    against unchanged installed sshd-auth and sshd-session binaries. ok djm@
    
    OpenBSD-Commit-ID: 61760cdc98c2bc8f1e9f83a6f97cca0f66b52e69
---
 sshd-debug.sh | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/sshd-debug.sh b/sshd-debug.sh
new file mode 100755
index 00000000..6e290bc6
--- /dev/null
+++ b/sshd-debug.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+# ssh-debug
+
+# A wrapper script around sshd to invoke when debugging to debug the
+#  work-in-progress versions of sshd-auth and sshd-session, instead
+# of debugging the installed ones that probably don't have the change
+# you are working on.
+#
+#	Placed in the Public Domain.
+
+unset DIR SSHD SSHD_AUTH SSHD_SESSION
+
+fatal() {
+	echo >&2 $@
+	exit 1
+}
+
+case "$0" in
+/*)			DIR="`dirname $0`"	;;
+./sshd-debug.sh)	DIR="`pwd`"		;;
+*)			echo "Need full path or working directory."; exit 1 ;;
+esac
+
+for i in sshd/obj/sshd sshd/sshd sshd; do
+	if [ -f "${DIR}/$i" ] && [ -x "${DIR}/$i" ]; then
+		SSHD="${DIR}/$i"
+	fi
+done
+[ -z "${SSHD}" ] && fatal "Could not find sshd"
+
+for i in sshd-auth/obj/sshd-auth sshd-auth/sshd-auth sshd-auth; do
+	if [ -f "${DIR}/$i" ] && [ -x "${DIR}/$i" ]; then
+		SSHD_AUTH="${DIR}/$i"
+	fi
+done
+[ -z "${SSHD_AUTH}" ] && fatal "Could not find sshd-auth"
+
+for i in sshd-session/obj/sshd-session sshd-session/sshd-session sshd-session; do
+	if [ -f "${DIR}/$i" ] && [ -x "${DIR}/$i" ]; then
+		SSHD_SESSION="${DIR}/$i"
+	fi
+done
+[ -z "${SSHD_SESSION}" ] && fatal "Could not find sshd-session"
+
+echo >&2 Debugging ${SSHD} auth ${SSHD_AUTH} session ${SSHD_SESSION}
+
+# Append SshdSessionPath and SshdAuthPath pointing to the build directory.
+# If you explicity specify these in the command line, the first-match
+# keyword semantics will override these.
+exec "${SSHD}" $@ \
+    -oSshdAuthPath="${SSHD_AUTH}" -oSshdSessionPath="${SSHD_SESSION}"

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list