Bugzilla – Attachment 2923 Details for
Bug 2651
ssh prints bogus error message if config file has very long lines
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
regression test
test-longline.patch (text/plain), 2.88 KB, created by
don fong
on 2017-01-01 18:51:06 AEDT
(
hide
)
Description:
regression test
Filename:
MIME Type:
Creator:
don fong
Created:
2017-01-01 18:51:06 AEDT
Size:
2.88 KB
patch
obsolete
>From 86f3e37e5c6bfc1db7e574d6b0e0f89ee7057a26 Mon Sep 17 00:00:00 2001 >From: Don Fong <dfong@apigee.com> >Date: Sat, 31 Dec 2016 23:44:06 -0800 >Subject: [PATCH] add regression test for long config lines > >--- > regress/Makefile | 1 + > regress/cfg-longline.sh | 83 +++++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 84 insertions(+) > create mode 100755 regress/cfg-longline.sh > >diff --git a/regress/Makefile b/regress/Makefile >index c2dba4f..943fd40 100644 >--- a/regress/Makefile >+++ b/regress/Makefile >@@ -79,6 +79,7 @@ LTESTS= connect \ > principals-command \ > cert-file \ > cfginclude \ >+ cfg-longline \ > allow-deny-users > > >diff --git a/regress/cfg-longline.sh b/regress/cfg-longline.sh >new file mode 100755 >index 0000000..cae251a >--- /dev/null >+++ b/regress/cfg-longline.sh >@@ -0,0 +1,83 @@ >+# >+# regression test for the long config line problem. >+# the bug we are testing for is this: >+# >+# in the buggy versions of ssh, if the config file contained >+# a line longer than 1022 chars, any content beyond that was >+# treated as a separate line or lines. if the long line happened >+# to be a comment line, the remainder of the line would be treated >+# as normal input, resulting in nonsensical error messages. >+# >+# also, if the config file contained any other errors later on, >+# the reported line numbers would be incorrect. >+# >+ >+# remove temp files created for this test >+cleanup() >+{ >+ /bin/rm -f "$FAKE_CONFIG_FILE" >+} >+ >+# print a string s, filled out with blanks to the given length. >+lenline() >+{ >+ len="$1" s="$2" >+ printf "%-${len}.${len}s\n" "$s" >+} >+ >+# >+# create a config file with some long lines to trigger >+# the long line bug if it is present. >+# >+mkconfig() >+{ >+ n="$READCONF_MAX_LINE_LENGTH" >+ lenline "$n" "# 1. just at the limit, should be ok" >+ lenline `expr $n + 1` "# 2. over the limit should be an Error" >+ echo "# 3. ok" >+ echo "# 4. ok" >+ echo "# 5. ok" >+ echo "6. this line should cause an Error" >+} >+ >+# given the output, print on one line the line numbers of lines with errors. >+get_line_numbers() >+{ >+ elines=`echo "$*" | sed -n -e 's/.*line \([0-9]*\):.*/\1/p' | sort -u` >+ echo $elines >+} >+ >+main() >+{ >+ verbose "test $tid: $DESC" >+ >+ mkconfig > "$FAKE_CONFIG_FILE" || exit 1 >+ err=`ssh -F "$FAKE_CONFIG_FILE" -NnTx 127.0.0.1 date 2>&1` >+ xstat=$? >+ >+ cleanup >+ >+ # the command should have failed. >+ if [ "$xstat" -eq 0 ]; then >+ fail "expected failure did not happen" >+ fi >+ >+ # get the line numbers of the errors" >+ errlines=`get_line_numbers "$err"` >+ >+ # lines 2 and 6 only should have errors >+ expected="2 6" >+ >+ if [ x"$errlines" != x"$expected" ]; then >+ fail "errlines=$errlines; expected $expected" >+ fi >+} >+ >+# ----- start of mainline code >+DESC="test long config lines" >+tid="cfg-longline" >+ >+READCONF_MAX_LINE_LENGTH=1022 >+FAKE_CONFIG_FILE=/tmp/fake-ssh-config-$$.tmp >+ >+main >-- >2.7.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 2651
:
2918
|
2919
|
2922
| 2923 |
2958