mirror of
https://github.com/kingk85/uFTP.git
synced 2025-07-25 13:16:12 +03:00
Added debug options in makefile
This commit is contained in:
@ -3,6 +3,9 @@ CC=gcc
|
|||||||
|
|
||||||
OUTPATH=./build/
|
OUTPATH=./build/
|
||||||
SOURCE_MODULES_PATH=./library/
|
SOURCE_MODULES_PATH=./library/
|
||||||
|
|
||||||
|
#FOR DEBUG PURPOSE
|
||||||
|
#CFLAGS=-c -Wall -I. -g -O0
|
||||||
CFLAGS=-c -Wall -I.
|
CFLAGS=-c -Wall -I.
|
||||||
OPTIMIZATION=-O3
|
OPTIMIZATION=-O3
|
||||||
HEADERS=-I
|
HEADERS=-I
|
||||||
@ -61,4 +64,4 @@ ftpServer.o:
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
@rm -rf $(LIBPATH)*.o $(OUTPATH)uFTP
|
@rm -rf $(LIBPATH)*.o $(OUTPATH)uFTP
|
||||||
@echo "Clean ok"
|
@echo "Clean ok"
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
build/uFTP
BIN
build/uFTP
Binary file not shown.
BIN
dist/Debug/GNU-Linux/uftp
vendored
BIN
dist/Debug/GNU-Linux/uftp
vendored
Binary file not shown.
@ -142,7 +142,7 @@ int parseCommandPass(ftpDataType * data, int socketId)
|
|||||||
{
|
{
|
||||||
if (((loginFailsDataType *) data->loginFailsVector.Data[searchPosition])->failureNumbers >= data->ftpParameters.maximumUserAndPassowrdLoginTries)
|
if (((loginFailsDataType *) data->loginFailsVector.Data[searchPosition])->failureNumbers >= data->ftpParameters.maximumUserAndPassowrdLoginTries)
|
||||||
{
|
{
|
||||||
//printf("\n TOO MANY LOGIN FAILS! \n");
|
printf("\n TOO MANY LOGIN FAILS! \n");
|
||||||
data->clients[socketId].closeTheClient = 1;
|
data->clients[socketId].closeTheClient = 1;
|
||||||
returnCode = dprintf(data->clients[socketId].socketDescriptor, "430 Too many login failure detected, your ip will be blacklisted for 5 minutes\r\n");
|
returnCode = dprintf(data->clients[socketId].socketDescriptor, "430 Too many login failure detected, your ip will be blacklisted for 5 minutes\r\n");
|
||||||
if (returnCode <= 0) return FTP_COMMAND_PROCESSED_WRITE_ERROR;
|
if (returnCode <= 0) return FTP_COMMAND_PROCESSED_WRITE_ERROR;
|
||||||
@ -220,6 +220,9 @@ int parseCommandAuth(clientDataType *theClientData)
|
|||||||
returnCode = dprintf(theClientData->socketDescriptor, "502 Security extensions not implemented.\r\n");
|
returnCode = dprintf(theClientData->socketDescriptor, "502 Security extensions not implemented.\r\n");
|
||||||
if (returnCode <= 0)
|
if (returnCode <= 0)
|
||||||
return FTP_COMMAND_PROCESSED_WRITE_ERROR;
|
return FTP_COMMAND_PROCESSED_WRITE_ERROR;
|
||||||
|
|
||||||
|
//client -> AUTH TLS
|
||||||
|
//server -> 234 AUTH TLS OK.
|
||||||
|
|
||||||
return FTP_COMMAND_PROCESSED;
|
return FTP_COMMAND_PROCESSED;
|
||||||
}
|
}
|
||||||
@ -823,6 +826,7 @@ int parseCommandQuit(ftpDataType * data, int socketId)
|
|||||||
return FTP_COMMAND_PROCESSED_WRITE_ERROR;
|
return FTP_COMMAND_PROCESSED_WRITE_ERROR;
|
||||||
|
|
||||||
data->clients[socketId].closeTheClient = 1;
|
data->clients[socketId].closeTheClient = 1;
|
||||||
|
printf("\n Closing the client quit received");
|
||||||
return FTP_COMMAND_PROCESSED;
|
return FTP_COMMAND_PROCESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
21
ftpServer.c
21
ftpServer.c
@ -90,6 +90,7 @@ void *connectionWorkerHandle(void * socketId)
|
|||||||
if (ftpData.clients[theSocketId].workerData.passiveListeningSocket == -1)
|
if (ftpData.clients[theSocketId].workerData.passiveListeningSocket == -1)
|
||||||
{
|
{
|
||||||
ftpData.clients[theSocketId].closeTheClient = 1;
|
ftpData.clients[theSocketId].closeTheClient = 1;
|
||||||
|
printf("\n Closing the client 1");
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,6 +101,7 @@ void *connectionWorkerHandle(void * socketId)
|
|||||||
if (returnCode <= 0)
|
if (returnCode <= 0)
|
||||||
{
|
{
|
||||||
ftpData.clients[theSocketId].closeTheClient = 1;
|
ftpData.clients[theSocketId].closeTheClient = 1;
|
||||||
|
printf("\n Closing the client 2");
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,6 +113,7 @@ void *connectionWorkerHandle(void * socketId)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ftpData.clients[theSocketId].closeTheClient = 1;
|
ftpData.clients[theSocketId].closeTheClient = 1;
|
||||||
|
printf("\n Closing the client 3");
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -122,6 +125,7 @@ void *connectionWorkerHandle(void * socketId)
|
|||||||
if (ftpData.clients[theSocketId].workerData.socketConnection < 0)
|
if (ftpData.clients[theSocketId].workerData.socketConnection < 0)
|
||||||
{
|
{
|
||||||
ftpData.clients[theSocketId].closeTheClient = 1;
|
ftpData.clients[theSocketId].closeTheClient = 1;
|
||||||
|
printf("\n Closing the client 4");
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,6 +134,7 @@ void *connectionWorkerHandle(void * socketId)
|
|||||||
if (returnCode <= 0)
|
if (returnCode <= 0)
|
||||||
{
|
{
|
||||||
ftpData.clients[theSocketId].closeTheClient = 1;
|
ftpData.clients[theSocketId].closeTheClient = 1;
|
||||||
|
printf("\n Closing the client 5");
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,6 +177,7 @@ void *connectionWorkerHandle(void * socketId)
|
|||||||
if (returnCode <= 0)
|
if (returnCode <= 0)
|
||||||
{
|
{
|
||||||
ftpData.clients[theSocketId].closeTheClient = 1;
|
ftpData.clients[theSocketId].closeTheClient = 1;
|
||||||
|
printf("\n Closing the client 6");
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,6 +189,7 @@ void *connectionWorkerHandle(void * socketId)
|
|||||||
if (returnCode <= 0)
|
if (returnCode <= 0)
|
||||||
{
|
{
|
||||||
ftpData.clients[theSocketId].closeTheClient = 1;
|
ftpData.clients[theSocketId].closeTheClient = 1;
|
||||||
|
printf("\n Closing the client 7");
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,6 +224,7 @@ void *connectionWorkerHandle(void * socketId)
|
|||||||
if (returnCode <= 0)
|
if (returnCode <= 0)
|
||||||
{
|
{
|
||||||
ftpData.clients[theSocketId].closeTheClient = 1;
|
ftpData.clients[theSocketId].closeTheClient = 1;
|
||||||
|
printf("\n Closing the client 8");
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,6 +246,7 @@ void *connectionWorkerHandle(void * socketId)
|
|||||||
if (returnCode <= 0)
|
if (returnCode <= 0)
|
||||||
{
|
{
|
||||||
ftpData.clients[theSocketId].closeTheClient = 1;
|
ftpData.clients[theSocketId].closeTheClient = 1;
|
||||||
|
printf("\n Closing the client 8");
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,6 +254,7 @@ void *connectionWorkerHandle(void * socketId)
|
|||||||
if (returnCode <= 0)
|
if (returnCode <= 0)
|
||||||
{
|
{
|
||||||
ftpData.clients[theSocketId].closeTheClient = 1;
|
ftpData.clients[theSocketId].closeTheClient = 1;
|
||||||
|
printf("\n Closing the client 9");
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,6 +262,7 @@ void *connectionWorkerHandle(void * socketId)
|
|||||||
if (returnCode <= 0)
|
if (returnCode <= 0)
|
||||||
{
|
{
|
||||||
ftpData.clients[theSocketId].closeTheClient = 1;
|
ftpData.clients[theSocketId].closeTheClient = 1;
|
||||||
|
printf("\n Closing the client 10");
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,6 +277,7 @@ void *connectionWorkerHandle(void * socketId)
|
|||||||
if (writeReturn <= 0)
|
if (writeReturn <= 0)
|
||||||
{
|
{
|
||||||
ftpData.clients[theSocketId].closeTheClient = 1;
|
ftpData.clients[theSocketId].closeTheClient = 1;
|
||||||
|
printf("\n Closing the client 11");
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,6 +292,7 @@ void *connectionWorkerHandle(void * socketId)
|
|||||||
if (writeReturn <= 0)
|
if (writeReturn <= 0)
|
||||||
{
|
{
|
||||||
ftpData.clients[theSocketId].closeTheClient = 1;
|
ftpData.clients[theSocketId].closeTheClient = 1;
|
||||||
|
printf("\n Closing the client 12");
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -290,6 +303,7 @@ void *connectionWorkerHandle(void * socketId)
|
|||||||
if (writeReturn <= 0)
|
if (writeReturn <= 0)
|
||||||
{
|
{
|
||||||
ftpData.clients[theSocketId].closeTheClient = 1;
|
ftpData.clients[theSocketId].closeTheClient = 1;
|
||||||
|
printf("\n Closing the client 13");
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -427,10 +441,12 @@ void runFtpServer(void)
|
|||||||
else if (commandProcessStatus == FTP_COMMAND_PROCESSED)
|
else if (commandProcessStatus == FTP_COMMAND_PROCESSED)
|
||||||
{
|
{
|
||||||
ftpData.clients[processingSock].lastActivityTimeStamp = (int)time(NULL);
|
ftpData.clients[processingSock].lastActivityTimeStamp = (int)time(NULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (commandProcessStatus == FTP_COMMAND_PROCESSED_WRITE_ERROR)
|
else if (commandProcessStatus == FTP_COMMAND_PROCESSED_WRITE_ERROR)
|
||||||
{
|
{
|
||||||
ftpData.clients[processingSock].closeTheClient = 1;
|
ftpData.clients[processingSock].closeTheClient = 1;
|
||||||
|
printf("\n Write error, closing the client!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -441,7 +457,10 @@ void runFtpServer(void)
|
|||||||
ftpData.clients[processingSock].commandIndex = 0;
|
ftpData.clients[processingSock].commandIndex = 0;
|
||||||
memset(ftpData.clients[processingSock].theCommandReceived, 0, CLIENT_COMMAND_STRING_SIZE);
|
memset(ftpData.clients[processingSock].theCommandReceived, 0, CLIENT_COMMAND_STRING_SIZE);
|
||||||
returnCode = dprintf(ftpData.clients[processingSock].socketDescriptor, "500 Unknown command\r\n");
|
returnCode = dprintf(ftpData.clients[processingSock].socketDescriptor, "500 Unknown command\r\n");
|
||||||
if (returnCode <= 0) ftpData.clients[processingSock].closeTheClient = 1;
|
if (returnCode <= 0)
|
||||||
|
ftpData.clients[processingSock].closeTheClient = 1;
|
||||||
|
|
||||||
|
printf("\n Command too long closing the client.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -334,6 +334,10 @@ static int readConfigurationFile(char *path, DYNV_VectorGenericDataType *paramet
|
|||||||
parametersVector->PushBack(parametersVector, ¶meter, sizeof(parameter_DataType));
|
parametersVector->PushBack(parametersVector, ¶meter, sizeof(parameter_DataType));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (theFileSize > 0) {
|
||||||
|
free(theFileContent);
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user