]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
Move the fgrep replacement to hostkey-rotate.sh.
authorDarren Tucker <dtucker@dtucker.net>
Fri, 24 Sep 2021 01:08:03 +0000 (11:08 +1000)
committerDarren Tucker <dtucker@dtucker.net>
Fri, 24 Sep 2021 01:08:03 +0000 (11:08 +1000)
The fgrep replacement for buggy greps doesn't work in the sftp-glob test
so move it to just where we know it's needed.

regress/hostkey-rotate.sh
regress/test-exec.sh

index 2852c457c259b221625dae8781811d50dfcf7a4d..0ae0c3dfcb44ffd40f75e998631e57016029f89b 100644 (file)
@@ -3,6 +3,25 @@
 
 tid="hostkey rotate"
 
+#
+# GNU (f)grep <=2.18, as shipped by FreeBSD<=12 and NetBSD<=9 will occasionally
+# fail to find ssh host keys in the hostkey-rotate test.  If we have those
+# versions, use awk instead.
+# See # https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258616
+#
+case `grep --version 2>&1 | awk '/GNU grep/{print $4}'` in
+2.19)                  fgrep=good ;;
+1.*|2.?|2.?.?|2.1?)    fgrep=bad ;;    # stock GNU grep
+2.5.1*)                        fgrep=bad ;;    # FreeBSD and NetBSD
+*)                     fgrep=good ;;
+esac
+if test "x$fgrep" = "xbad"; then
+       fgrep()
+{
+       awk 'BEGIN{e=1} {if (index($0,"'$1'")>0){e=0;print}} END{exit e}' $2
+}
+fi
+
 rm -f $OBJ/hkr.* $OBJ/ssh_proxy.orig $OBJ/ssh_proxy.orig
 
 grep -vi 'hostkey' $OBJ/sshd_proxy > $OBJ/sshd_proxy.orig
index 5fcc3fcfcca4448a2662350ceea31fbf0728d214..415422ef5573bcfd674722c1c2bdc9f886567ccf 100644 (file)
@@ -79,25 +79,6 @@ if test "x${EGREP}" != "x"; then
 }
 fi
 
-#
-# GNU (f)grep <=2.18, as shipped by FreeBSD<=12 and NetBSD<=9 will occasionally
-# fail to find ssh host keys in the hostkey-rotate test.  If we have those
-# versions, use awk instead.
-# See # https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258616
-#
-case `grep --version 2>&1 | awk '/GNU grep/{print $4}'` in
-2.19)                  fgrep=good ;;
-1.*|2.?|2.?.?|2.1?)    fgrep=bad ;;    # stock GNU grep
-2.5.1*)                        fgrep=bad ;;    # FreeBSD and NetBSD
-*)                     fgrep=good ;;
-esac
-if test "x$fgrep" = "xbad"; then
-       fgrep()
-{
-       awk 'BEGIN{e=1} {if (index($0,"'$1'")>0){e=0;print}} END{exit e}' $2
-}
-fi
-
 SRC=`dirname ${SCRIPT}`
 
 # defaults