Skip to content

Commit 03f02d9

Browse files
authored
Merge pull request #156 from JacobBarthelmeh/release
prepare for release version 1.4.0
2 parents 4ce4b72 + ee3c0f1 commit 03f02d9

9 files changed

Lines changed: 114 additions & 6 deletions

File tree

ChangeLog.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1+
### wolfSSH v1.4.0 (04/30/2019)
2+
3+
- SFTP support for time attributes
4+
- TCP port forwarding feature added (--enable-fwd)
5+
- Example tcp port forwarding added to /examples/portfwd/portfwd
6+
- Fixes to SCP, including default direction set
7+
- Fix to match ID during KEX init
8+
- Add check for window adjustment packets when sending large transfers
9+
- Fixes and maintenance to Nucleus port for file closing
10+
- Add enable all option (--enable-all)
11+
- Fix for --disable-inline build
12+
- Fixes for GCC-7 warnings when falling through switch statements
13+
- Additional sanity checks added from fuzz testing
14+
- Refactor and fixes for use with non blocking
15+
- Add extended data read for piping stderr
16+
- Add client side pseudo terminal connection with ./examples/client/client -t
17+
- Add some basic Windows terminal conversions with wolfSSH_ConvertConsole
18+
- Add wolfSSH_stream_peek function to peek at incoming SSH data
19+
- Change name of internal function SendBuffered() to avoid clash with wolfSSL
20+
- Add support for SFTP on Windows
21+
- Use int types for arguments in examples to fix Raspberry Pi build
22+
- Fix for fail case with leading 0’s on MPINT
23+
- Default window size (DEFAULT_WINDOW_SZ) lowered from ~ 1 MB to ~ 16 KB
24+
- Disable examples option added to configure (--disable-examples)
25+
- Callback function and example use added for checking public key sent
26+
- AES CTR cipher support added
27+
- Fix for free’ing ECC caches with examples
28+
- Renamed example SFTP to be examples/sftpclient/wolfsftp
29+
30+
131
### wolfSSH v1.3.0 (08/15/2018)
232

333
- Accepted code submission from Stephen Casner for SCP support. Thanks Stephen!

configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# All right reserved.
44

55
AC_COPYRIGHT([Copyright (C) 2014-2019 wolfSSL Inc.])
6-
AC_INIT([wolfssh],[1.3.1],[support@wolfssl.com],[wolfssh],[https://www.wolfssl.com])
6+
AC_INIT([wolfssh],[1.4.0],[support@wolfssl.com],[wolfssh],[https://www.wolfssl.com])
77
AC_PREREQ([2.63])
88
AC_CONFIG_AUX_DIR([build-aux])
99

@@ -20,7 +20,7 @@ AC_ARG_PROGRAM
2020
AC_CONFIG_MACRO_DIR([m4])
2121
AC_CONFIG_HEADERS([src/config.h])
2222

23-
WOLFSSH_LIBRARY_VERSION=7:0:2
23+
WOLFSSH_LIBRARY_VERSION=8:0:3
2424
# | | |
2525
# +------+ | +---+
2626
# | | |

examples/echoserver/echoserver.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,10 +525,16 @@ static int LoadPasswordBuffer(byte* buf, word32 bufSz, PwMapList* list)
525525

526526
while (*str != 0) {
527527
delimiter = strchr(str, ':');
528+
if (delimiter == NULL) {
529+
return -1;
530+
}
528531
username = str;
529532
*delimiter = 0;
530533
password = delimiter + 1;
531534
str = strchr(password, '\n');
535+
if (str == NULL) {
536+
return -1;
537+
}
532538
*str = 0;
533539
str++;
534540
if (PwMapNew(list, WOLFSSH_USERAUTH_PASSWORD,
@@ -566,13 +572,22 @@ static int LoadPublicKeyBuffer(byte* buf, word32 bufSz, PwMapList* list)
566572
while (*str != 0) {
567573
/* Skip the public key type. This example will always be ssh-rsa. */
568574
delimiter = strchr(str, ' ');
575+
if (delimiter == NULL) {
576+
return -1;
577+
}
569578
str = delimiter + 1;
570579
delimiter = strchr(str, ' ');
580+
if (delimiter == NULL) {
581+
return -1;
582+
}
571583
publicKey64 = (byte*)str;
572584
*delimiter = 0;
573585
publicKey64Sz = (word32)(delimiter - str);
574586
str = delimiter + 1;
575587
delimiter = strchr(str, '\n');
588+
if (delimiter == NULL) {
589+
return -1;
590+
}
576591
username = (byte*)str;
577592
*delimiter = 0;
578593
usernameSz = (word32)(delimiter - str);

examples/server/server.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,10 +413,16 @@ static int LoadPasswordBuffer(byte* buf, word32 bufSz, PwMapList* list)
413413

414414
while (*str != 0) {
415415
delimiter = strchr(str, ':');
416+
if (delimiter == NULL) {
417+
return -1;
418+
}
416419
username = str;
417420
*delimiter = 0;
418421
password = delimiter + 1;
419422
str = strchr(password, '\n');
423+
if (str == NULL) {
424+
return -1;
425+
}
420426
*str = 0;
421427
str++;
422428
if (PwMapNew(list, WOLFSSH_USERAUTH_PASSWORD,
@@ -454,13 +460,22 @@ static int LoadPublicKeyBuffer(byte* buf, word32 bufSz, PwMapList* list)
454460
while (*str != 0) {
455461
/* Skip the public key type. This example will always be ssh-rsa. */
456462
delimiter = strchr(str, ' ');
463+
if (delimiter == NULL) {
464+
return -1;
465+
}
457466
str = delimiter + 1;
458467
delimiter = strchr(str, ' ');
468+
if (delimiter == NULL) {
469+
return -1;
470+
}
459471
publicKey64 = (byte*)str;
460472
*delimiter = 0;
461473
publicKey64Sz = (word32)(delimiter - str);
462474
str = delimiter + 1;
463475
delimiter = strchr(str, '\n');
476+
if (delimiter == NULL) {
477+
return -1;
478+
}
464479
username = (byte*)str;
465480
*delimiter = 0;
466481
usernameSz = (word32)(delimiter - str);

examples/sftpclient/sftpclient.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1127,7 +1127,7 @@ THREAD_RETURN WOLFSSH_THREAD sftpclient_test(void* args)
11271127
n = NULL;
11281128
}
11291129

1130-
ret = doCmds(args);
1130+
ret = doCmds((func_args*)args);
11311131
XFREE(workingDir, NULL, DYNAMIC_TYPE_TMP_BUFFER);
11321132
if (ret == WS_SUCCESS) {
11331133
if (wolfSSH_shutdown(ssh) != WS_SUCCESS) {

src/io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ void* wolfSSH_GetIOWriteCtx(WOLFSSH* ssh)
113113
/* lwIP needs to be configured to use sockets API in this mode */
114114
/* LWIP_SOCKET 1 in lwip/opt.h or in build */
115115
#include "lwip/sockets.h"
116-
#include <errno.h>
117116
#ifndef LWIP_PROVIDE_ERRNO
117+
#include <errno.h>
118118
#define LWIP_PROVIDE_ERRNO 1
119119
#endif
120120
#elif defined(FREESCALE_MQX)

src/wolfscp.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2178,6 +2178,11 @@ int wsScpSendCallback(WOLFSSH* ssh, int state, const char* peerRequest,
21782178
}
21792179

21802180
ret = FindNextDirEntry(sendCtx);
2181+
2182+
/* help out static analysis tool */
2183+
if (ret != WS_BAD_ARGUMENT && sendCtx == NULL)
2184+
ret = WS_BAD_ARGUMENT;
2185+
21812186
if (ret == WS_SUCCESS || ret == WS_NEXT_ERROR) {
21822187

21832188
#ifdef WOLFSSL_NUCLEUS

src/wolfsftp.c

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,7 @@ static int wolfSSH_SFTP_RecvRealPath(WOLFSSH* ssh, int reqId, byte* data,
940940
WFREE(out, ssh->ctx->heap, DYNTYPE_BUFFER);
941941
return WS_FATAL_ERROR;
942942
}
943+
/* take over control of buffer */
943944
wolfSSH_SFTP_RecvSetSend(ssh, out, outSz);
944945
return WS_BAD_FILE_E;
945946
}
@@ -1164,6 +1165,7 @@ int wolfSSH_SFTP_read(WOLFSSH* ssh)
11641165
"Unknown/Unsupported packet type", "English",
11651166
state->data, (word32*)&state->sz);
11661167
if (ret == WS_SUCCESS) {
1168+
/* set send out buffer, "state->data" is taken by ssh */
11671169
wolfSSH_SFTP_RecvSetSend(ssh, state->data, state->sz);
11681170
}
11691171
}
@@ -1371,6 +1373,8 @@ int wolfSSH_SFTP_RecvRMDIR(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
13711373
WFREE(out, ssh->ctx->heap, DYNTYPE_BUFFER);
13721374
return WS_FATAL_ERROR;
13731375
}
1376+
1377+
/* set send out buffer, "out" is taken by ssh */
13741378
wolfSSH_SFTP_RecvSetSend(ssh, out, outSz);
13751379
return ret;
13761380
}
@@ -1416,11 +1420,13 @@ int wolfSSH_SFTP_RecvMKDIR(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
14161420
dir[sz] = '\0';
14171421
idx += sz;
14181422
if (idx + UINT32_SZ > maxSz) {
1423+
WFREE(dir, ssh->ctx->heap, DYNTYPE_BUFFER);
14191424
return WS_BUFFER_E;
14201425
}
14211426

14221427
ato32(data + idx, &sz); idx += UINT32_SZ;
14231428
if (idx + sz > maxSz) {
1429+
WFREE(dir, ssh->ctx->heap, DYNTYPE_BUFFER);
14241430
return WS_BUFFER_E;
14251431
}
14261432
if (sz != UINT32_SZ) {
@@ -1463,6 +1469,8 @@ int wolfSSH_SFTP_RecvMKDIR(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
14631469
WFREE(out, ssh->ctx->heap, DYNTYPE_BUFFER);
14641470
return WS_FATAL_ERROR;
14651471
}
1472+
1473+
/* set send out buffer, "out" is taken by ssh */
14661474
wolfSSH_SFTP_RecvSetSend(ssh, out, outSz);
14671475
return ret;
14681476
}
@@ -1598,6 +1606,8 @@ int wolfSSH_SFTP_RecvOpen(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
15981606
return WS_FATAL_ERROR;
15991607
}
16001608
}
1609+
1610+
/* set send out buffer, "out" is taken by ssh */
16011611
wolfSSH_SFTP_RecvSetSend(ssh, out, outSz);
16021612

16031613
(void)ier;
@@ -1725,6 +1735,8 @@ int wolfSSH_SFTP_RecvOpen(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
17251735
return WS_FATAL_ERROR;
17261736
}
17271737
}
1738+
1739+
/* set send out buffer, "out" is taken by ssh */
17281740
wolfSSH_SFTP_RecvSetSend(ssh, out, outSz);
17291741

17301742
(void)ier;
@@ -1848,6 +1860,8 @@ int wolfSSH_SFTP_RecvOpenDir(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
18481860
return WS_FATAL_ERROR;
18491861
}
18501862
}
1863+
1864+
/* set send out buffer, "out" is taken by ssh */
18511865
wolfSSH_SFTP_RecvSetSend(ssh, out, outSz);
18521866

18531867
return ret;
@@ -1951,6 +1965,8 @@ int wolfSSH_SFTP_RecvOpenDir(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
19511965
return WS_FATAL_ERROR;
19521966
}
19531967
}
1968+
1969+
/* set send out buffer, "out" is taken by ssh */
19541970
wolfSSH_SFTP_RecvSetSend(ssh, out, outSz);
19551971

19561972
return ret;
@@ -2397,6 +2413,8 @@ int wolfSSH_SFTP_RecvReadDir(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
23972413
WFREE(out, ssh->ctx->heap, DYNTYPE_BUFFER);
23982414
return WS_FATAL_ERROR;
23992415
}
2416+
2417+
/* set send out buffer, "out" is taken by ssh */
24002418
wolfSSH_SFTP_RecvSetSend(ssh, out, outSz);
24012419
return WS_SUCCESS;
24022420
}
@@ -2415,6 +2433,8 @@ int wolfSSH_SFTP_RecvReadDir(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
24152433
return WS_FATAL_ERROR;
24162434
}
24172435
wolfSSH_SFTPNAME_list_free(list);
2436+
2437+
/* set send out buffer, "out" is taken by ssh */
24182438
wolfSSH_SFTP_RecvSetSend(ssh, out, outSz);
24192439
return WS_SUCCESS;
24202440
}
@@ -2562,6 +2582,8 @@ int wolfSSH_SFTP_RecvWrite(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
25622582
WFREE(out, ssh->ctx->heap, DYNTYPE_BUFFER);
25632583
return WS_FATAL_ERROR;
25642584
}
2585+
2586+
/* set send out buffer, "out" is taken by ssh */
25652587
wolfSSH_SFTP_RecvSetSend(ssh, out, outSz);
25662588
return ret;
25672589
}
@@ -2640,6 +2662,8 @@ int wolfSSH_SFTP_RecvWrite(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
26402662
WFREE(out, ssh->ctx->heap, DYNTYPE_BUFFER);
26412663
return WS_FATAL_ERROR;
26422664
}
2665+
2666+
/* set send out buffer, "out" is taken by ssh */
26432667
wolfSSH_SFTP_RecvSetSend(ssh, out, outSz);
26442668
return ret;
26452669
}
@@ -2718,6 +2742,7 @@ int wolfSSH_SFTP_RecvRead(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
27182742
if (res != NULL) {
27192743
if (wolfSSH_SFTP_CreateStatus(ssh, type, reqId, res, "English", NULL,
27202744
&outSz) != WS_SIZE_ONLY) {
2745+
WFREE(out, ssh->ctx->heap, DYNTYPE_BUFFER);
27212746
return WS_FATAL_ERROR;
27222747
}
27232748
if (outSz > sz) {
@@ -2738,6 +2763,7 @@ int wolfSSH_SFTP_RecvRead(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
27382763
SFTP_CreatePacket(ssh, WOLFSSH_FTP_DATA, out, outSz, NULL, 0);
27392764
}
27402765

2766+
/* set send out buffer, "out" is taken by ssh */
27412767
wolfSSH_SFTP_RecvSetSend(ssh, out, outSz);
27422768
return ret;
27432769
}
@@ -2844,6 +2870,7 @@ int wolfSSH_SFTP_RecvRead(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
28442870
SFTP_CreatePacket(ssh, WOLFSSH_FTP_DATA, out, outSz, NULL, 0);
28452871
}
28462872

2873+
/* set send out buffer, "out" is taken by ssh */
28472874
wolfSSH_SFTP_RecvSetSend(ssh, out, outSz);
28482875
return ret;
28492876
}
@@ -2932,6 +2959,8 @@ int wolfSSH_SFTP_RecvClose(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
29322959
WFREE(out, ssh->ctx->heap, DYNTYPE_BUFFER);
29332960
return WS_FATAL_ERROR;
29342961
}
2962+
2963+
/* set send out buffer, "out" is taken by ssh */
29352964
wolfSSH_SFTP_RecvSetSend(ssh, out, outSz);
29362965
return ret;
29372966
}
@@ -3012,6 +3041,8 @@ int wolfSSH_SFTP_RecvClose(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
30123041
WFREE(out, ssh->ctx->heap, DYNTYPE_BUFFER);
30133042
return WS_FATAL_ERROR;
30143043
}
3044+
3045+
/* set send out buffer, "out" is taken by ssh */
30153046
wolfSSH_SFTP_RecvSetSend(ssh, out, outSz);
30163047
return ret;
30173048
}
@@ -3100,6 +3131,8 @@ int wolfSSH_SFTP_RecvRemove(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
31003131
WFREE(out, ssh->ctx->heap, DYNTYPE_BUFFER);
31013132
return WS_FATAL_ERROR;
31023133
}
3134+
3135+
/* set send out buffer, "out" is taken by ssh */
31033136
wolfSSH_SFTP_RecvSetSend(ssh, out, outSz);
31043137
return ret;
31053138
}
@@ -3194,6 +3227,8 @@ int wolfSSH_SFTP_RecvRename(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
31943227
WFREE(out, ssh->ctx->heap, DYNTYPE_BUFFER);
31953228
return WS_FATAL_ERROR;
31963229
}
3230+
3231+
/* set send out buffer, "out" is taken by ssh */
31973232
wolfSSH_SFTP_RecvSetSend(ssh, out, outSz);
31983233
return ret;
31993234
}
@@ -3675,6 +3710,8 @@ int wolfSSH_SFTP_RecvFSTAT(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
36753710
return WS_FATAL_ERROR;
36763711
}
36773712
}
3713+
3714+
/* set send out buffer, "out" is taken by ssh */
36783715
wolfSSH_SFTP_RecvSetSend(ssh, out, outSz);
36793716
return ret;
36803717
}
@@ -3722,6 +3759,7 @@ int wolfSSH_SFTP_RecvSTAT(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
37223759
WLOG(WS_LOG_SFTP, "Unable to get stat of file/directory");
37233760
if (wolfSSH_SFTP_CreateStatus(ssh, WOLFSSH_FTP_FAILURE, reqId,
37243761
"STAT error", "English", NULL, &outSz) != WS_SIZE_ONLY) {
3762+
WFREE(name, ssh->ctx->heap, DYNTYPE_BUFFER);
37253763
return WS_FATAL_ERROR;
37263764
}
37273765
ret = WS_BAD_FILE_E;
@@ -3752,6 +3790,7 @@ int wolfSSH_SFTP_RecvSTAT(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
37523790
SFTP_SetAttributes(ssh, out + WOLFSSH_SFTP_HEADER, sz, &atr);
37533791
}
37543792

3793+
/* set send out buffer, "out" is taken by ssh */
37553794
wolfSSH_SFTP_RecvSetSend(ssh, out, outSz);
37563795
return ret;
37573796
}
@@ -3800,6 +3839,7 @@ int wolfSSH_SFTP_RecvLSTAT(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
38003839
WLOG(WS_LOG_SFTP, "Unable to get lstat of file/directory");
38013840
if (wolfSSH_SFTP_CreateStatus(ssh, WOLFSSH_FTP_FAILURE, reqId,
38023841
"LSTAT error", "English", NULL, &outSz) != WS_SIZE_ONLY) {
3842+
WFREE(name, ssh->ctx->heap, DYNTYPE_BUFFER);
38033843
return WS_FATAL_ERROR;
38043844
}
38053845
ret = WS_BAD_FILE_E;
@@ -3830,6 +3870,7 @@ int wolfSSH_SFTP_RecvLSTAT(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
38303870
SFTP_SetAttributes(ssh, out + WOLFSSH_SFTP_HEADER, sz, &atr);
38313871
}
38323872

3873+
/* set send out buffer, "out" is taken by ssh */
38333874
wolfSSH_SFTP_RecvSetSend(ssh, out, outSz);
38343875
return ret;
38353876
}
@@ -3960,6 +4001,8 @@ int wolfSSH_SFTP_RecvSetSTAT(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
39604001
WFREE(out, ssh->ctx->heap, DYNTYPE_BUFFER);
39614002
return WS_FATAL_ERROR;
39624003
}
4004+
4005+
/* set send out buffer, "out" is taken by ssh */
39634006
wolfSSH_SFTP_RecvSetSend(ssh, out, outSz);
39644007
return ret;
39654008
}

0 commit comments

Comments
 (0)