Skip to content

Commit 9e68977

Browse files
test setting different wolfssl version for test
1 parent 8d1efe9 commit 9e68977

8 files changed

Lines changed: 110 additions & 32 deletions

File tree

.github/workflows/os-check.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,27 @@ concurrency:
1111
cancel-in-progress: true
1212

1313
jobs:
14+
create_matrix:
15+
runs-on: ubuntu-latest
16+
outputs:
17+
versions: ${{ steps.json.outputs.versions }}
18+
steps:
19+
- name: Create wolfSSL version matrix
20+
id: json
21+
run: |
22+
current=`curl -s https://api.github.com/repos/wolfssl/wolfssl/releases | grep tag_name | cut -d : -f 2,3 | tr -d \" | tr -d , | tr -d ' ' | head -1`
23+
last=`curl -s https://api.github.com/repos/wolfssl/wolfssl/releases | grep tag_name | cut -d : -f 2,3 | tr -d \" | tr -d , | tr -d ' ' | head -2 | tail -1`
24+
VERSIONS=$(echo "[ \"master\", \"$current\", \"$last\" ]")
25+
echo "wolfSSL versions found: $VERSIONS"
26+
echo "versions=$VERSIONS" >> $GITHUB_OUTPUT
27+
1428
build_wolfssl:
29+
needs: create_matrix
1530
strategy:
1631
fail-fast: false
1732
matrix:
1833
os: [ ubuntu-latest, macos-latest ]
19-
wolfssl: [ v5.7.2-stable, master ]
34+
wolfssl: ${{ fromJson(needs.create_matrix.outputs['versions']) }}
2035
name: Build wolfssl
2136
runs-on: ${{ matrix.os }}
2237
timeout-minutes: 4
@@ -29,6 +44,9 @@ jobs:
2944
key: wolfssh-os-check-wolfssl-${{ matrix.wolfssl }}-${{ matrix.os }}
3045
lookup-only: true
3146

47+
- name: debug
48+
run: echo wolfssl version ${{ matrix.wolfssl }}
49+
3250
- name: Checkout, build, and install wolfssl
3351
if: steps.cache-wolfssl.outputs.cache-hit != 'true'
3452
uses: wolfSSL/actions-build-autotools-project@v1
@@ -41,11 +59,14 @@ jobs:
4159
install: true
4260

4361
build_wolfssh:
62+
needs:
63+
- build_wolfssl
64+
- create_matrix
4465
strategy:
4566
fail-fast: false
4667
matrix:
4768
os: [ ubuntu-latest, macos-latest ]
48-
wolfssl: [ v5.7.2-stable, master ]
69+
wolfssl: ${{ fromJson(needs.create_matrix.outputs['versions']) }}
4970
config: [
5071
'',
5172
'--enable-all',
@@ -56,7 +77,6 @@ jobs:
5677
name: Build wolfssh
5778
runs-on: ${{ matrix.os }}
5879
timeout-minutes: 4
59-
needs: build_wolfssl
6080
steps:
6181
- name: Checking cache for wolfssl
6282
uses: actions/cache@v4

.github/workflows/sshd-test.yml

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,27 @@ concurrency:
1111
cancel-in-progress: true
1212

1313
jobs:
14+
create_matrix:
15+
runs-on: ubuntu-latest
16+
outputs:
17+
versions: ${{ steps.json.outputs.versions }}
18+
steps:
19+
- name: Create wolfSSL version matrix
20+
id: json
21+
run: |
22+
current=`curl -s https://api.github.com/repos/wolfssl/wolfssl/releases | grep tag_name | cut -d : -f 2,3 | tr -d \" | tr -d , | tr -d ' ' | head -1`
23+
last=`curl -s https://api.github.com/repos/wolfssl/wolfssl/releases | grep tag_name | cut -d : -f 2,3 | tr -d \" | tr -d , | tr -d ' ' | head -2 | tail -1`
24+
VERSIONS=$(echo "[ \"master\", \"$current\", \"$last\" ]")
25+
echo "wolfSSL versions found: $VERSIONS"
26+
echo "versions=$VERSIONS" >> $GITHUB_OUTPUT
27+
1428
build_wolfssl:
29+
needs: create_matrix
1530
strategy:
1631
fail-fast: false
1732
matrix:
1833
os: [ ubuntu-latest ]
19-
wolfssl: [ v5.7.2-stable ]
34+
wolfssl: ${{ fromJson(needs.create_matrix.outputs['versions']) }}
2035
name: Build wolfssl
2136
runs-on: ${{ matrix.os }}
2237
timeout-minutes: 4
@@ -41,15 +56,17 @@ jobs:
4156
install: true
4257

4358
build_wolfssh:
59+
needs:
60+
- build_wolfssl
61+
- create_matrix
4462
strategy:
4563
fail-fast: false
4664
matrix:
4765
os: [ ubuntu-latest ]
48-
wolfssl: [ v5.7.2-stable ]
66+
wolfssl: ${{ fromJson(needs.create_matrix.outputs['versions']) }}
4967
name: Build and test wolfsshd
5068
runs-on: ${{ matrix.os }}
5169
timeout-minutes: 10
52-
needs: build_wolfssl
5370
steps:
5471
- name: Checking cache for wolfssl
5572
uses: actions/cache@v4
@@ -58,14 +75,25 @@ jobs:
5875
key: wolfssh-sshd-wolfssl-${{ matrix.wolfssl }}-${{ matrix.os }}
5976
fail-on-cache-miss: true
6077

61-
- name: Checkout and build wolfsshd
62-
uses: wolfSSL/actions-build-autotools-project@v1
78+
- uses: actions/checkout@v4
6379
with:
64-
repository: wolfssl/wolfssh
65-
path: wolfssh
66-
configure: --enable-debug --enable-all LDFLAGS="-L${{ github.workspace }}/build-dir/lib" CPPFLAGS="-I${{ github.workspace }}/build-dir/include -DWOLFSSH_NO_FPKI -DWOLFSSH_NO_SFTP_TIMEOUT -DWOLFSSH_MAX_SFTP_RW=4000000"
67-
check: true
80+
path: wolfssh/
81+
82+
- name: autogen
83+
working-directory: ./wolfssh/
84+
run: ./autogen.sh
85+
86+
- name: configure
87+
working-directory: ./wolfssh/
88+
run : |
89+
./configure --enable-all LDFLAGS="-L${{ github.workspace }}/build-dir/lib" CPPFLAGS="-I${{ github.workspace }}/build-dir/include -DWOLFSSH_NO_FPKI -DWOLFSSH_NO_SFTP_TIMEOUT -DWOLFSSH_MAX_SFTP_RW=4000000 -DMAX_PATH_SZ=120"
90+
91+
- name: make check
92+
working-directory: ./wolfssh/
93+
run: make check
6894

6995
- name: Run wolfSSHd tests
70-
working-directory: wolfssh/apps/wolfsshd/test
71-
run: sudo ./run_all_sshd_tests.sh root
96+
working-directory: ./wolfssh/apps/wolfsshd/test
97+
run: |
98+
git log -3
99+
sudo ./run_all_sshd_tests.sh

apps/wolfsshd/test/sshd_forcedcmd_test.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ TEST_SFTP="./examples/sftpclient/wolfsftp"
3737
PRIVATE_KEY="./keys/hansel-key-ecc.der"
3838
PUBLIC_KEY="./keys/hansel-key-ecc.pub"
3939

40-
RESULT=`$TEST_CLIENT -c 'echo bob' -u $USER -i $PRIVATE_KEY -j $PUBLIC_KEY -h $TEST_HOST -p $TEST_PORT`
41-
cat $RESULT | grep bob
40+
RESULT=$( $TEST_CLIENT -c 'echo bob' -u $USER -i $PRIVATE_KEY -j $PUBLIC_KEY -h $TEST_HOST -p $TEST_PORT )
41+
echo $RESULT
42+
echo $RESULT | grep bob
4243
RESULT=$?
4344
if [ "$RESULT" == 0 ]; then
4445
echo "Shell login should fail with forced command"

apps/wolfsshd/test/sshd_term_size_test.sh

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,36 @@ if [ -z "$1" ] || [ -z "$2" ]; then
1515
exit 1
1616
fi
1717

18-
set -e
18+
# Check if tmux is available
19+
which tmux
20+
RESULT=$?
21+
if [ ${RESULT} = 1 ]; then
22+
echo "tmux is not installed!!"
23+
exit 1
24+
fi
25+
1926
echo "Creating tmux session at $PWD with command :"
20-
tmux new-session -d -s test "$TEST_CLIENT -t -u $USER -i $PRIVATE_KEY -j $PUBLIC_KEY -h \"$1\" -p \"$2\""
27+
echo "tmux new-session -d -s test \"$TEST_CLIENT -q -t -u $USER -i $PRIVATE_KEY -j $PUBLIC_KEY -h \"$1\" -p \"$2\"\""
28+
tmux new-session -d -s test "$TEST_CLIENT -q -t -u $USER -i $PRIVATE_KEY -j $PUBLIC_KEY -h \"$1\" -p \"$2\""
29+
echo "Result of tmux new-session = $?"
2130

2231
# give the command a second to establish SSH connection
23-
sleep 0.5
32+
sleep 1
2433

2534
COL=`tmux display -p -t test '#{pane_width}'`
2635
ROW=`tmux display -p -t test '#{pane_height}'`
36+
echo "tmux 'test' session has COL = ${COL} and ROW = ${ROW}"
2737

2838
# get the terminals columns and lines
2939
tmux send-keys -t test 'echo;echo $COLUMNS $LINES;echo'
3040
tmux send-keys -t test 'ENTER'
41+
42+
# give the command a second to run
43+
sleep 1
44+
3145
tmux capture-pane -t test
3246
RESULT=$(tmux show-buffer | grep '^[0-9]* [0-9]*$')
47+
tmux show-buffer
3348

3449
echo "$RESULT"
3550
echo ""
@@ -55,25 +70,32 @@ fi
5570
# close down the SSH session
5671
tmux send-keys -t test 'exit'
5772
tmux send-keys -t test 'ENTER'
58-
set +e
5973

6074
# kill off the session if it's still running, but don't error out if the session
6175
# has already closed down
6276
tmux kill-session -t test
6377
set -e
6478

65-
tmux new-session -d -x 50 -y 10 -s test "$TEST_CLIENT -t -u $USER -i $PRIVATE_KEY -j $PUBLIC_KEY -h \"$1\" -p \"$2\""
79+
echo "Starting another session with a smaller window size"
80+
echo "tmux new-session -d -x 50 -y 10 -s test \"$TEST_CLIENT -q -t -u $USER -i $PRIVATE_KEY -j $PUBLIC_KEY -h \"$1\" -p \"$2\"\""
81+
tmux new-session -d -x 50 -y 10 -s test "$TEST_CLIENT -q -t -u $USER -i $PRIVATE_KEY -j $PUBLIC_KEY -h \"$1\" -p \"$2\""
6682

6783
# give the command a second to establish SSH connection
68-
sleep 0.5
84+
sleep 1
6985

86+
echo "Sending keys to tmux session for displaying column/rows"
7087
tmux send-keys -t test 'echo;echo $COLUMNS $LINES;echo'
7188
tmux send-keys -t test 'ENTER'
7289
tmux capture-pane -t test
7390
RESULT=$(tmux show-buffer | grep '^[0-9]* [0-9]*$')
7491

75-
ROW_FOUND=$(echo "$RESULT" | sed -e 's/[0-9]* \([0-9]*\)/\1/')
76-
COL_FOUND=$(echo "$RESULT" | sed -e 's/\([0-9]*\) [0-9]*/\1/')
92+
ROW_FOUND=$( echo "$RESULT" | sed -e 's/[0-9]* \([0-9]*\)/\1/' )
93+
COL_FOUND=$( echo "$RESULT" | sed -e 's/\([0-9]*\) [0-9]*/\1/' )
94+
95+
#remove any newlines, tabs, or returns
96+
ROW_FOUND=$( tr -d '\n\t\r ' <<<"$ROW_FOUND" )
97+
COL_FOUND=$( tr -d '\n\t\r ' <<<"$COL_FOUND" )
98+
7799

78100
if [ "50" != "$COL_FOUND" ]; then
79101
echo "Col found was $COL_FOUND which does not match expected 50"

apps/wolfsshd/test/sshd_window_full_test.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ PUBLIC_KEY="./keys/hansel-key-ecc.pub"
4242
head -c 1G /dev/urandom > random-test.txt
4343

4444
PWD=`pwd`
45-
$TEST_CLIENT -c "cd $PWD; $TEST_CLIENT -c \"cat $PWD/random-test.txt\" -u $USER -i $PRIVATE_KEY -j $PUBLIC_KEY -h $TEST_HOST -p $TEST_PORT" -u $USER -i $PRIVATE_KEY -j $PUBLIC_KEY -h $TEST_HOST -p $TEST_PORT > random-test-result.txt
45+
echo "$TEST_CLIENT -q -c \"cd $PWD; $TEST_CLIENT -q -c \"cat $PWD/random-test.txt\" -u $USER -i $PRIVATE_KEY -j $PUBLIC_KEY -h $TEST_HOST -p $TEST_PORT\" -u $USER -i $PRIVATE_KEY -j $PUBLIC_KEY -h $TEST_HOST -p $TEST_PORT > random-test-result.txt"
46+
47+
$TEST_CLIENT -q -c "cd $PWD; $TEST_CLIENT -q -c \"cat $PWD/random-test.txt\" -u $USER -i $PRIVATE_KEY -j $PUBLIC_KEY -h $TEST_HOST -p $TEST_PORT" -u $USER -i $PRIVATE_KEY -j $PUBLIC_KEY -h $TEST_HOST -p $TEST_PORT > random-test-result.txt
48+
49+
ls -la random-test*
4650

4751
diff random-test.txt random-test-result.txt
4852
RESULT=$?

apps/wolfsshd/test/sshd_x509_test.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ PUBLIC_KEY="./keys/$3-cert.der"
1717
CA_CERT="./keys/ca-cert-ecc.der"
1818

1919
set -e
20-
echo "$TEST_CLIENT -c 'pwd' -u $3 -i $PRIVATE_KEY -J $PUBLIC_KEY -A $CA_CERT -h \"$1\" -p \"$2\""
21-
$TEST_CLIENT -c 'pwd' -u $3 -i "$PRIVATE_KEY" -J "$PUBLIC_KEY" -A "$CA_CERT" -h "$1" -p "$2"
20+
echo "$TEST_CLIENT -X -c 'pwd' -u $3 -i $PRIVATE_KEY -J $PUBLIC_KEY -A $CA_CERT -h \"$1\" -p \"$2\""
21+
$TEST_CLIENT -X -c 'pwd' -u $3 -i "$PRIVATE_KEY" -J "$PUBLIC_KEY" -A "$CA_CERT" -h "$1" -p "$2"
2222
set +e
2323

2424
rm -f error.txt
25-
echo "$TEST_CLIENT -c 'ls error' -u $3 -i $PRIVATE_KEY -J $PUBLIC_KEY -A $CA_CERT -h \"$1\" -p \"$2\" 2> error.txt"
26-
$TEST_CLIENT -c 'ls error' -u $3 -i "$PRIVATE_KEY" -J "$PUBLIC_KEY" -A "$CA_CERT" -h "$1" -p "$2" 2> error.txt
25+
echo "$TEST_CLIENT -X -c 'ls error' -u $3 -i $PRIVATE_KEY -J $PUBLIC_KEY -A $CA_CERT -h \"$1\" -p \"$2\" 2> error.txt"
26+
$TEST_CLIENT -X -c 'ls error' -u $3 -i "$PRIVATE_KEY" -J "$PUBLIC_KEY" -A "$CA_CERT" -h "$1" -p "$2" 2> error.txt
2727

2828
# check stderr output was caught
2929
if [ ! -s error.txt ]; then
@@ -36,4 +36,3 @@ rm -f error.txt
3636
cd $PWD
3737
exit 0
3838

39-

examples/client/client.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ static void ShowUsage(void)
120120
#endif
121121
printf(" -E List all possible algos\n");
122122
printf(" -k set the list of key algos to use\n");
123+
printf(" -q turn off debugging output\n");
123124
}
124125

125126

@@ -658,7 +659,7 @@ THREAD_RETURN WOLFSSH_THREAD client_test(void* args)
658659

659660
(void)keepOpen;
660661

661-
while ((ch = mygetopt(argc, argv, "?ac:h:i:j:p:tu:xzNP:RJ:A:XeEk:")) != -1) {
662+
while ((ch = mygetopt(argc, argv, "?ac:h:i:j:p:tu:xzNP:RJ:A:XeEk:q")) != -1) {
662663
switch (ch) {
663664
case 'h':
664665
host = myoptarg;
@@ -671,6 +672,10 @@ THREAD_RETURN WOLFSSH_THREAD client_test(void* args)
671672
#endif
672673
break;
673674

675+
case 'q':
676+
wolfSSH_Debugging_OFF();
677+
break;
678+
674679
case 'e':
675680
userEcc = 1;
676681
break;

src/internal.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14047,7 +14047,6 @@ int SendUserAuthRequest(WOLFSSH* ssh, byte authType, int addSig)
1404714047

1404814048
payloadSz = MSG_ID_SZ + (LENGTH_SZ * 3) +
1404914049
ssh->userNameSz + serviceNameSz + authNameSz;
14050-
1405114050
if (authId == ID_USERAUTH_PASSWORD)
1405214051
ret = PrepareUserAuthRequestPassword(ssh, &payloadSz, &authData);
1405314052
else if (authId == ID_USERAUTH_PUBLICKEY && !ssh->userAuthPkDone) {

0 commit comments

Comments
 (0)