mirror of https://github.com/wolfSSL/wolfssh.git
Merge pull request #329 from JacobBarthelmeh/testing
fixes for build with NO_WOLFSSH_CLIENT macro and --enable-allpull/334/head^2
commit
e90c033c45
|
@ -34,6 +34,8 @@
|
||||||
#include <wolfssh/test.h>
|
#include <wolfssh/test.h>
|
||||||
#include <wolfssh/port.h>
|
#include <wolfssh/port.h>
|
||||||
#include <wolfssl/wolfcrypt/ecc.h>
|
#include <wolfssl/wolfcrypt/ecc.h>
|
||||||
|
|
||||||
|
#ifndef NO_WOLFSSH_CLIENT
|
||||||
#include "examples/portfwd/wolfssh_portfwd.h"
|
#include "examples/portfwd/wolfssh_portfwd.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -482,3 +484,10 @@ char* myoptarg = NULL;
|
||||||
|
|
||||||
|
|
||||||
#endif /* NO_MAIN_DRIVER */
|
#endif /* NO_MAIN_DRIVER */
|
||||||
|
#else
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
printf("NO_WOLFSSH_CLIENT macro used, wolfSSH client not compiled in.\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif /* NO_WOLFSSH_CLIENT */
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include <wolfssh/test.h>
|
#include <wolfssh/test.h>
|
||||||
#include <wolfssh/port.h>
|
#include <wolfssh/port.h>
|
||||||
|
|
||||||
|
#ifndef NO_WOLFSSH_CLIENT
|
||||||
#if defined(HAVE_ECC) && defined(FP_ECC) && defined(HAVE_THREAD_LS)
|
#if defined(HAVE_ECC) && defined(FP_ECC) && defined(HAVE_THREAD_LS)
|
||||||
#include <wolfssl/wolfcrypt/ecc.h>
|
#include <wolfssl/wolfcrypt/ecc.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -396,3 +397,12 @@ int myoptind = 0;
|
||||||
char* myoptarg = NULL;
|
char* myoptarg = NULL;
|
||||||
|
|
||||||
#endif /* NO_MAIN_DRIVER */
|
#endif /* NO_MAIN_DRIVER */
|
||||||
|
#else
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
printf("wolfSSH built with NO_WOLFSSH_CLIENT\n");
|
||||||
|
printf("SCP client unavailable\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif /* NO_WOLFSSH_CLIENT */
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WOLFSSH_SFTP
|
#if defined(WOLFSSH_SFTP) && !defined(NO_WOLFSSH_CLIENT)
|
||||||
|
|
||||||
/* static so that signal handler can access and interrupt get/put */
|
/* static so that signal handler can access and interrupt get/put */
|
||||||
static WOLFSSH* ssh = NULL;
|
static WOLFSSH* ssh = NULL;
|
||||||
|
@ -1523,7 +1523,12 @@ THREAD_RETURN WOLFSSH_THREAD sftpclient_test(void* args)
|
||||||
|
|
||||||
THREAD_RETURN WOLFSSH_THREAD sftpclient_test(void* args)
|
THREAD_RETURN WOLFSSH_THREAD sftpclient_test(void* args)
|
||||||
{
|
{
|
||||||
printf("Not compiled in!\nPlease recompile with WOLFSSH_SFTP or --enable-sftp");
|
#ifdef NO_WOLFSSH_CLIENT
|
||||||
|
printf("NO_WOLFSSH_CLIENT macro was used. Can not have a client example\n");
|
||||||
|
#else
|
||||||
|
printf("Not compiled in!\n"
|
||||||
|
"Please recompile with WOLFSSH_SFTP or --enable-sftp\n");
|
||||||
|
#endif
|
||||||
(void)args;
|
(void)args;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1556,7 +1561,11 @@ THREAD_RETURN WOLFSSH_THREAD sftpclient_test(void* args)
|
||||||
|
|
||||||
wolfSSH_Cleanup();
|
wolfSSH_Cleanup();
|
||||||
|
|
||||||
return args.return_code;
|
#if defined(WOLFSSH_SFTP) && !defined(NO_WOLFSSH_CLIENT)
|
||||||
|
return args.return_code;
|
||||||
|
#else
|
||||||
|
return -1; /* return error when not compiled in */
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int myoptind = 0;
|
int myoptind = 0;
|
||||||
|
|
|
@ -6,6 +6,22 @@ then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# test SFTP client is working (that NO_WOLFSSH_CLIENT was not used)
|
||||||
|
./examples/sftpclient/wolfsftp -h
|
||||||
|
if [ $? -ne 0 ]
|
||||||
|
then
|
||||||
|
./examples/sftpclient/wolfsftp -h | grep NO_WOLFSSH_CLIENT
|
||||||
|
if [ $? -eq 0 ]
|
||||||
|
then
|
||||||
|
echo "macro NO_WOLFSSH_CLIENT was used"
|
||||||
|
echo "skipping test"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "wolfSFTP client not compiled in or not working"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if test ! -x ./examples/echoserver/echoserver
|
if test ! -x ./examples/echoserver/echoserver
|
||||||
then
|
then
|
||||||
echo "This test requires the wolfSSH echoserver."
|
echo "This test requires the wolfSSH echoserver."
|
||||||
|
|
|
@ -9,6 +9,15 @@ counter=0
|
||||||
|
|
||||||
[ ! -x ./examples/sftpclient/wolfsftp ] && echo -e "\n\nwolfSFTP client doesn't exist" && exit 1
|
[ ! -x ./examples/sftpclient/wolfsftp ] && echo -e "\n\nwolfSFTP client doesn't exist" && exit 1
|
||||||
|
|
||||||
|
# test for if the SFTP client works
|
||||||
|
./examples/sftpclient/wolfsftp -h | grep NO_WOLFSSH_CLIENT
|
||||||
|
if [ $? -eq 0 ]
|
||||||
|
then
|
||||||
|
echo "macro NO_WOLFSSH_CLIENT was used"
|
||||||
|
echo "skipping test"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
#echo "ready file $ready_file"
|
#echo "ready file $ready_file"
|
||||||
|
|
||||||
create_port() {
|
create_port() {
|
||||||
|
|
|
@ -246,7 +246,7 @@ static int ConvertHexToBin(const char* h1, byte** b1, word32* b1Sz,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WOLFSSH_SFTP
|
#if defined(WOLFSSH_SFTP) && !defined(NO_WOLFSSH_CLIENT)
|
||||||
byte userPassword[256];
|
byte userPassword[256];
|
||||||
static int sftpUserAuth(byte authType, WS_UserAuthData* authData, void* ctx)
|
static int sftpUserAuth(byte authType, WS_UserAuthData* authData, void* ctx)
|
||||||
{
|
{
|
||||||
|
@ -274,6 +274,7 @@ static int sftpUserAuth(byte authType, WS_UserAuthData* authData, void* ctx)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef NO_WOLFSSH_CLIENT
|
||||||
/* preforms connection to port, sets WOLFSSH_CTX and WOLFSSH on success
|
/* preforms connection to port, sets WOLFSSH_CTX and WOLFSSH on success
|
||||||
* caller needs to free ctx and ssh when done
|
* caller needs to free ctx and ssh when done
|
||||||
*/
|
*/
|
||||||
|
@ -331,6 +332,7 @@ static void sftp_client_connect(WOLFSSH_CTX** ctx, WOLFSSH** ssh, int port)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* NO_WOLFSSH_CLIENT */
|
||||||
#endif /* WOLFSSH_SFTP */
|
#endif /* WOLFSSH_SFTP */
|
||||||
|
|
||||||
|
|
||||||
|
@ -702,7 +704,7 @@ static void test_wolfSSH_SCP_CB(void)
|
||||||
|
|
||||||
static void test_wolfSSH_SFTP_SendReadPacket(void)
|
static void test_wolfSSH_SFTP_SendReadPacket(void)
|
||||||
{
|
{
|
||||||
#ifdef WOLFSSH_SFTP
|
#if defined(WOLFSSH_SFTP) && !defined(NO_WOLFSSH_CLIENT)
|
||||||
func_args ser;
|
func_args ser;
|
||||||
tcp_ready ready;
|
tcp_ready ready;
|
||||||
int argsCount;
|
int argsCount;
|
||||||
|
|
Loading…
Reference in New Issue