[openssh-commits] [openssh] 04/08: upstream: Adapt to extra default verboisity from ssh-keygen when

git+noreply at mindrot.org git+noreply at mindrot.org
Mon Jun 4 14:54:56 AEST 2018


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

djm pushed a commit to branch master
in repository openssh.

commit a1dcafc41c376332493b9385ee39f9754dc145ec
Author: djm at openbsd.org <djm at openbsd.org>
Date:   Fri Jun 1 03:52:37 2018 +0000

    upstream: Adapt to extra default verboisity from ssh-keygen when
    
    searching for and hashing known_hosts entries in a single operation
    (ssh-keygen -HF ...) Patch from Anton Kremenetsky
    
    OpenBSD-Regress-ID: 519585a4de35c4611285bd6a7272766c229b19dd
---
 regress/keygen-knownhosts.sh | 37 ++++++++++++++++++++++++++++++-------
 1 file changed, 30 insertions(+), 7 deletions(-)

diff --git a/regress/keygen-knownhosts.sh b/regress/keygen-knownhosts.sh
index 693cd0e7..37af3476 100644
--- a/regress/keygen-knownhosts.sh
+++ b/regress/keygen-knownhosts.sh
@@ -1,4 +1,4 @@
-#	$OpenBSD: keygen-knownhosts.sh,v 1.3 2015/07/17 03:34:27 djm Exp $
+#	$OpenBSD: keygen-knownhosts.sh,v 1.4 2018/06/01 03:52:37 djm Exp $
 #	Placed in the Public Domain.
 
 tid="ssh-keygen known_hosts"
@@ -53,12 +53,23 @@ expect_key() {
 }
 
 check_find() {
+	_host=$1
+	_name=$2
+	shift; shift
+	${SSHKEYGEN} "$@" -f $OBJ/kh.invalid -F $_host > $OBJ/kh.result
+	if ! diff -w $OBJ/kh.expect $OBJ/kh.result ; then
+		fail "didn't find $_name"
+	fi
+}
+
+check_find_exit_code() {
 	_host=$1
 	_name=$2
 	_keygenopt=$3
-	${SSHKEYGEN} $_keygenopt -f $OBJ/kh.invalid -F $_host > $OBJ/kh.result
-	if ! diff -w $OBJ/kh.expect $OBJ/kh.result ; then
-		fail "didn't find $_name"
+	_exp_exit_code=$4
+	${SSHKEYGEN} $_keygenopt -f $OBJ/kh.invalid -F $_host > /dev/null
+	if [ "$?" != "$_exp_exit_code" ] ; then
+	    fail "Unexpected exit code $_name"
 	fi
 }
 
@@ -88,6 +99,18 @@ rm -f $OBJ/kh.expect
 expect_key host-h "host-f,host-g,host-h " host-f 17
 check_find host-h "find multiple hosts"
 
+# Check exit code, known host
+check_find_exit_code host-a "known host" "-q" "0"
+
+# Check exit code, unknown host
+check_find_exit_code host-aa "unknown host" "-q" "1"
+
+# Check exit code, the hash mode, known host
+check_find_exit_code host-a "known host" "-q -H" "0"
+
+# Check exit code, the hash mode, unknown host
+check_find_exit_code host-aa "unknown host" "-q -H" "1"
+
 check_hashed_find() {
 	_host=$1
 	_name=$2
@@ -110,19 +133,19 @@ check_hashed_find host-a "find simple and hash"
 rm -f $OBJ/kh.expect
 expect_key host-c host-c host-c "" CA
 # CA key output is not hashed.
-check_find host-c "find simple and hash" -H
+check_find host-c "find simple and hash" -Hq
 
 # Find revoked key and hash
 rm -f $OBJ/kh.expect
 expect_key host-d host-d host-d "" REVOKED
 # Revoked key output is not hashed.
-check_find host-d "find simple and hash" -H
+check_find host-d "find simple and hash" -Hq
 
 # find key with wildcard and hash
 rm -f $OBJ/kh.expect
 expect_key host-e "host-e*" host-e ""
 # Key with wildcard hostname should not be hashed.
-check_find host-e "find wildcard key" -H
+check_find host-e "find wildcard key" -Hq
 
 # find key among multiple hosts
 rm -f $OBJ/kh.expect

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


More information about the openssh-commits mailing list