Hello,
When trying this new version we have an issue with the ftp_put in combination with ftp_conn to start the ftp session.
For some reason the program tries to upgrade the connection to TLS after the ftp_put command.
below the ftp log
0: FTPAPI version 2.6 released on 2024-01-14
4: 220 Microsoft FTP Service
4: > USER **********
4: 331 Password required
4: > PASS **********
4: 230 User logged in.
4: > TYPE I
4: 200 Type set to I.
4: > EPSV
4: 229 Entering Extended Passive Mode (|||63079|)
4: > STOR BAT0036248T.BAT
4: 125 Data connection already open; Transfer starting.
4: > QUIT
Error message after ftp_put
gsk_secure_soc_init: TLS handshake timed out
FTPAPI version 2.6 released ftp_conn and ftp_put
-
- Site Admin
- Posts: 872
- Joined: Sun Jul 04, 2021 5:12 am
Re: FTPAPI version 2.6 released ftp_conn and ftp_put
Does this happen after you've previously made a TLS connection, where it might be accidentally preserving the settings from a previous session?
Or, how can I reproduce the problem?
Or, how can I reproduce the problem?
Re: FTPAPI version 2.6 released ftp_conn and ftp_put
Hello,
the issue occurs when connecting to all ftp servers.
I think the issue is caused by the defaults.
When you call ftp_conn wkTLSMode defaults to FTPS_NONE but wkTLSCtrl and wkTLSData default to FTPS_PRIVATE
wkTLSData forces the upgrade of the connection
(ftptcp_upgrade)
You cannot overrule the defaults when calling ftp_conn.
When using FTP_open you can overrule the defaults
ftp only works when overruling wkTLSCtrl and wkTLSData with 0
FTP_open(
v_remotesystem // host to connect to
: 21 // port number, -1 = default
: 120 // timeout
: FTPS_NONE // do not Use TLS
: 0 // control channel not TLS_PRIVATE and not TLS_CLEAR
: 0 // file transfers not TLS_PRIVATE and not TLS_CLEAR
);
When using FTP_open wht only 3 parameters the same issue as ftp_conn occurs.
FTP_open(
v_remotesystem // host to connect to
: 21 // port number, -1 = default
: 120 // timeout
: FTPS_NONE // do not Use TLS
);
the issue occurs when connecting to all ftp servers.
I think the issue is caused by the defaults.
When you call ftp_conn wkTLSMode defaults to FTPS_NONE but wkTLSCtrl and wkTLSData default to FTPS_PRIVATE
wkTLSData forces the upgrade of the connection
(ftptcp_upgrade)
You cannot overrule the defaults when calling ftp_conn.
When using FTP_open you can overrule the defaults
ftp only works when overruling wkTLSCtrl and wkTLSData with 0
FTP_open(
v_remotesystem // host to connect to
: 21 // port number, -1 = default
: 120 // timeout
: FTPS_NONE // do not Use TLS
: 0 // control channel not TLS_PRIVATE and not TLS_CLEAR
: 0 // file transfers not TLS_PRIVATE and not TLS_CLEAR
);
When using FTP_open wht only 3 parameters the same issue as ftp_conn occurs.
FTP_open(
v_remotesystem // host to connect to
: 21 // port number, -1 = default
: 120 // timeout
: FTPS_NONE // do not Use TLS
);
-
- Site Admin
- Posts: 872
- Joined: Sun Jul 04, 2021 5:12 am
Re: FTPAPI version 2.6 released ftp_conn and ftp_put
Yes, I'm aware of how FTP_open works. thanks.
The problem is, I'm trying to do it with FTP_conn because you said that it would try to upgrade to TLS. But it is not doing that when I try it When I look at the code, it looks like this:
You said that it wkTlsMode is defaulting to FTPS_NONE -- and the code says that when it is FTPS_NONE it won't try to upgrade the connection to use TLS. I'm running the code, and indeed, it is NOT trying to upgrade it to TLS. You are telling me that it is.
So I'm asking you how to reproduce the problem.
Funny thing is... the ONLY thing you've said about how to reproduce it is to use FTP_Conn -- but then when asked how to reproduce it, you send me a code sample of FTP_open and tell me that it DOESN'T reproduce the problem. Not helpful. I need to know how to reproduce it.
The other possibility is that we're looking at different versions of the code.
The problem is, I'm trying to do it with FTP_conn because you said that it would try to upgrade to TLS. But it is not doing that when I try it When I look at the code, it looks like this:
Code: Select all
* if TLS is enabled the data conn should also be TLS
c if wkTlsMode <> FTPS_NONE
c and wkTlsData = FTPS_PRIVATE
c if ftptcp_upgrade( wwSock
c : FTPTCP_CLIENT_SESSION
c : wkAppId
c : wkKeyPath
c : wkKeyPass
c : wkKeyLabel) = -1
c return -1
c endif
c endif
So I'm asking you how to reproduce the problem.
Funny thing is... the ONLY thing you've said about how to reproduce it is to use FTP_Conn -- but then when asked how to reproduce it, you send me a code sample of FTP_open and tell me that it DOESN'T reproduce the problem. Not helpful. I need to know how to reproduce it.
The other possibility is that we're looking at different versions of the code.
Re: FTPAPI version 2.6 released ftp_conn and ftp_put
Hello,
Sorry if our issue in not clear.
How to reproduce:
call ftp_conn to make the ftp connection to any ftp server
call ftp_put to store a file on the ftp server.
We have tried on 3 different ftp servers with the same result.
Ftp_conn makes the connection.
But when you call ftp_put the file is not stored on the ftp server.
When calling ftp_put eventually put_block is called.
There the connection is upgraded to TLS because of the default value in wkTlsData which is FTPS_PRIVATE
This causes the file not to be transfered to the ftp server.
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* put_block:
* Upload a file to a FTP server
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
P put_block B
D put_block PI 10I 0
D peSocket 10I 0 value
D peFiledes 10I 0 value
D peFunction * PROCPTR value
D read_data PR 10I 0 ExtProc(peFunction)
D filedes 10I 0 value
D data * value
D length 10U 0 value
D wwBuffer S 32766A
D wwRC S 10I 0
D wwSock S 10I 0
D wwBytes S 16P 0
D wwSession s 10I 0
* get data connection:
c if wkPassive = *On
c eval wwSock = peSocket
c else
c eval wwSock = ftptcp_accept( peSocket
c : *omit
c : *omit )
c callp ftptcp_close(peSocket)
c if wwSock < 0
c return -1
c endif
c endif
* if TLS is enabled the data conn should also be TLS
c if wkTlsData = FTPS_PRIVATE
c if ftptcp_upgrade( wwSock
c : FTPTCP_CLIENT_SESSION
c : wkAppId
c : wkKeyPath
c : wkKeyPass
c : wkKeyLabel) = -1
c return -1
c endif
c endif
Sorry if our issue in not clear.
How to reproduce:
call ftp_conn to make the ftp connection to any ftp server
call ftp_put to store a file on the ftp server.
We have tried on 3 different ftp servers with the same result.
Ftp_conn makes the connection.
But when you call ftp_put the file is not stored on the ftp server.
When calling ftp_put eventually put_block is called.
There the connection is upgraded to TLS because of the default value in wkTlsData which is FTPS_PRIVATE
This causes the file not to be transfered to the ftp server.
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* put_block:
* Upload a file to a FTP server
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
P put_block B
D put_block PI 10I 0
D peSocket 10I 0 value
D peFiledes 10I 0 value
D peFunction * PROCPTR value
D read_data PR 10I 0 ExtProc(peFunction)
D filedes 10I 0 value
D data * value
D length 10U 0 value
D wwBuffer S 32766A
D wwRC S 10I 0
D wwSock S 10I 0
D wwBytes S 16P 0
D wwSession s 10I 0
* get data connection:
c if wkPassive = *On
c eval wwSock = peSocket
c else
c eval wwSock = ftptcp_accept( peSocket
c : *omit
c : *omit )
c callp ftptcp_close(peSocket)
c if wwSock < 0
c return -1
c endif
c endif
* if TLS is enabled the data conn should also be TLS
c if wkTlsData = FTPS_PRIVATE
c if ftptcp_upgrade( wwSock
c : FTPTCP_CLIENT_SESSION
c : wkAppId
c : wkKeyPath
c : wkKeyPass
c : wkKeyLabel) = -1
c return -1
c endif
c endif
-
- Site Admin
- Posts: 872
- Joined: Sun Jul 04, 2021 5:12 am
Re: FTPAPI version 2.6 released ftp_conn and ftp_put
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/
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/