47
47
#include "src/misc.c"
48
48
#endif
49
49
50
+ #ifndef WOLFSSH_DEFAULT_EXTDATA_SZ
51
+ #define WOLFSSH_DEFAULT_EXTDATA_SZ 128
52
+ #endif
53
+
50
54
#ifndef NO_FILESYSTEM
51
55
static int ScpFileIsDir (ScpSendCtx * ctx );
52
56
static int ScpPushDir (ScpSendCtx * ctx , const char * path , void * heap );
@@ -56,6 +60,23 @@ static int ScpPopDir(ScpSendCtx* ctx, void* heap);
56
60
const char scpError [] = "scp error: %s, %d" ;
57
61
const char scpState [] = "scp state: %s" ;
58
62
63
+
64
+ static int _DumpExtendedData (WOLFSSH * ssh )
65
+ {
66
+ byte msg [WOLFSSH_DEFAULT_EXTDATA_SZ ];
67
+ int msgSz ;
68
+
69
+ msgSz = wolfSSH_extended_data_read (ssh , msg , WOLFSSH_DEFAULT_EXTDATA_SZ - 1 );
70
+ if (msgSz > 0 ) {
71
+ msg [WOLFSSH_DEFAULT_EXTDATA_SZ - 1 ] = 0 ;
72
+ fprintf (stderr , "%s" , msg );
73
+ msgSz = WS_SUCCESS ;
74
+ }
75
+
76
+ return msgSz ;
77
+ }
78
+
79
+
59
80
int DoScpSink (WOLFSSH * ssh )
60
81
{
61
82
int ret = WS_SUCCESS ;
@@ -584,6 +605,10 @@ int DoScpSource(WOLFSSH* ssh)
584
605
if (ret == WS_SUCCESS )
585
606
continue ;
586
607
}
608
+ if (ret == WS_EXTDATA ) {
609
+ _DumpExtendedData (ssh );
610
+ continue ;
611
+ }
587
612
if (ret < 0 ) {
588
613
WLOG (WS_LOG_ERROR , scpError , "failed to send file" , ret );
589
614
break ;
@@ -1470,7 +1495,10 @@ int ReceiveScpConfirmation(WOLFSSH* ssh)
1470
1495
msgSz = wolfSSH_stream_read (ssh , msg , DEFAULT_SCP_MSG_SZ );
1471
1496
1472
1497
if (msgSz < 0 ) {
1473
- ret = msgSz ;
1498
+ if (wolfSSH_get_error (ssh ) == WS_EXTDATA )
1499
+ _DumpExtendedData (ssh );
1500
+ else
1501
+ ret = msgSz ;
1474
1502
} else if (msgSz > 1 ) {
1475
1503
/* null terminate */
1476
1504
msg [msgSz ] = 0x00 ;
0 commit comments