mirror of https://github.com/wolfSSL/wolfssh.git
commit
3b629091f7
|
@ -114,7 +114,7 @@ static int wsUserAuth(byte authType,
|
||||||
void* ctx)
|
void* ctx)
|
||||||
{
|
{
|
||||||
const char* defaultPassword = (const char*)ctx;
|
const char* defaultPassword = (const char*)ctx;
|
||||||
word32 passwordSz;
|
word32 passwordSz = 0;
|
||||||
int ret = WOLFSSH_USERAUTH_SUCCESS;
|
int ret = WOLFSSH_USERAUTH_SUCCESS;
|
||||||
|
|
||||||
(void)authType;
|
(void)authType;
|
||||||
|
@ -133,8 +133,8 @@ static int wsUserAuth(byte authType,
|
||||||
char* c = strpbrk((char*)userPassword, "\r\n");;
|
char* c = strpbrk((char*)userPassword, "\r\n");;
|
||||||
if (c != NULL)
|
if (c != NULL)
|
||||||
*c = '\0';
|
*c = '\0';
|
||||||
passwordSz = (word32)strlen((const char*)userPassword);
|
|
||||||
}
|
}
|
||||||
|
passwordSz = (word32)strlen((const char*)userPassword);
|
||||||
SetEcho(1);
|
SetEcho(1);
|
||||||
#ifdef USE_WINDOWS_API
|
#ifdef USE_WINDOWS_API
|
||||||
printf("\r\n");
|
printf("\r\n");
|
||||||
|
|
|
@ -1846,6 +1846,7 @@ static int DoKexInit(WOLFSSH* ssh, byte* buf, word32 len, word32* idx)
|
||||||
* is save the actual values.
|
* is save the actual values.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (ret == WS_SUCCESS) {
|
||||||
if (ssh->handshake == NULL) {
|
if (ssh->handshake == NULL) {
|
||||||
ssh->handshake = HandshakeInfoNew(ssh->ctx->heap);
|
ssh->handshake = HandshakeInfoNew(ssh->ctx->heap);
|
||||||
if (ssh->handshake == NULL) {
|
if (ssh->handshake == NULL) {
|
||||||
|
@ -1853,6 +1854,7 @@ static int DoKexInit(WOLFSSH* ssh, byte* buf, word32 len, word32* idx)
|
||||||
ret = WS_MEMORY_E;
|
ret = WS_MEMORY_E;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ret == WS_SUCCESS) {
|
if (ret == WS_SUCCESS) {
|
||||||
begin = *idx;
|
begin = *idx;
|
||||||
|
|
|
@ -865,7 +865,7 @@ int wolfSSH_SetChannelType(WOLFSSH* ssh, byte type, byte* name, word32 nameSz)
|
||||||
int wolfSSH_SetUsername(WOLFSSH* ssh, const char* username)
|
int wolfSSH_SetUsername(WOLFSSH* ssh, const char* username)
|
||||||
{
|
{
|
||||||
char* value = NULL;
|
char* value = NULL;
|
||||||
word32 valueSz;
|
word32 valueSz = 0;
|
||||||
int ret = WS_SUCCESS;
|
int ret = WS_SUCCESS;
|
||||||
|
|
||||||
if (ssh == NULL || ssh->handshake == NULL ||
|
if (ssh == NULL || ssh->handshake == NULL ||
|
||||||
|
|
|
@ -136,10 +136,10 @@ static int SFTP_ServerRecvInit(WOLFSSH* ssh) {
|
||||||
if (sz > 0) {
|
if (sz > 0) {
|
||||||
byte* data = (byte*)WMALLOC(sz, NULL, DYNTYPE_BUFFER);
|
byte* data = (byte*)WMALLOC(sz, NULL, DYNTYPE_BUFFER);
|
||||||
if (data == NULL) return WS_MEMORY_E;
|
if (data == NULL) return WS_MEMORY_E;
|
||||||
if ((len = wolfSSH_stream_read(ssh, data, sz)) != (int)sz) {
|
len = wolfSSH_stream_read(ssh, data, sz);
|
||||||
return len;
|
|
||||||
}
|
|
||||||
WFREE(data, NULL, DYNTYPE_BUFFER);
|
WFREE(data, NULL, DYNTYPE_BUFFER);
|
||||||
|
if (len != (int)sz)
|
||||||
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssh->reqId++;
|
ssh->reqId++;
|
||||||
|
@ -903,6 +903,7 @@ int wolfSSH_SFTP_RecvOpenDir(WOLFSSH* ssh, int reqId, word32 maxSz)
|
||||||
DYNTYPE_SFTP);
|
DYNTYPE_SFTP);
|
||||||
if (dirList == NULL) {
|
if (dirList == NULL) {
|
||||||
WFREE(dir, ssh->ctx->heap, DYNTYPE_BUFFER);
|
WFREE(dir, ssh->ctx->heap, DYNTYPE_BUFFER);
|
||||||
|
WCLOSEDIR(&ctx);
|
||||||
return WS_MEMORY_E;
|
return WS_MEMORY_E;
|
||||||
}
|
}
|
||||||
#ifdef WOLFSSL_NUCLEUS
|
#ifdef WOLFSSL_NUCLEUS
|
||||||
|
@ -922,6 +923,7 @@ int wolfSSH_SFTP_RecvOpenDir(WOLFSSH* ssh, int reqId, word32 maxSz)
|
||||||
ssh->ctx->heap, DYNTYPE_SFTP);
|
ssh->ctx->heap, DYNTYPE_SFTP);
|
||||||
if (cur == NULL) {
|
if (cur == NULL) {
|
||||||
WFREE(dir, ssh->ctx->heap, DYNTYPE_BUFFER);
|
WFREE(dir, ssh->ctx->heap, DYNTYPE_BUFFER);
|
||||||
|
WCLOSEDIR(&ctx);
|
||||||
return WS_MEMORY_E;
|
return WS_MEMORY_E;
|
||||||
}
|
}
|
||||||
#ifdef WOLFSSL_NUCLEUS
|
#ifdef WOLFSSL_NUCLEUS
|
||||||
|
|
|
@ -49,7 +49,7 @@ static int Base16_Decode(const byte* in, word32 inLen,
|
||||||
word32 outIdx = 0;
|
word32 outIdx = 0;
|
||||||
|
|
||||||
if (inLen == 1 && *outLen && in) {
|
if (inLen == 1 && *outLen && in) {
|
||||||
byte b = in[inIdx++] - 0x30; /* 0 starts at 0x30 */
|
byte b = in[inIdx] - 0x30; /* 0 starts at 0x30 */
|
||||||
|
|
||||||
/* sanity check */
|
/* sanity check */
|
||||||
if (b >= sizeof(hexDecode)/sizeof(hexDecode[0]))
|
if (b >= sizeof(hexDecode)/sizeof(hexDecode[0]))
|
||||||
|
|
|
@ -259,8 +259,8 @@ static int wsUserAuth(byte authType,
|
||||||
char* c = strpbrk((char*)userPassword, "\r\n");;
|
char* c = strpbrk((char*)userPassword, "\r\n");;
|
||||||
if (c != NULL)
|
if (c != NULL)
|
||||||
*c = '\0';
|
*c = '\0';
|
||||||
passwordSz = (word32)strlen((const char*)userPassword);
|
|
||||||
}
|
}
|
||||||
|
passwordSz = (word32)strlen((const char*)userPassword);
|
||||||
SetEcho(1);
|
SetEcho(1);
|
||||||
#ifdef USE_WINDOWS_API
|
#ifdef USE_WINDOWS_API
|
||||||
printf("\r\n");
|
printf("\r\n");
|
||||||
|
@ -308,6 +308,8 @@ int doCmds()
|
||||||
if (pt[0] != '/') {
|
if (pt[0] != '/') {
|
||||||
int maxSz = (int)WSTRLEN(workingDir) + sz + 2;
|
int maxSz = (int)WSTRLEN(workingDir) + sz + 2;
|
||||||
f = XMALLOC(maxSz, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
f = XMALLOC(maxSz, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
|
if (f == NULL)
|
||||||
|
return WS_MEMORY_E;
|
||||||
|
|
||||||
f[0] = '\0';
|
f[0] = '\0';
|
||||||
WSTRNCAT(f, workingDir, maxSz);
|
WSTRNCAT(f, workingDir, maxSz);
|
||||||
|
|
Loading…
Reference in New Issue