hi nochmal
ich nutze jetzt vorerst die dll für libcurl und habe dazu eine frage...
ich versuche mittels der lib eine ftps verbindung zu einem lokalen server aufzubaun dazu nutze ich diesen code:
Code: Alles auswählen
XIncludeFile "RW_LibCurl_Inc.pb"
Procedure debugerror(number.l)
error.l = curl_easy_strerror(number)
Debug PeekS(error)
EndProcedure
Global FileList.s
Procedure Curl_FTP_list(ftp_url.s,login.s, mdp.s,port.l, timeout.l = 1000)
url.s = "ftp://"+ftp_url
userNamePassword.s = login+":"+mdp
sslKeyType.s = "PEM"
sslKeyName.s = "C:\stunnel.pem"
sslCertificateName.s = "C:\stunnel.pem"
sslCertificateType.s = "PEM"
Debug "url: " +url
Debug "userpass: " + userNamePassword
Debug "port: " +Str(port)
curl_global_init(#CURL_GLOBAL_ALL)
curl = curl_easy_init()
If curl
ret.l = curl_easy_setopt(curl, #CURLOPT_PORT, port)
If ret <> #CURLE_OK
Debug "Port ":debugerror(ret)
EndIf
ret = curl_easy_setopt(curl, #CURLOPT_USERPWD, @userNamePassword)
If ret <> #CURLE_OK
Debug "USERPWD ":debugerror(ret)
EndIf
ret = curl_easy_setopt(curl, #CURLOPT_URL, @url)
If ret <> #CURLE_OK
Debug "URL ":debugerror(ret)
EndIf
;ret = curl_easy_setopt(curl, #CURLOPT_READDATA, @RW_LibCurl_GetData())
;ret = curl_easy_setopt(pCurl, CURLOPT_READFUNCTION, read_function)
ret = curl_easy_setopt(curl, #CURLOPT_USE_SSL, #CURLUSESSL_ALL)
If ret <> #CURLE_OK
Debug "USE_SSL ":debugerror(ret)
EndIf
ret = curl_easy_setopt(curl, #CURLOPT_FTPSSLAUTH, #CURLFTPAUTH_SSL)
If ret <> #CURLE_OK
Debug "FTP_AUTH_SSL ": debugerror(ret)
EndIf
ret = curl_easy_setopt(curl, #CURLOPT_FTP_SSL_CCC, #CURLFTPSSL_CCC_NONE)
If ret <> #CURLE_OK
Debug "SSL_CCC ":debugerror(ret)
EndIf
ret = curl_easy_setopt(curl, #CURLOPT_SSLCERT, @sslCertificateName)
If ret <> #CURLE_OK
Debug "SSLCERT, ":debugerror(ret)
EndIf
ret = curl_easy_setopt(curl, #CURLOPT_SSLCERTTYPE, @sslCertificateType)
If ret <> #CURLE_OK
Debug "SSLCERTTYPE, ":debugerror(ret)
EndIf
ret = curl_easy_setopt(curl, #CURLOPT_SSLKEY, @sslKeyName)
If ret <> #CURLE_OK
Debug "SSLKEY ":debugerror(ret)
EndIf
ret = curl_easy_setopt(curl, #CURLOPT_SSLKEYTYPE, @sslKeyType)
If ret <> #CURLE_OK
Debug "SSLKEYTYPE ":debugerror(ret)
EndIf
ret = curl_easy_setopt(curl, #CURLOPT_SSLENGINE_DEFAULT, @sslKeyType)
If ret <> #CURLE_OK
Debug "SSLENGINE ":debugerror(ret)
EndIf
ret = curl_easy_setopt(curl, #CURLOPT_SSLVERSION, #CURL_SSLVERSION_SSLv3)
If ret <> #CURLE_OK
Debug "SSL VERSION ":debugerror(ret)
EndIf
ret = curl_easy_setopt(curl, #CURLOPT_SSL_VERIFYPEER, #False)
If ret <> #CURLE_OK
Debug "SSL_VERIFYERPEER ": debugerror(ret)
EndIf
ret = curl_easy_setopt(curl, #CURLOPT_SSL_VERIFYHOST, #False)
If ret <> #CURLE_OK
Debug "SSL VERIFYHOST ":debugerror(ret)
EndIf
ret = curl_easy_setopt(curl, #CURLOPT_CONNECTTIMEOUT, timeout.l)
If ret <> #CURLE_OK
Debug "con timeout ": debugerror(ret)
EndIf
ret = curl_easy_setopt(curl, #CURLOPT_TIMEOUT, timeout.l)
If ret <> #CURLE_OK
Debug "Timeout ": debugerror(ret)
EndIf
ret = curl_easy_setopt(curl, #CURLOPT_FTPLISTONLY, #True)
If ret <> #CURLE_OK
Debug "list only": debugerror(ret)
EndIf
ret = curl_easy_setopt(curl, #CURLOPT_WRITEFUNCTION, @RW_LibCurl_WriteFunction())
If ret <> #CURLE_OK
Debug "write func ": debugerror(ret)
EndIf
ret = curl_easy_setopt(curl, #CURLOPT_KEYPASSWD, @"")
If ret <> #CURLE_OK
Debug "KEYPASSWD ": debugerror(ret)
EndIf
ret = curl_easy_setopt(curl, #CURLOPT_FTPPORT,@"192.168.1.101")
If ret <> #CURLE_OK
Debug "PASSIV ": debugerror(ret)
EndIf
res = curl_easy_perform(curl)
If res <> #CURLE_OK
Debug "perform ": debugerror(res)
EndIf
curl_easy_cleanup(curl)
If res <> #False
ProcedureReturn #False;
Else
FileList = ReplaceString(RW_LibCurl_GetData(), Chr(13)+Chr(10),"-")
ProcedureReturn #True
EndIf
Else
ProcedureReturn #False
EndIf
EndProcedure
ret.l = Curl_FTP_list("192.168.1.101", "test","test",1021);
If ret = #False
Debug "error"
Else
For i = 1 To CountString(FileList, "-")
If GetExtensionPart(StringField(FileList, i, "-")) =""
Debug "["+StringField(FileList, i, "-")+"]"
Else
Debug StringField(FileList, i, "-")
EndIf
Next
EndIf
die verbindung wird hergestellt doch leider sagt mir der server jedes mal
folgendes:
- new connection from 192.168.1.101 on 192.168.1.101:1021 (Explicit SSL)
sending welcome message.
AUTH SSL
234 AUTH command ok; starting SSL connection.
establishing encrypted session
USER test
test, 331 Password required for test.
test, PASS ****
test, login failed.
test, 530 Login or Password incorrect.
test, disconnected. (00d00:00:03)
ein falsches password bzw username kann ich absolut auschließen ://
hat evtl jemand eine idee was ich falsch mache ?