• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

FFFTPのソースコードです。


Commit MetaInfo

Revision92bf5e4c5bcb132cf15dc2b7098a9eba8713eb64 (tree)
Zeit2011-09-12 00:58:55
Autors_kawamoto <s_kawamoto@user...>
Commiters_kawamoto

Log Message

Bug fix of support for FTP over Explicit SSL/TLS (OpenSSL is required).

Ändern Zusammenfassung

Diff

Binary files a/FFFTP.exe and b/FFFTP.exe differ
--- a/socketwrapper.c
+++ b/socketwrapper.c
@@ -86,7 +86,8 @@ BOOL LoadOpenSSL()
8686 || !(pSSL_read = (_SSL_read)GetProcAddress(g_hOpenSSL, "SSL_read"))
8787 || !(pSSL_get_error = (_SSL_get_error)GetProcAddress(g_hOpenSSL, "SSL_get_error")))
8888 {
89- FreeLibrary(g_hOpenSSL);
89+ if(g_hOpenSSL)
90+ FreeLibrary(g_hOpenSSL);
9091 g_hOpenSSL = NULL;
9192 return FALSE;
9293 }
@@ -155,6 +156,8 @@ SSL** FindSSLPointerFromSocket(SOCKET s)
155156
156157 void SetSSLTimeoutCallback(DWORD Timeout, LPSSLTIMEOUTCALLBACK pCallback)
157158 {
159+ if(!g_bOpenSSLLoaded)
160+ return;
158161 EnterCriticalSection(&g_OpenSSLLock);
159162 g_OpenSSLTimeout = Timeout;
160163 g_pOpenSSLTimeoutCallback = pCallback;
@@ -166,6 +169,8 @@ BOOL AttachSSL(SOCKET s)
166169 BOOL r;
167170 DWORD Time;
168171 SSL** ppSSL;
172+ if(!g_bOpenSSLLoaded)
173+ return FALSE;
169174 r = FALSE;
170175 Time = timeGetTime();
171176 EnterCriticalSection(&g_OpenSSLLock);
@@ -207,6 +212,8 @@ BOOL DetachSSL(SOCKET s)
207212 {
208213 BOOL r;
209214 SSL** ppSSL;
215+ if(!g_bOpenSSLLoaded)
216+ return FALSE;
210217 r = FALSE;
211218 EnterCriticalSection(&g_OpenSSLLock);
212219 if(ppSSL = FindSSLPointerFromSocket(s))
@@ -223,6 +230,8 @@ BOOL DetachSSL(SOCKET s)
223230 BOOL IsSSLAttached(SOCKET s)
224231 {
225232 SSL** ppSSL;
233+ if(!g_bOpenSSLLoaded)
234+ return FALSE;
226235 EnterCriticalSection(&g_OpenSSLLock);
227236 ppSSL = FindSSLPointerFromSocket(s);
228237 LeaveCriticalSection(&g_OpenSSLLock);
@@ -276,6 +285,8 @@ int closesocketS(SOCKET s)
276285 int sendS(SOCKET s, const char * buf, int len, int flags)
277286 {
278287 SSL** ppSSL;
288+ if(!g_bOpenSSLLoaded)
289+ return send(s, buf, len, flags);
279290 EnterCriticalSection(&g_OpenSSLLock);
280291 ppSSL = FindSSLPointerFromSocket(s);
281292 LeaveCriticalSection(&g_OpenSSLLock);
@@ -287,6 +298,8 @@ int sendS(SOCKET s, const char * buf, int len, int flags)
287298 int recvS(SOCKET s, char * buf, int len, int flags)
288299 {
289300 SSL** ppSSL;
301+ if(!g_bOpenSSLLoaded)
302+ return recv(s, buf, len, flags);
290303 EnterCriticalSection(&g_OpenSSLLock);
291304 ppSSL = FindSSLPointerFromSocket(s);
292305 LeaveCriticalSection(&g_OpenSSLLock);