diff --git a/source/shared_lib/include/feathery_ftp/ftpConfig.h b/source/shared_lib/include/feathery_ftp/ftpConfig.h index 89da0843..6c8f1fa6 100644 --- a/source/shared_lib/include/feathery_ftp/ftpConfig.h +++ b/source/shared_lib/include/feathery_ftp/ftpConfig.h @@ -25,22 +25,22 @@ /** * @brief max. possible simultaneous FTP client connections */ -#define MAX_CONNECTIONS 16 +#define MAX_CONNECTIONS 60 /** * @brief max. possible user accounts */ -#define MAX_USERS 16 +#define MAX_USERS 20 /** * @brief max. length of a user account name */ -#define MAXLEN_USERNAME 25 +#define MAXLEN_USERNAME 40 /** * @brief max. length of a user account password */ -#define MAXLEN_PASSWORD 25 +#define MAXLEN_PASSWORD 40 /** * @brief session timeout in seconds @@ -50,7 +50,7 @@ /** * @brief maximum length of a complete directory path */ -#define MAX_PATH_LEN 260 +#define MAX_PATH_LEN 1024 /** * @brief Size of the scratch buffer diff --git a/source/shared_lib/sources/feathery_ftp/ftpCmds.c b/source/shared_lib/sources/feathery_ftp/ftpCmds.c index 870d5d8a..c9e152a1 100755 --- a/source/shared_lib/sources/feathery_ftp/ftpCmds.c +++ b/source/shared_lib/sources/feathery_ftp/ftpCmds.c @@ -128,7 +128,7 @@ int ftpExecTransmission(int sessionId) break; rxLen += len; - }while(rxLen < LEN_SCRATCHBUF); + } while(rxLen < LEN_SCRATCHBUF); if(rxLen > 0) { @@ -159,7 +159,9 @@ int ftpExecTransmission(int sessionId) return 1; } else + { return 0; + } } LOCAL int ftpCmdUser(int sessionId, const char* args, int len) diff --git a/source/shared_lib/sources/feathery_ftp/ftpRuntime.c b/source/shared_lib/sources/feathery_ftp/ftpRuntime.c index 848f5636..46d516ff 100644 --- a/source/shared_lib/sources/feathery_ftp/ftpRuntime.c +++ b/source/shared_lib/sources/feathery_ftp/ftpRuntime.c @@ -171,6 +171,8 @@ int ftpExecute(void) clientSocket = ftpAcceptServerConnection(server, &remoteIP, &remotePort); if(clientSocket >= 0) { + if(VERBOSE_MODE_ENABLED) printf("ftpExecute ftpAcceptServerConnection = %d\n",clientSocket); + sessionId = ftpOpenSession(clientSocket, remoteIP, remotePort); if(sessionId >= 0) { @@ -195,6 +197,7 @@ if(VERBOSE_MODE_ENABLED) printf("ERROR: Connection refused; Session limit reache if(ftpTestSocket(ctrlSocket)) { + if(VERBOSE_MODE_ENABLED) printf("ftpExecute socket signalled = %d\n",ctrlSocket); int len; socksRdy--; len = ftpReceive(ctrlSocket, @@ -202,6 +205,8 @@ if(VERBOSE_MODE_ENABLED) printf("ERROR: Connection refused; Session limit reache LEN_RXBUF - pSession->rxBufWriteIdx); if(len <= 0) // has client shutdown the connection? { + if(VERBOSE_MODE_ENABLED) printf("ftpExecute ERROR ON RECEIVE for socket = %d\n",ctrlSocket); + ftpUntrackSocket(ctrlSocket); ftpCloseSession(n); } @@ -214,6 +219,8 @@ if(VERBOSE_MODE_ENABLED) printf("ERROR: Connection refused; Session limit reache /// @bug Session-Timeout-Management doesn't work if((ftpGetUnixTime() - pSession->timeLastCmd) > SESSION_TIMEOUT) { + if(VERBOSE_MODE_ENABLED) printf("ftpExecute ERROR: SESSION TIMED OUT for socket = %d\n",ctrlSocket); + ftpSendMsg(MSG_NORMAL, n, 421, ftpMsg036); ftpUntrackSocket(ctrlSocket); ftpCloseSession(n); diff --git a/source/shared_lib/sources/util/util.cpp b/source/shared_lib/sources/util/util.cpp index 928c6b3b..df79714f 100644 --- a/source/shared_lib/sources/util/util.cpp +++ b/source/shared_lib/sources/util/util.cpp @@ -166,7 +166,9 @@ std::string SystemFlags::getHTTP(std::string URL,CURL *handle,int timeOut) { CURL *SystemFlags::initHTTP() { if(SystemFlags::curl_global_init_called == false) { SystemFlags::curl_global_init_called = true; - curl_global_init(CURL_GLOBAL_ALL); + CURLcode result = curl_global_init(CURL_GLOBAL_ALL); + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d] curl_global_init called and returned: result %d [%s]\n",__FILE__,__FUNCTION__,__LINE__,result,curl_easy_strerror(result)); + //printf("In [%s::%s Line %d] curl_global_init called and returned: result %d [%s]\n",__FILE__,__FUNCTION__,__LINE__,result,curl_easy_strerror(result)); } CURL *handle = curl_easy_init(); curl_easy_setopt(handle, CURLOPT_NOSIGNAL, 1); @@ -236,6 +238,7 @@ void SystemFlags::cleanupHTTP(CURL **handle, bool globalCleanup) { if(SystemFlags::curl_global_init_called == true) { SystemFlags::curl_global_init_called = false; curl_global_cleanup(); + //printf("In [%s::%s Line %d] curl_global_cleanup called\n",__FILE__,__FUNCTION__,__LINE__); } } }