Page 1 of 1

ftp_put: gsk_secure_soc_init: TLS handshake timed out.

Posted: Mon Sep 09, 2024 12:29 pm
by stefan@tageson.se
Hi Scott,
I'm upgrading an old rpg-program to rpg-free and meanwhile upgrades to version 2.6 of ftpapi.
Having the same issue as previously noted in the forum, where I'm stuck in ftptcp_upgrade.

My statements involved:
ftpconn = ftp_open( %trimr( i.ftpserver ): FTP_PORT: 15: FTPS_NONE ); ( FTPS_NONE specified )
if ftp_login( ftpconn: %trimr( i.ftpuser ): %trimr( i.ftppwd )) < 0;
if ftp_passiveMode( ftpconn: *on ) < 0;
if ftp_binaryMode( ftpconn: *off ) < 0;
if ftp_put( ftpconn: %trimr( tofp ): %trimr( tmpfile )) < 0;

In the ftp_put using debug I see in function put_block that wkTlsData = 300 = FTPS_PRIVATE.
That seems not correct to me.

Program: FTPAPIR4 Library: TCLIBP Module: FTPAPIR4
8743 8742 c endif
8744 8743 c endif
8745 8744
8746 8745 * if TLS is enabled the data conn should also be TLS
8747 8746 c if wkTlsData = FTPS_PRIVATE
8748 8747 c if ftptcp_upgrade( wwSock
8749 8748 c : FTPTCP_CLIENT_
8750 8749 c : wkAppId
8751 8750 c : wkKeyPath
8752 8751 c : wkKeyPass
8753 8752 c : wkKeyLabel) =
8754 8753 c return -1
8755 8754 c endif
8756 8755 c endif
8757 8756
WKTLSDATA = 300

After entering ftptcp_upgrade I'm hanging for a few minutes then returns with error: ftp_put: gsk_secure_soc_init: TLS handshake timed out.

call stack while hanging:

TCFTPSPLF TCLIB QILE 0000000000000013 TCFTPSPLF QTEMP J
Procedur: _QRNP_PEP_TCFTPSPLF
TCFTPSPLF TCLIB 13600 QILE 0000000000000013 TCFTPSPLF QTEMP N
Procedur: MAIN
TCFTPSPLF TCLIB 46400 QILE 0000000000000013 TCFTPSPLF QTEMP N
Procedur: DOFTP
FTPAPIR4 TCLIBP 7198 QILE 0000000000000013 FTPAPIR4 LIBFTP N
Procedur: FTP_PUT
FTPAPIR4 TCLIBP 7393 QILE 0000000000000013 FTPAPIR4 LIBFTP N
Procedur: FTP_PUTRAW
FTPAPIR4 TCLIBP 8747 QILE 0000000000000013 FTPAPIR4 LIBFTP N
Procedur: PUT_BLOCK
FTPAPIR4 TCLIBP 985 QILE 0000000000000013 FTPTCP LIBFTP N
Procedur: FTPTCP_UPGRADE
QSOSSLSR QSYS 1398 QILE 0000000000000013 QSOGSKSY QBUILDSS1 N
Procedur: gsk_secure_soc_init

How to resolv this?

Stefan

Re: ftp_put: gsk_secure_soc_init: TLS handshake timed out.

Posted: Mon Sep 09, 2024 2:22 pm
by stefan@tageson.se
Updating myself .........

ftpconn = ftp_open( %trimr( i.ftpserver ): FTP_PORT: 15: FTPS_NONE: 0: 0 );

Specifying parameter 5 and 6 as shown seems to mitigate the issue.
Eventually some confusion exists regarding parameter 3 peTLSMode and parameter 6 peTLSData in ftp_open?

all the best,

Stefan

Re: ftp_put: gsk_secure_soc_init: TLS handshake timed out.

Posted: Mon Sep 09, 2024 6:48 pm
by Scott Klement
It seems that I fixed this problem in January. But I must've made an error in uploading the fix, because it doesn't exist on the web site -- sorry about that.

Please try updating to the current release -- 2.8 is now available -- and let us know if that solves the problem.

https://www.scottklement.com/ftpapi/

Re: ftp_put: gsk_secure_soc_init: TLS handshake timed out.

Posted: Tue Sep 10, 2024 6:18 am
by stefan@tageson.se
Version 2.8 works as expected.
Big thanks for a fast and accurate reply and action.

All the best,
Stefan