mirror of
https://github.com/kingk85/uFTP.git
synced 2025-07-17 09:16:11 +03:00
Some refactoring
This commit is contained in:
@ -36,8 +36,8 @@ start:
|
|||||||
end:
|
end:
|
||||||
@echo Build process end
|
@echo Build process end
|
||||||
|
|
||||||
uFTP: uFTP.c fileManagement.o configRead.o logFunctions.o ftpCommandElaborate.o ftpData.o ftpServer.o daemon.o
|
uFTP: uFTP.c fileManagement.o configRead.o logFunctions.o ftpCommandElaborate.o ftpData.o ftpServer.o daemon.o signals.o
|
||||||
@$(CC) uFTP.c $(LIBPATH)dynamicVectors.o $(LIBPATH)fileManagement.o $(LIBPATH)configRead.o $(LIBPATH)logFunctions.o $(LIBPATH)ftpCommandElaborate.o $(LIBPATH)ftpData.o $(LIBPATH)ftpServer.o $(LIBPATH)daemon.o -o $(OUTPATH)uFTP -lpthread
|
@$(CC) uFTP.c $(LIBPATH)dynamicVectors.o $(LIBPATH)fileManagement.o $(LIBPATH)configRead.o $(LIBPATH)logFunctions.o $(LIBPATH)ftpCommandElaborate.o $(LIBPATH)ftpData.o $(LIBPATH)ftpServer.o $(LIBPATH)daemon.o $(LIBPATH)signals.o -o $(OUTPATH)uFTP -lpthread
|
||||||
|
|
||||||
daemon.o:
|
daemon.o:
|
||||||
@$(CC) $(CFLAGS) $(SOURCE_MODULES_PATH)daemon.c -o $(LIBPATH)daemon.o
|
@$(CC) $(CFLAGS) $(SOURCE_MODULES_PATH)daemon.c -o $(LIBPATH)daemon.o
|
||||||
@ -51,6 +51,9 @@ configRead.o: dynamicVectors.o fileManagement.o
|
|||||||
fileManagement.o:
|
fileManagement.o:
|
||||||
@$(CC) $(CFLAGS) $(SOURCE_MODULES_PATH)fileManagement.c -o $(LIBPATH)fileManagement.o
|
@$(CC) $(CFLAGS) $(SOURCE_MODULES_PATH)fileManagement.c -o $(LIBPATH)fileManagement.o
|
||||||
|
|
||||||
|
signals.o:
|
||||||
|
@$(CC) $(CFLAGS) $(SOURCE_MODULES_PATH)signals.c -o $(LIBPATH)signals.o
|
||||||
|
|
||||||
logFunctions.o:
|
logFunctions.o:
|
||||||
@$(CC) $(CFLAGS) $(SOURCE_MODULES_PATH)logFunctions.c -o $(LIBPATH)logFunctions.o
|
@$(CC) $(CFLAGS) $(SOURCE_MODULES_PATH)logFunctions.c -o $(LIBPATH)logFunctions.o
|
||||||
|
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -2,7 +2,7 @@ build/Debug/GNU-Linux/ftpServer.o: ftpServer.c library/dynamicVectors.h \
|
|||||||
library/fileManagement.h library/dynamicVectors.h ftpServer.h ftpData.h \
|
library/fileManagement.h library/dynamicVectors.h ftpServer.h ftpData.h \
|
||||||
library/dynamicVectors.h library/configRead.h library/dynamicVectors.h \
|
library/dynamicVectors.h library/configRead.h library/dynamicVectors.h \
|
||||||
ftpCommandsElaborate.h library/fileManagement.h library/logFunctions.h \
|
ftpCommandsElaborate.h library/fileManagement.h library/logFunctions.h \
|
||||||
library/daemon.h
|
library/daemon.h library/signals.h
|
||||||
|
|
||||||
library/dynamicVectors.h:
|
library/dynamicVectors.h:
|
||||||
|
|
||||||
@ -27,3 +27,5 @@ library/fileManagement.h:
|
|||||||
library/logFunctions.h:
|
library/logFunctions.h:
|
||||||
|
|
||||||
library/daemon.h:
|
library/daemon.h:
|
||||||
|
|
||||||
|
library/signals.h:
|
||||||
|
Binary file not shown.
BIN
build/Debug/GNU-Linux/library/signals.o
Normal file
BIN
build/Debug/GNU-Linux/library/signals.o
Normal file
Binary file not shown.
11
build/Debug/GNU-Linux/library/signals.o.d
Normal file
11
build/Debug/GNU-Linux/library/signals.o.d
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
build/Debug/GNU-Linux/library/signals.o: library/signals.c \
|
||||||
|
library/dynamicVectors.h library/fileManagement.h \
|
||||||
|
library/dynamicVectors.h library/../ftpServer.h
|
||||||
|
|
||||||
|
library/dynamicVectors.h:
|
||||||
|
|
||||||
|
library/fileManagement.h:
|
||||||
|
|
||||||
|
library/dynamicVectors.h:
|
||||||
|
|
||||||
|
library/../ftpServer.h:
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
build/modules/signals.o
Normal file
BIN
build/modules/signals.o
Normal file
Binary file not shown.
BIN
build/uFTP
Executable file
BIN
build/uFTP
Executable file
Binary file not shown.
1
dist/Debug/GNU-Linux/config.cfg
vendored
1
dist/Debug/GNU-Linux/config.cfg
vendored
@ -1 +0,0 @@
|
|||||||
../../../config.cfg
|
|
BIN
dist/Debug/GNU-Linux/uftp
vendored
BIN
dist/Debug/GNU-Linux/uftp
vendored
Binary file not shown.
1
dist/Debug/GNU-Linux/uftpd.cfg
vendored
Symbolic link
1
dist/Debug/GNU-Linux/uftpd.cfg
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../../uftpd.cfg
|
19
ftpServer.c
19
ftpServer.c
@ -29,6 +29,7 @@
|
|||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -47,12 +48,8 @@
|
|||||||
#include "library/logFunctions.h"
|
#include "library/logFunctions.h"
|
||||||
#include "library/configRead.h"
|
#include "library/configRead.h"
|
||||||
#include "library/daemon.h"
|
#include "library/daemon.h"
|
||||||
|
#include "library/signals.h"
|
||||||
|
|
||||||
/* Catch Signal Handler functio */
|
|
||||||
void signal_callback_handler(int signum){
|
|
||||||
|
|
||||||
printf("Caught signal SIGPIPE %d\n",signum);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ftpDataType ftpData;
|
static ftpDataType ftpData;
|
||||||
|
|
||||||
@ -366,15 +363,13 @@ void *connectionWorkerHandle(void * socketId)
|
|||||||
|
|
||||||
void runFtpServer(void)
|
void runFtpServer(void)
|
||||||
{
|
{
|
||||||
DYNV_VectorGenericDataType configParameters;
|
|
||||||
fd_set rset, wset, eset, rsetAll, wsetAll, esetAll;
|
fd_set rset, wset, eset, rsetAll, wsetAll, esetAll;
|
||||||
static int processingSock = 0;
|
static int processingSock = 0;
|
||||||
static int maxSocketFD = 0;
|
static int maxSocketFD = 0;
|
||||||
|
|
||||||
DYNV_VectorGeneric_Init(&configParameters);
|
/*Read the configuration file */
|
||||||
readConfigurationFile("./config.cfg", &configParameters);
|
configurationRead(&ftpData.ftpParameters);
|
||||||
parseConfigurationFile(&ftpData.ftpParameters, &configParameters);
|
|
||||||
|
|
||||||
if (ftpData.ftpParameters.singleInstanceModeOn == 1)
|
if (ftpData.ftpParameters.singleInstanceModeOn == 1)
|
||||||
{
|
{
|
||||||
int returnCode = isProcessAlreadyRunning();
|
int returnCode = isProcessAlreadyRunning();
|
||||||
@ -385,15 +380,15 @@ void runFtpServer(void)
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fork the process daemon mode */
|
/* Fork the process daemon mode */
|
||||||
if (ftpData.ftpParameters.daemonModeOn == 1)
|
if (ftpData.ftpParameters.daemonModeOn == 1)
|
||||||
{
|
{
|
||||||
daemonize("uFTP");
|
daemonize("uFTP");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
signalHandlerInstall();
|
||||||
initFtpData();
|
initFtpData();
|
||||||
|
|
||||||
//Socket main creator
|
//Socket main creator
|
||||||
ftpData.theSocket = createSocket(ftpData.ftpParameters.port);
|
ftpData.theSocket = createSocket(ftpData.ftpParameters.port);
|
||||||
printTimeStamp();
|
printTimeStamp();
|
||||||
|
@ -22,8 +22,6 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -34,9 +32,58 @@
|
|||||||
|
|
||||||
#define PARAMETER_SIZE_LIMIT 1024
|
#define PARAMETER_SIZE_LIMIT 1024
|
||||||
|
|
||||||
int readConfigurationFile(char *path, DYNV_VectorGenericDataType *parametersVector)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
/* Public Functions */
|
||||||
|
int searchUser(char *name, DYNV_VectorGenericDataType *usersVector)
|
||||||
|
{
|
||||||
|
int returnCode = -1;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
for (i = 0; i <usersVector->Size; i++)
|
||||||
|
{
|
||||||
|
if (strcmp(name, ((usersParameters_DataType *) usersVector->Data[i])->name) == 0)
|
||||||
|
{
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void configurationRead(ftpParameters_DataType *ftpParameters)
|
||||||
|
{
|
||||||
|
int returnCode = 0;
|
||||||
|
DYNV_VectorGenericDataType configParameters;
|
||||||
|
DYNV_VectorGeneric_Init(&configParameters);
|
||||||
|
|
||||||
|
if (FILE_IsFile(LOCAL_CONFIGURATION_FILENAME) == 1)
|
||||||
|
{
|
||||||
|
printf("\nReading configuration from \n -> %s", LOCAL_CONFIGURATION_FILENAME);
|
||||||
|
returnCode = readConfigurationFile(LOCAL_CONFIGURATION_FILENAME, &configParameters);
|
||||||
|
}
|
||||||
|
else if (FILE_IsFile(DEFAULT_CONFIGURATION_FILENAME) == 1)
|
||||||
|
{
|
||||||
|
printf("\nReading configuration from \n -> %s", DEFAULT_CONFIGURATION_FILENAME);
|
||||||
|
returnCode = readConfigurationFile(DEFAULT_CONFIGURATION_FILENAME, &configParameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (returnCode == 1)
|
||||||
|
{
|
||||||
|
parseConfigurationFile(ftpParameters, &configParameters);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("\nError: could not read the configuration file located at: \n -> %s or at \n -> %s", DEFAULT_CONFIGURATION_FILENAME, LOCAL_CONFIGURATION_FILENAME);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*Private functions*/
|
||||||
|
static int readConfigurationFile(char *path, DYNV_VectorGenericDataType *parametersVector)
|
||||||
|
{
|
||||||
#define STATE_START 0
|
#define STATE_START 0
|
||||||
#define STATE_NAME 1
|
#define STATE_NAME 1
|
||||||
#define STATE_VALUE 2
|
#define STATE_VALUE 2
|
||||||
@ -76,17 +123,17 @@ int readConfigurationFile(char *path, DYNV_VectorGenericDataType *parametersVect
|
|||||||
/* 1st char is a sharp comment case */
|
/* 1st char is a sharp comment case */
|
||||||
else if (theFileContent[i] == '#')
|
else if (theFileContent[i] == '#')
|
||||||
{
|
{
|
||||||
state = STATE_TO_NEW_LINE;
|
state = STATE_TO_NEW_LINE;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
/* Name Start */
|
/* Name Start */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
state = STATE_NAME;
|
state = STATE_NAME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STATE_NAME:
|
case STATE_NAME:
|
||||||
{
|
{
|
||||||
/* Not allowed chars in the name */
|
/* Not allowed chars in the name */
|
||||||
@ -122,7 +169,7 @@ int readConfigurationFile(char *path, DYNV_VectorGenericDataType *parametersVect
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STATE_VALUE:
|
case STATE_VALUE:
|
||||||
{
|
{
|
||||||
/* Skip not allowed values */
|
/* Skip not allowed values */
|
||||||
@ -136,17 +183,19 @@ int readConfigurationFile(char *path, DYNV_VectorGenericDataType *parametersVect
|
|||||||
else if (theFileContent[i] == '"')
|
else if (theFileContent[i] == '"')
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
if (allowSpacesInValue == 0)
|
if (allowSpacesInValue == 0)
|
||||||
allowSpacesInValue = 1;
|
allowSpacesInValue = 1;
|
||||||
else
|
else
|
||||||
allowSpacesInValue = 0;
|
allowSpacesInValue = 0;
|
||||||
}
|
}
|
||||||
else if (theFileContent[i] == '\n')
|
else if (theFileContent[i] == '\n')
|
||||||
{
|
{
|
||||||
/* Value stored proceed to save */
|
/* Value stored proceed to save */
|
||||||
if (valueIndex > 0)
|
if (valueIndex > 0)
|
||||||
|
{
|
||||||
state = STATE_STORE;
|
state = STATE_STORE;
|
||||||
|
}
|
||||||
else if (valueIndex == 0) /* No void value allowed*/
|
else if (valueIndex == 0) /* No void value allowed*/
|
||||||
{
|
{
|
||||||
memset(name, 0, PARAMETER_SIZE_LIMIT);
|
memset(name, 0, PARAMETER_SIZE_LIMIT);
|
||||||
@ -171,7 +220,7 @@ int readConfigurationFile(char *path, DYNV_VectorGenericDataType *parametersVect
|
|||||||
/* Wait until a new line is found */
|
/* Wait until a new line is found */
|
||||||
if (theFileContent[i] == '\n')
|
if (theFileContent[i] == '\n')
|
||||||
{
|
{
|
||||||
state = STATE_START;
|
state = STATE_START;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@ -179,33 +228,48 @@ int readConfigurationFile(char *path, DYNV_VectorGenericDataType *parametersVect
|
|||||||
|
|
||||||
case STATE_STORE:
|
case STATE_STORE:
|
||||||
{
|
{
|
||||||
parameter_DataType parameter;
|
parameter_DataType parameter;
|
||||||
parameter.name = malloc(nameIndex+1);
|
parameter.name = malloc(nameIndex+1);
|
||||||
parameter.value = malloc(valueIndex+1);
|
parameter.value = malloc(valueIndex+1);
|
||||||
strcpy(parameter.name, name);
|
strcpy(parameter.name, name);
|
||||||
strcpy(parameter.value, value);
|
strcpy(parameter.value, value);
|
||||||
parameter.name[nameIndex] = '\0';
|
parameter.name[nameIndex] = '\0';
|
||||||
parameter.value[valueIndex] = '\0';
|
parameter.value[valueIndex] = '\0';
|
||||||
memset(name, 0, PARAMETER_SIZE_LIMIT);
|
memset(name, 0, PARAMETER_SIZE_LIMIT);
|
||||||
memset(value, 0, PARAMETER_SIZE_LIMIT);
|
memset(value, 0, PARAMETER_SIZE_LIMIT);
|
||||||
nameIndex = 0;
|
nameIndex = 0;
|
||||||
valueIndex = 0;
|
valueIndex = 0;
|
||||||
state = STATE_START;
|
state = STATE_START;
|
||||||
printf("\nParameter read: %s = %s", parameter.name, parameter.value);
|
//printf("\nParameter read: %s = %s", parameter.name, parameter.value);
|
||||||
parametersVector->PushBack(parametersVector, ¶meter, sizeof(parameter_DataType));
|
parametersVector->PushBack(parametersVector, ¶meter, sizeof(parameter_DataType));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
/* che if there is a value to store */
|
||||||
|
if (state == STATE_VALUE &&
|
||||||
|
valueIndex > 0)
|
||||||
|
{
|
||||||
|
parameter_DataType parameter;
|
||||||
|
parameter.name = malloc(nameIndex+1);
|
||||||
|
parameter.value = malloc(valueIndex+1);
|
||||||
|
strcpy(parameter.name, name);
|
||||||
|
strcpy(parameter.value, value);
|
||||||
|
parameter.name[nameIndex] = '\0';
|
||||||
|
parameter.value[valueIndex] = '\0';
|
||||||
|
memset(name, 0, PARAMETER_SIZE_LIMIT);
|
||||||
|
memset(value, 0, PARAMETER_SIZE_LIMIT);
|
||||||
|
nameIndex = 0;
|
||||||
|
valueIndex = 0;
|
||||||
|
//printf("\nParameter read: %s = %s", parameter.name, parameter.value);
|
||||||
|
parametersVector->PushBack(parametersVector, ¶meter, sizeof(parameter_DataType));
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int searchParameter(char *name, DYNV_VectorGenericDataType *parametersVector)
|
static int searchParameter(char *name, DYNV_VectorGenericDataType *parametersVector)
|
||||||
{
|
{
|
||||||
int returnCode = -1;
|
int returnCode = -1;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -221,48 +285,39 @@ int searchParameter(char *name, DYNV_VectorGenericDataType *parametersVector)
|
|||||||
return returnCode;
|
return returnCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
int searchUser(char *name, DYNV_VectorGenericDataType *usersVector)
|
static int parseConfigurationFile(ftpParameters_DataType *ftpParameters, DYNV_VectorGenericDataType *parametersVector)
|
||||||
{
|
{
|
||||||
int returnCode = -1;
|
int searchIndex, userIndex;
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
for (i = 0; i <usersVector->Size; i++)
|
char userX[PARAMETER_SIZE_LIMIT],
|
||||||
{
|
passwordX[PARAMETER_SIZE_LIMIT],
|
||||||
if (strcmp(name, ((usersParameters_DataType *) usersVector->Data[i])->name) == 0)
|
homeX[PARAMETER_SIZE_LIMIT];
|
||||||
{
|
|
||||||
return i;
|
printf("\nReading configuration settings..");
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return returnCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
int parseConfigurationFile(ftpParameters_DataType *ftpParameters, DYNV_VectorGenericDataType *parametersVector)
|
|
||||||
{
|
|
||||||
int searchIndex;
|
|
||||||
int userIndex;
|
|
||||||
char userX[PARAMETER_SIZE_LIMIT], passwordX[PARAMETER_SIZE_LIMIT], homeX[PARAMETER_SIZE_LIMIT];
|
|
||||||
|
|
||||||
searchIndex = searchParameter("MAXIMUM_ALLOWED_FTP_CONNECTION", parametersVector);
|
searchIndex = searchParameter("MAXIMUM_ALLOWED_FTP_CONNECTION", parametersVector);
|
||||||
if (searchIndex != -1)
|
if (searchIndex != -1)
|
||||||
{
|
{
|
||||||
ftpParameters->maxClients = atoi(((parameter_DataType *) parametersVector->Data[searchIndex])->value);
|
ftpParameters->maxClients = atoi(((parameter_DataType *) parametersVector->Data[searchIndex])->value);
|
||||||
printf("\nFtp maximum allowed clients: %d", ftpParameters->maxClients);
|
printf("\nMAXIMUM_ALLOWED_FTP_CONNECTION: %d", ftpParameters->maxClients);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ftpParameters->maxClients = 10;
|
ftpParameters->maxClients = 10;
|
||||||
|
printf("\nMAXIMUM_ALLOWED_FTP_CONNECTION parameter not found in the configuration file, using the default value: %d", ftpParameters->maxClients);
|
||||||
}
|
}
|
||||||
|
|
||||||
searchIndex = searchParameter("FTP_PORT", parametersVector);
|
searchIndex = searchParameter("FTP_PORT", parametersVector);
|
||||||
if (searchIndex != -1)
|
if (searchIndex != -1)
|
||||||
{
|
{
|
||||||
ftpParameters->port = atoi(((parameter_DataType *) parametersVector->Data[searchIndex])->value);
|
ftpParameters->port = atoi(((parameter_DataType *) parametersVector->Data[searchIndex])->value);
|
||||||
printf("\nFtp port: %d", ftpParameters->port);
|
printf("\nFTP_PORT: %d", ftpParameters->port);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ftpParameters->port = 21;
|
ftpParameters->port = 21;
|
||||||
|
printf("\nFTP_PORT parameter not found in the configuration file, using the default value: %d", ftpParameters->maxClients);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -275,6 +330,12 @@ int parseConfigurationFile(ftpParameters_DataType *ftpParameters, DYNV_VectorGen
|
|||||||
|
|
||||||
if(strcmp(((parameter_DataType *) parametersVector->Data[searchIndex])->value, "TRUE") == 0)
|
if(strcmp(((parameter_DataType *) parametersVector->Data[searchIndex])->value, "TRUE") == 0)
|
||||||
ftpParameters->daemonModeOn = 1;
|
ftpParameters->daemonModeOn = 1;
|
||||||
|
|
||||||
|
printf("\nDAEMON_MODE value: %d", ftpParameters->daemonModeOn);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("\nDAEMON_MODE parameter not found in the configuration file, using the default value: %d", ftpParameters->daemonModeOn);
|
||||||
}
|
}
|
||||||
|
|
||||||
ftpParameters->singleInstanceModeOn = 0;
|
ftpParameters->singleInstanceModeOn = 0;
|
||||||
@ -287,21 +348,22 @@ int parseConfigurationFile(ftpParameters_DataType *ftpParameters, DYNV_VectorGen
|
|||||||
if(strcmp(((parameter_DataType *) parametersVector->Data[searchIndex])->value, "TRUE") == 0)
|
if(strcmp(((parameter_DataType *) parametersVector->Data[searchIndex])->value, "TRUE") == 0)
|
||||||
ftpParameters->singleInstanceModeOn = 1;
|
ftpParameters->singleInstanceModeOn = 1;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("\nSINGLE_INSTANCE parameter not found in the configuration file, using the default value: %d", ftpParameters->singleInstanceModeOn);
|
||||||
ftpParameters->maximumIdleInactivity = 0;
|
}
|
||||||
|
|
||||||
|
ftpParameters->maximumIdleInactivity = 3600;
|
||||||
searchIndex = searchParameter("IDLE_MAX_TIMEOUT", parametersVector);
|
searchIndex = searchParameter("IDLE_MAX_TIMEOUT", parametersVector);
|
||||||
if (searchIndex != -1)
|
if (searchIndex != -1)
|
||||||
{
|
{
|
||||||
ftpParameters->maximumIdleInactivity = atoi(((parameter_DataType *) parametersVector->Data[searchIndex])->value);
|
ftpParameters->maximumIdleInactivity = atoi(((parameter_DataType *) parametersVector->Data[searchIndex])->value);
|
||||||
}
|
printf("\nIDLE_MAX_TIMEOUT value: %d", ftpParameters->maximumIdleInactivity);
|
||||||
printf("\nftpParameters->maximumIdleInactivity: %d", ftpParameters->maximumIdleInactivity);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
printf("\nFtp singleInstanceModeOn: %d", ftpParameters->singleInstanceModeOn);
|
printf("\nIDLE_MAX_TIMEOUT parameter not found in the configuration file, using the default value: %d", ftpParameters->maximumIdleInactivity);
|
||||||
printf("\nFtp daemonModeOn: %d", ftpParameters->daemonModeOn);
|
}
|
||||||
|
|
||||||
|
|
||||||
searchIndex = searchParameter("FTP_SERVER_IP", parametersVector);
|
searchIndex = searchParameter("FTP_SERVER_IP", parametersVector);
|
||||||
if (searchIndex != -1)
|
if (searchIndex != -1)
|
||||||
@ -310,32 +372,29 @@ int parseConfigurationFile(ftpParameters_DataType *ftpParameters, DYNV_VectorGen
|
|||||||
&ftpParameters->ftpIpAddress[1],
|
&ftpParameters->ftpIpAddress[1],
|
||||||
&ftpParameters->ftpIpAddress[2],
|
&ftpParameters->ftpIpAddress[2],
|
||||||
&ftpParameters->ftpIpAddress[3]);
|
&ftpParameters->ftpIpAddress[3]);
|
||||||
printf("\nFtp ip address: %d.%d.%d.%d", ftpParameters->ftpIpAddress[0],
|
printf("\nFTP_SERVER_IP value: %d.%d.%d.%d", ftpParameters->ftpIpAddress[0],
|
||||||
ftpParameters->ftpIpAddress[1],
|
ftpParameters->ftpIpAddress[1],
|
||||||
ftpParameters->ftpIpAddress[2],
|
ftpParameters->ftpIpAddress[2],
|
||||||
ftpParameters->ftpIpAddress[3]);
|
ftpParameters->ftpIpAddress[3]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ftpParameters->ftpIpAddress[0] = 127;
|
ftpParameters->ftpIpAddress[0] = 127;
|
||||||
ftpParameters->ftpIpAddress[1] = 0;
|
ftpParameters->ftpIpAddress[1] = 0;
|
||||||
ftpParameters->ftpIpAddress[2] = 0;
|
ftpParameters->ftpIpAddress[2] = 0;
|
||||||
ftpParameters->ftpIpAddress[3] = 1;
|
ftpParameters->ftpIpAddress[3] = 1;
|
||||||
|
printf("\nFTP_SERVER_IP parameter not found in the configuration file, listening on all available networks");
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\nFtp port wait start: %d", ftpParameters->port);
|
|
||||||
/* USER SETTINGS */
|
/* USER SETTINGS */
|
||||||
userIndex = 0;
|
userIndex = 0;
|
||||||
|
|
||||||
memset(userX, 0, PARAMETER_SIZE_LIMIT);
|
memset(userX, 0, PARAMETER_SIZE_LIMIT);
|
||||||
memset(passwordX, 0, PARAMETER_SIZE_LIMIT);
|
memset(passwordX, 0, PARAMETER_SIZE_LIMIT);
|
||||||
memset(homeX, 0, PARAMETER_SIZE_LIMIT);
|
memset(homeX, 0, PARAMETER_SIZE_LIMIT);
|
||||||
|
|
||||||
DYNV_VectorGeneric_Init(&ftpParameters->usersVector);
|
DYNV_VectorGeneric_Init(&ftpParameters->usersVector);
|
||||||
printf("\nFtp port xxx: %d", ftpParameters->port);
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
printf("\nFtp port start: %d", ftpParameters->port);
|
|
||||||
int searchUserIndex, searchPasswordIndex, searchHomeIndex;
|
int searchUserIndex, searchPasswordIndex, searchHomeIndex;
|
||||||
usersParameters_DataType userData;
|
usersParameters_DataType userData;
|
||||||
|
|
||||||
@ -368,17 +427,13 @@ int parseConfigurationFile(ftpParameters_DataType *ftpParameters, DYNV_VectorGen
|
|||||||
userData.password[strlen(((parameter_DataType *) parametersVector->Data[searchPasswordIndex])->value)] = '\0';
|
userData.password[strlen(((parameter_DataType *) parametersVector->Data[searchPasswordIndex])->value)] = '\0';
|
||||||
userData.homePath[strlen(((parameter_DataType *) parametersVector->Data[searchHomeIndex])->value)] = '\0';
|
userData.homePath[strlen(((parameter_DataType *) parametersVector->Data[searchHomeIndex])->value)] = '\0';
|
||||||
|
|
||||||
printf("\n\nAdding user");
|
printf("\nUser parameter found");
|
||||||
printf("\nName: %s", userData.name);
|
printf("\nName: %s", userData.name);
|
||||||
printf("\nPassword: %s", userData.password);
|
printf("\nPassword: %s", userData.password);
|
||||||
printf("\nHomePath: %s", userData.homePath);
|
printf("\nHomePath: %s", userData.homePath);
|
||||||
|
|
||||||
ftpParameters->usersVector.PushBack(&ftpParameters->usersVector, &userData, sizeof(usersParameters_DataType));
|
|
||||||
printf("\nFtp port end: %d", ftpParameters->port);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ftpParameters->usersVector.PushBack(&ftpParameters->usersVector, &userData, sizeof(usersParameters_DataType));
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
@ -28,9 +28,14 @@
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "dynamicVectors.h"
|
#include "dynamicVectors.h"
|
||||||
|
|
||||||
|
#define DEFAULT_CONFIGURATION_FILENAME "/etc/uftpd.cfg"
|
||||||
|
#define LOCAL_CONFIGURATION_FILENAME "./uftpd.cfg"
|
||||||
|
|
||||||
|
|
||||||
|
/* Data structures */
|
||||||
struct parameter
|
struct parameter
|
||||||
{
|
{
|
||||||
char* name;
|
char* name;
|
||||||
@ -55,10 +60,15 @@ struct ftpParameters
|
|||||||
int maximumIdleInactivity;
|
int maximumIdleInactivity;
|
||||||
} typedef ftpParameters_DataType;
|
} typedef ftpParameters_DataType;
|
||||||
|
|
||||||
int readConfigurationFile(char *path, DYNV_VectorGenericDataType *parametersVector);
|
|
||||||
int searchParameter(char *name, DYNV_VectorGenericDataType *parametersVector);
|
/*Public functions */
|
||||||
int searchUser(char *name, DYNV_VectorGenericDataType *usersVector);
|
int searchUser(char *name, DYNV_VectorGenericDataType *usersVector);
|
||||||
int parseConfigurationFile(ftpParameters_DataType *ftpParameters, DYNV_VectorGenericDataType *parametersVector);
|
void configurationRead(ftpParameters_DataType *ftpParameters);
|
||||||
|
|
||||||
|
/* Private Functions */
|
||||||
|
static int parseConfigurationFile(ftpParameters_DataType *ftpParameters, DYNV_VectorGenericDataType *parametersVector);
|
||||||
|
static int searchParameter(char *name, DYNV_VectorGenericDataType *parametersVector);
|
||||||
|
static int readConfigurationFile(char *path, DYNV_VectorGenericDataType *parametersVector);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
38
library/signals.c
Normal file
38
library/signals.c
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* The MIT License
|
||||||
|
*
|
||||||
|
* Copyright 2018 Ugo Cirmignani
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
|
#include "../ftpServer.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* Catch Signal Handler functio */
|
||||||
|
void signal_callback_handler(int signum){
|
||||||
|
|
||||||
|
printf("Caught signal SIGPIPE %d\n",signum);
|
||||||
|
}
|
||||||
|
|
||||||
|
void signalHandlerInstall(void)
|
||||||
|
{
|
||||||
|
signal(SIGPIPE, signal_callback_handler);
|
||||||
|
}
|
47
library/signals.h
Normal file
47
library/signals.h
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* The MIT License
|
||||||
|
*
|
||||||
|
* Copyright 2018 Ugo Cirmignani
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* File: signals.h
|
||||||
|
* Author: ugo
|
||||||
|
*
|
||||||
|
* Created on 24 febbraio 2018, 19.15
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SIGNALS_H
|
||||||
|
#define SIGNALS_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void signalHandlerInstall(void);
|
||||||
|
void signal_callback_handler(int signum);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* SIGNALS_H */
|
||||||
|
|
@ -43,6 +43,7 @@ OBJECTFILES= \
|
|||||||
${OBJECTDIR}/library/dynamicVectors.o \
|
${OBJECTDIR}/library/dynamicVectors.o \
|
||||||
${OBJECTDIR}/library/fileManagement.o \
|
${OBJECTDIR}/library/fileManagement.o \
|
||||||
${OBJECTDIR}/library/logFunctions.o \
|
${OBJECTDIR}/library/logFunctions.o \
|
||||||
|
${OBJECTDIR}/library/signals.o \
|
||||||
${OBJECTDIR}/uFTP.o
|
${OBJECTDIR}/uFTP.o
|
||||||
|
|
||||||
|
|
||||||
@ -110,6 +111,11 @@ ${OBJECTDIR}/library/logFunctions.o: library/logFunctions.c
|
|||||||
${RM} "$@.d"
|
${RM} "$@.d"
|
||||||
$(COMPILE.c) -g -Ilibrary -include library/dynamicVectors.h -include library/fileManagement.h -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/library/logFunctions.o library/logFunctions.c
|
$(COMPILE.c) -g -Ilibrary -include library/dynamicVectors.h -include library/fileManagement.h -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/library/logFunctions.o library/logFunctions.c
|
||||||
|
|
||||||
|
${OBJECTDIR}/library/signals.o: library/signals.c
|
||||||
|
${MKDIR} -p ${OBJECTDIR}/library
|
||||||
|
${RM} "$@.d"
|
||||||
|
$(COMPILE.c) -g -Ilibrary -include library/dynamicVectors.h -include library/fileManagement.h -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/library/signals.o library/signals.c
|
||||||
|
|
||||||
${OBJECTDIR}/uFTP.o: uFTP.c
|
${OBJECTDIR}/uFTP.o: uFTP.c
|
||||||
${MKDIR} -p ${OBJECTDIR}
|
${MKDIR} -p ${OBJECTDIR}
|
||||||
${RM} "$@.d"
|
${RM} "$@.d"
|
||||||
|
@ -43,6 +43,7 @@ OBJECTFILES= \
|
|||||||
${OBJECTDIR}/library/dynamicVectors.o \
|
${OBJECTDIR}/library/dynamicVectors.o \
|
||||||
${OBJECTDIR}/library/fileManagement.o \
|
${OBJECTDIR}/library/fileManagement.o \
|
||||||
${OBJECTDIR}/library/logFunctions.o \
|
${OBJECTDIR}/library/logFunctions.o \
|
||||||
|
${OBJECTDIR}/library/signals.o \
|
||||||
${OBJECTDIR}/uFTP.o
|
${OBJECTDIR}/uFTP.o
|
||||||
|
|
||||||
|
|
||||||
@ -110,6 +111,11 @@ ${OBJECTDIR}/library/logFunctions.o: library/logFunctions.c
|
|||||||
${RM} "$@.d"
|
${RM} "$@.d"
|
||||||
$(COMPILE.c) -O2 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/library/logFunctions.o library/logFunctions.c
|
$(COMPILE.c) -O2 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/library/logFunctions.o library/logFunctions.c
|
||||||
|
|
||||||
|
${OBJECTDIR}/library/signals.o: library/signals.c
|
||||||
|
${MKDIR} -p ${OBJECTDIR}/library
|
||||||
|
${RM} "$@.d"
|
||||||
|
$(COMPILE.c) -O2 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/library/signals.o library/signals.c
|
||||||
|
|
||||||
${OBJECTDIR}/uFTP.o: uFTP.c
|
${OBJECTDIR}/uFTP.o: uFTP.c
|
||||||
${MKDIR} -p ${OBJECTDIR}
|
${MKDIR} -p ${OBJECTDIR}
|
||||||
${RM} "$@.d"
|
${RM} "$@.d"
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
<itemPath>library/dynamicVectors.h</itemPath>
|
<itemPath>library/dynamicVectors.h</itemPath>
|
||||||
<itemPath>library/fileManagement.h</itemPath>
|
<itemPath>library/fileManagement.h</itemPath>
|
||||||
<itemPath>library/logFunctions.h</itemPath>
|
<itemPath>library/logFunctions.h</itemPath>
|
||||||
|
<itemPath>library/signals.h</itemPath>
|
||||||
</logicalFolder>
|
</logicalFolder>
|
||||||
<itemPath>library/daemon.h</itemPath>
|
<itemPath>library/daemon.h</itemPath>
|
||||||
<itemPath>ftpCommandsElaborate.h</itemPath>
|
<itemPath>ftpCommandsElaborate.h</itemPath>
|
||||||
@ -29,14 +30,15 @@
|
|||||||
<itemPath>library/dynamicVectors.c</itemPath>
|
<itemPath>library/dynamicVectors.c</itemPath>
|
||||||
<itemPath>library/fileManagement.c</itemPath>
|
<itemPath>library/fileManagement.c</itemPath>
|
||||||
<itemPath>library/logFunctions.c</itemPath>
|
<itemPath>library/logFunctions.c</itemPath>
|
||||||
|
<itemPath>library/signals.c</itemPath>
|
||||||
</logicalFolder>
|
</logicalFolder>
|
||||||
<itemPath>MakeFileGeneric</itemPath>
|
<itemPath>MakeFileGeneric</itemPath>
|
||||||
<itemPath>config.cfg</itemPath>
|
|
||||||
<itemPath>ftpCommandElaborate.c</itemPath>
|
<itemPath>ftpCommandElaborate.c</itemPath>
|
||||||
<itemPath>ftpData.c</itemPath>
|
<itemPath>ftpData.c</itemPath>
|
||||||
<itemPath>ftpServer.c</itemPath>
|
<itemPath>ftpServer.c</itemPath>
|
||||||
<itemPath>todo.txt</itemPath>
|
<itemPath>todo.txt</itemPath>
|
||||||
<itemPath>uFTP.c</itemPath>
|
<itemPath>uFTP.c</itemPath>
|
||||||
|
<itemPath>uftpd.cfg</itemPath>
|
||||||
</logicalFolder>
|
</logicalFolder>
|
||||||
<logicalFolder name="TestFiles"
|
<logicalFolder name="TestFiles"
|
||||||
displayName="Test Files"
|
displayName="Test Files"
|
||||||
@ -76,8 +78,6 @@
|
|||||||
</compileType>
|
</compileType>
|
||||||
<item path="MakeFileGeneric" ex="false" tool="3" flavor2="0">
|
<item path="MakeFileGeneric" ex="false" tool="3" flavor2="0">
|
||||||
</item>
|
</item>
|
||||||
<item path="config.cfg" ex="false" tool="3" flavor2="0">
|
|
||||||
</item>
|
|
||||||
<item path="ftpCommandElaborate.c" ex="false" tool="0" flavor2="0">
|
<item path="ftpCommandElaborate.c" ex="false" tool="0" flavor2="0">
|
||||||
</item>
|
</item>
|
||||||
<item path="ftpCommandsElaborate.h" ex="false" tool="3" flavor2="0">
|
<item path="ftpCommandsElaborate.h" ex="false" tool="3" flavor2="0">
|
||||||
@ -112,10 +112,16 @@
|
|||||||
</item>
|
</item>
|
||||||
<item path="library/logFunctions.h" ex="false" tool="3" flavor2="0">
|
<item path="library/logFunctions.h" ex="false" tool="3" flavor2="0">
|
||||||
</item>
|
</item>
|
||||||
|
<item path="library/signals.c" ex="false" tool="0" flavor2="0">
|
||||||
|
</item>
|
||||||
|
<item path="library/signals.h" ex="false" tool="3" flavor2="0">
|
||||||
|
</item>
|
||||||
<item path="todo.txt" ex="false" tool="3" flavor2="0">
|
<item path="todo.txt" ex="false" tool="3" flavor2="0">
|
||||||
</item>
|
</item>
|
||||||
<item path="uFTP.c" ex="false" tool="0" flavor2="0">
|
<item path="uFTP.c" ex="false" tool="0" flavor2="0">
|
||||||
</item>
|
</item>
|
||||||
|
<item path="uftpd.cfg" ex="false" tool="3" flavor2="0">
|
||||||
|
</item>
|
||||||
</conf>
|
</conf>
|
||||||
<conf name="Release" type="1">
|
<conf name="Release" type="1">
|
||||||
<toolsSet>
|
<toolsSet>
|
||||||
@ -139,8 +145,6 @@
|
|||||||
</compileType>
|
</compileType>
|
||||||
<item path="MakeFileGeneric" ex="false" tool="3" flavor2="0">
|
<item path="MakeFileGeneric" ex="false" tool="3" flavor2="0">
|
||||||
</item>
|
</item>
|
||||||
<item path="config.cfg" ex="false" tool="3" flavor2="0">
|
|
||||||
</item>
|
|
||||||
<item path="ftpCommandElaborate.c" ex="false" tool="0" flavor2="0">
|
<item path="ftpCommandElaborate.c" ex="false" tool="0" flavor2="0">
|
||||||
</item>
|
</item>
|
||||||
<item path="ftpCommandsElaborate.h" ex="false" tool="3" flavor2="0">
|
<item path="ftpCommandsElaborate.h" ex="false" tool="3" flavor2="0">
|
||||||
@ -175,10 +179,16 @@
|
|||||||
</item>
|
</item>
|
||||||
<item path="library/logFunctions.h" ex="false" tool="3" flavor2="0">
|
<item path="library/logFunctions.h" ex="false" tool="3" flavor2="0">
|
||||||
</item>
|
</item>
|
||||||
|
<item path="library/signals.c" ex="false" tool="0" flavor2="0">
|
||||||
|
</item>
|
||||||
|
<item path="library/signals.h" ex="false" tool="3" flavor2="0">
|
||||||
|
</item>
|
||||||
<item path="todo.txt" ex="false" tool="3" flavor2="0">
|
<item path="todo.txt" ex="false" tool="3" flavor2="0">
|
||||||
</item>
|
</item>
|
||||||
<item path="uFTP.c" ex="false" tool="0" flavor2="0">
|
<item path="uFTP.c" ex="false" tool="0" flavor2="0">
|
||||||
</item>
|
</item>
|
||||||
|
<item path="uftpd.cfg" ex="false" tool="3" flavor2="0">
|
||||||
|
</item>
|
||||||
</conf>
|
</conf>
|
||||||
</confs>
|
</confs>
|
||||||
</configurationDescriptor>
|
</configurationDescriptor>
|
||||||
|
@ -7,7 +7,14 @@
|
|||||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||||
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
||||||
<group>
|
<group>
|
||||||
|
<file>file:/home/ugo/NetBeansProjects/uFTP/library/configRead.h</file>
|
||||||
|
<file>file:/home/ugo/NetBeansProjects/uFTP/ftpData.c</file>
|
||||||
|
<file>file:/home/ugo/NetBeansProjects/uFTP/library/signals.c</file>
|
||||||
|
<file>file:/home/ugo/NetBeansProjects/uFTP/library/signals.h</file>
|
||||||
<file>file:/home/ugo/NetBeansProjects/uFTP/ftpServer.c</file>
|
<file>file:/home/ugo/NetBeansProjects/uFTP/ftpServer.c</file>
|
||||||
|
<file>file:/home/ugo/NetBeansProjects/uFTP/uFTP.c</file>
|
||||||
|
<file>file:/home/ugo/NetBeansProjects/uFTP/MakeFileGeneric</file>
|
||||||
|
<file>file:/home/ugo/NetBeansProjects/uFTP/ftpData.h</file>
|
||||||
<file>file:/home/ugo/NetBeansProjects/uFTP/library/configRead.c</file>
|
<file>file:/home/ugo/NetBeansProjects/uFTP/library/configRead.c</file>
|
||||||
</group>
|
</group>
|
||||||
</open-files>
|
</open-files>
|
||||||
|
3
uFTP.c
3
uFTP.c
@ -26,13 +26,10 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "ftpServer.h"
|
#include "ftpServer.h"
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
signal(SIGPIPE, signal_callback_handler);
|
|
||||||
|
|
||||||
runFtpServer();
|
runFtpServer();
|
||||||
return (EXIT_SUCCESS);
|
return (EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user