mirror of
https://github.com/kingk85/uFTP.git
synced 2025-07-24 20:56:09 +03:00
Preprocessor condition for large file support on/off flag
This commit is contained in:
@ -22,7 +22,8 @@ OPTIMIZATION=-O3
|
||||
HEADERS=-I
|
||||
LIBPATH=./build/modules/
|
||||
BUILDFILES=start uFTP end
|
||||
DEFINITIONS=-D_LARGEFILE64_SOURCE
|
||||
#DEFINITIONS=-D_LARGEFILE64_SOURCE
|
||||
DEFINITIONS=
|
||||
|
||||
all: $(BUILDFILES)
|
||||
|
||||
|
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.
Binary file not shown.
Binary file not shown.
BIN
build/Release/GNU-Linux/ftpCommandElaborate.o
Normal file
BIN
build/Release/GNU-Linux/ftpCommandElaborate.o
Normal file
Binary file not shown.
22
build/Release/GNU-Linux/ftpCommandElaborate.o.d
Normal file
22
build/Release/GNU-Linux/ftpCommandElaborate.o.d
Normal file
@ -0,0 +1,22 @@
|
||||
build/Release/GNU-Linux/ftpCommandElaborate.o: ftpCommandElaborate.c \
|
||||
ftpData.h library/dynamicVectors.h ftpServer.h library/logFunctions.h \
|
||||
library/fileManagement.h library/dynamicVectors.h library/configRead.h \
|
||||
library/../ftpData.h ftpCommandsElaborate.h
|
||||
|
||||
ftpData.h:
|
||||
|
||||
library/dynamicVectors.h:
|
||||
|
||||
ftpServer.h:
|
||||
|
||||
library/logFunctions.h:
|
||||
|
||||
library/fileManagement.h:
|
||||
|
||||
library/dynamicVectors.h:
|
||||
|
||||
library/configRead.h:
|
||||
|
||||
library/../ftpData.h:
|
||||
|
||||
ftpCommandsElaborate.h:
|
BIN
build/Release/GNU-Linux/ftpData.o
Normal file
BIN
build/Release/GNU-Linux/ftpData.o
Normal file
Binary file not shown.
20
build/Release/GNU-Linux/ftpData.o.d
Normal file
20
build/Release/GNU-Linux/ftpData.o.d
Normal file
@ -0,0 +1,20 @@
|
||||
build/Release/GNU-Linux/ftpData.o: ftpData.c ftpServer.h \
|
||||
ftpCommandsElaborate.h ftpData.h library/dynamicVectors.h \
|
||||
library/configRead.h library/dynamicVectors.h library/../ftpData.h \
|
||||
library/fileManagement.h
|
||||
|
||||
ftpServer.h:
|
||||
|
||||
ftpCommandsElaborate.h:
|
||||
|
||||
ftpData.h:
|
||||
|
||||
library/dynamicVectors.h:
|
||||
|
||||
library/configRead.h:
|
||||
|
||||
library/dynamicVectors.h:
|
||||
|
||||
library/../ftpData.h:
|
||||
|
||||
library/fileManagement.h:
|
BIN
build/Release/GNU-Linux/ftpServer.o
Normal file
BIN
build/Release/GNU-Linux/ftpServer.o
Normal file
Binary file not shown.
26
build/Release/GNU-Linux/ftpServer.o.d
Normal file
26
build/Release/GNU-Linux/ftpServer.o.d
Normal file
@ -0,0 +1,26 @@
|
||||
build/Release/GNU-Linux/ftpServer.o: ftpServer.c ftpServer.h ftpData.h \
|
||||
library/dynamicVectors.h ftpCommandsElaborate.h library/fileManagement.h \
|
||||
library/dynamicVectors.h library/logFunctions.h library/configRead.h \
|
||||
library/../ftpData.h library/signals.h library/connection.h
|
||||
|
||||
ftpServer.h:
|
||||
|
||||
ftpData.h:
|
||||
|
||||
library/dynamicVectors.h:
|
||||
|
||||
ftpCommandsElaborate.h:
|
||||
|
||||
library/fileManagement.h:
|
||||
|
||||
library/dynamicVectors.h:
|
||||
|
||||
library/logFunctions.h:
|
||||
|
||||
library/configRead.h:
|
||||
|
||||
library/../ftpData.h:
|
||||
|
||||
library/signals.h:
|
||||
|
||||
library/connection.h:
|
BIN
build/Release/GNU-Linux/library/configRead.o
Normal file
BIN
build/Release/GNU-Linux/library/configRead.o
Normal file
Binary file not shown.
16
build/Release/GNU-Linux/library/configRead.o.d
Normal file
16
build/Release/GNU-Linux/library/configRead.o.d
Normal file
@ -0,0 +1,16 @@
|
||||
build/Release/GNU-Linux/library/configRead.o: library/configRead.c \
|
||||
library/configRead.h library/dynamicVectors.h library/../ftpData.h \
|
||||
library/../library/dynamicVectors.h library/fileManagement.h \
|
||||
library/daemon.h
|
||||
|
||||
library/configRead.h:
|
||||
|
||||
library/dynamicVectors.h:
|
||||
|
||||
library/../ftpData.h:
|
||||
|
||||
library/../library/dynamicVectors.h:
|
||||
|
||||
library/fileManagement.h:
|
||||
|
||||
library/daemon.h:
|
BIN
build/Release/GNU-Linux/library/connection.o
Normal file
BIN
build/Release/GNU-Linux/library/connection.o
Normal file
Binary file not shown.
9
build/Release/GNU-Linux/library/connection.o.d
Normal file
9
build/Release/GNU-Linux/library/connection.o.d
Normal file
@ -0,0 +1,9 @@
|
||||
build/Release/GNU-Linux/library/connection.o: library/connection.c \
|
||||
library/../ftpData.h library/../library/dynamicVectors.h \
|
||||
library/connection.h
|
||||
|
||||
library/../ftpData.h:
|
||||
|
||||
library/../library/dynamicVectors.h:
|
||||
|
||||
library/connection.h:
|
BIN
build/Release/GNU-Linux/library/daemon.o
Normal file
BIN
build/Release/GNU-Linux/library/daemon.o
Normal file
Binary file not shown.
6
build/Release/GNU-Linux/library/daemon.o.d
Normal file
6
build/Release/GNU-Linux/library/daemon.o.d
Normal file
@ -0,0 +1,6 @@
|
||||
build/Release/GNU-Linux/library/daemon.o: library/daemon.c \
|
||||
library/fileManagement.h library/dynamicVectors.h
|
||||
|
||||
library/fileManagement.h:
|
||||
|
||||
library/dynamicVectors.h:
|
BIN
build/Release/GNU-Linux/library/dynamicVectors.o
Normal file
BIN
build/Release/GNU-Linux/library/dynamicVectors.o
Normal file
Binary file not shown.
4
build/Release/GNU-Linux/library/dynamicVectors.o.d
Normal file
4
build/Release/GNU-Linux/library/dynamicVectors.o.d
Normal file
@ -0,0 +1,4 @@
|
||||
build/Release/GNU-Linux/library/dynamicVectors.o: \
|
||||
library/dynamicVectors.c library/dynamicVectors.h
|
||||
|
||||
library/dynamicVectors.h:
|
BIN
build/Release/GNU-Linux/library/fileManagement.o
Normal file
BIN
build/Release/GNU-Linux/library/fileManagement.o
Normal file
Binary file not shown.
7
build/Release/GNU-Linux/library/fileManagement.o.d
Normal file
7
build/Release/GNU-Linux/library/fileManagement.o.d
Normal file
@ -0,0 +1,7 @@
|
||||
build/Release/GNU-Linux/library/fileManagement.o: \
|
||||
library/fileManagement.c library/fileManagement.h \
|
||||
library/dynamicVectors.h
|
||||
|
||||
library/fileManagement.h:
|
||||
|
||||
library/dynamicVectors.h:
|
BIN
build/Release/GNU-Linux/library/logFunctions.o
Normal file
BIN
build/Release/GNU-Linux/library/logFunctions.o
Normal file
Binary file not shown.
4
build/Release/GNU-Linux/library/logFunctions.o.d
Normal file
4
build/Release/GNU-Linux/library/logFunctions.o.d
Normal file
@ -0,0 +1,4 @@
|
||||
build/Release/GNU-Linux/library/logFunctions.o: library/logFunctions.c \
|
||||
library/logFunctions.h
|
||||
|
||||
library/logFunctions.h:
|
BIN
build/Release/GNU-Linux/library/signals.o
Normal file
BIN
build/Release/GNU-Linux/library/signals.o
Normal file
Binary file not shown.
4
build/Release/GNU-Linux/library/signals.o.d
Normal file
4
build/Release/GNU-Linux/library/signals.o.d
Normal file
@ -0,0 +1,4 @@
|
||||
build/Release/GNU-Linux/library/signals.o: library/signals.c \
|
||||
library/../ftpServer.h
|
||||
|
||||
library/../ftpServer.h:
|
BIN
build/Release/GNU-Linux/uFTP.o
Normal file
BIN
build/Release/GNU-Linux/uFTP.o
Normal file
Binary file not shown.
3
build/Release/GNU-Linux/uFTP.o.d
Normal file
3
build/Release/GNU-Linux/uFTP.o.d
Normal file
@ -0,0 +1,3 @@
|
||||
build/Release/GNU-Linux/uFTP.o: uFTP.c ftpServer.h
|
||||
|
||||
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.
Binary file not shown.
BIN
build/uFTP
Executable file
BIN
build/uFTP
Executable file
Binary file not shown.
39
build/uftpd.cfg
Normal file
39
build/uftpd.cfg
Normal file
@ -0,0 +1,39 @@
|
||||
#FTP CONFIGURATION SAMPLE
|
||||
|
||||
#######################################################
|
||||
# UFTP SERVER SETTINGS #
|
||||
#######################################################
|
||||
|
||||
MAXIMUM_ALLOWED_FTP_CONNECTION = 30
|
||||
#MAXIMUM ALLOWED CONNECTIONS ON THE SERVER
|
||||
|
||||
FTP_PORT = 900
|
||||
#TCP/IP PORT SETTINGS (DEFAULT 21)
|
||||
|
||||
SINGLE_INSTANCE = false
|
||||
#Allow only one server instance (true or false)
|
||||
|
||||
DAEMON_MODE = false
|
||||
#Run in background, daemon mode ok
|
||||
|
||||
IDLE_MAX_TIMEOUT = 3600
|
||||
# Idle timeout in seconds, client are disconnected for inactivity after the
|
||||
# specified amount of time in seconds, set to 0 to disable
|
||||
|
||||
MAX_CONNECTION_NUMBER_PER_IP = 2
|
||||
#MAX CONNECTIONS PER IP
|
||||
#LIMIT THE MAXIMUM NUMBER OF CONNECTION FOR EACH IP ADDRESS
|
||||
# 0 TO DISABLE
|
||||
|
||||
MAX_CONNECTION_TRY_PER_IP = 3
|
||||
#MAX LOGIN TRY PER IP
|
||||
#THE IP ADDRESS WILL BE BLOCKED FOR 5 MINUTES AFTER WRONG LOGIN USERNAME AND PASSWORD
|
||||
#0 TO DISABLE
|
||||
|
||||
#USERS
|
||||
#START FROM USER 0 TO XXX
|
||||
USER_0 = root
|
||||
PASSWORD_0 = arm
|
||||
HOME_0 = /
|
||||
GROUP_NAME_OWNER_0 = root
|
||||
USER_NAME_OWNER_0 = root
|
BIN
dist/Debug/GNU-Linux/uftp
vendored
BIN
dist/Debug/GNU-Linux/uftp
vendored
Binary file not shown.
@ -903,7 +903,16 @@ long long int writeRetrFile(char * theFilename, int thePasvSocketConnection, lon
|
||||
long long int theFileSize;
|
||||
char buffer[FTP_COMMAND_ELABORATE_CHAR_BUFFER];
|
||||
|
||||
retrFP = fopen64(theFilename, "rb");
|
||||
|
||||
#ifdef _LARGEFILE64_SOURCE
|
||||
retrFP = fopen64(theFilename, "rb");
|
||||
#endif
|
||||
|
||||
#ifndef _LARGEFILE64_SOURCE
|
||||
retrFP = fopen(theFilename, "rb");
|
||||
#endif
|
||||
|
||||
|
||||
if (retrFP == NULL)
|
||||
{
|
||||
return -1;
|
||||
@ -914,7 +923,15 @@ long long int writeRetrFile(char * theFilename, int thePasvSocketConnection, lon
|
||||
if (startFrom > 0)
|
||||
{
|
||||
//printf("\nSeek startFrom: %d", startFrom);
|
||||
currentPosition = (long long int) lseek64(fileno(retrFP), startFrom, SEEK_SET);
|
||||
|
||||
#ifdef _LARGEFILE64_SOURCE
|
||||
currentPosition = (long long int) lseek64(fileno(retrFP), startFrom, SEEK_SET);
|
||||
#endif
|
||||
|
||||
#ifndef _LARGEFILE64_SOURCE
|
||||
currentPosition = (long long int) lseek(fileno(retrFP), startFrom, SEEK_SET);
|
||||
#endif
|
||||
|
||||
// printf("\nSeek result: %ld", currentPosition);
|
||||
if (currentPosition == -1)
|
||||
{
|
||||
@ -939,9 +956,6 @@ long long int writeRetrFile(char * theFilename, int thePasvSocketConnection, lon
|
||||
toReturn = toReturn + writtenSize;
|
||||
}
|
||||
}
|
||||
|
||||
//printf("\n Bytes written: %ld", toReturn);
|
||||
|
||||
fclose(retrFP);
|
||||
retrFP = NULL;
|
||||
return toReturn;
|
||||
@ -1141,4 +1155,4 @@ int setPermissions(char * permissionsCommand, char * basePath, ownerShip_DataTyp
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
11
ftpServer.c
11
ftpServer.c
@ -164,7 +164,16 @@ void *connectionWorkerHandle(void * socketId)
|
||||
compareStringCaseInsensitive(ftpData.clients[theSocketId].workerData.theCommandReceived, "STOR", strlen("STOR")) == 1 &&
|
||||
ftpData.clients[theSocketId].fileToStor.textLen > 0)
|
||||
{
|
||||
ftpData.clients[theSocketId].workerData.theStorFile = fopen64(ftpData.clients[theSocketId].fileToStor.text, "wb");
|
||||
|
||||
#ifdef _LARGEFILE64_SOURCE
|
||||
ftpData.clients[theSocketId].workerData.theStorFile = fopen64(ftpData.clients[theSocketId].fileToStor.text, "wb");
|
||||
#endif
|
||||
|
||||
#ifndef _LARGEFILE64_SOURCE
|
||||
ftpData.clients[theSocketId].workerData.theStorFile = fopen(ftpData.clients[theSocketId].fileToStor.text, "wb");
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
if (ftpData.clients[theSocketId].workerData.theStorFile == NULL)
|
||||
{
|
||||
|
@ -65,13 +65,21 @@ void configurationRead(ftpParameters_DataType *ftpParameters)
|
||||
|
||||
if (FILE_IsFile(LOCAL_CONFIGURATION_FILENAME) == 1)
|
||||
{
|
||||
printf("\nReading configuration from \n -> %s", LOCAL_CONFIGURATION_FILENAME);
|
||||
printf("\nReading configuration from \n -> %s \n", LOCAL_CONFIGURATION_FILENAME);
|
||||
|
||||
returnCode = readConfigurationFile(LOCAL_CONFIGURATION_FILENAME, &configParameters);
|
||||
|
||||
printf("\nDONE\n");
|
||||
|
||||
}
|
||||
else if (FILE_IsFile(DEFAULT_CONFIGURATION_FILENAME) == 1)
|
||||
{
|
||||
printf("\nReading configuration from \n -> %s", DEFAULT_CONFIGURATION_FILENAME);
|
||||
printf("\nReading configuration from \n -> %s\n", DEFAULT_CONFIGURATION_FILENAME);
|
||||
|
||||
returnCode = readConfigurationFile(DEFAULT_CONFIGURATION_FILENAME, &configParameters);
|
||||
|
||||
printf("\nDONE\n");
|
||||
|
||||
}
|
||||
|
||||
if (returnCode == 1)
|
||||
@ -149,7 +157,13 @@ static int readConfigurationFile(char *path, DYNV_VectorGenericDataType *paramet
|
||||
int theFileSize = 0;
|
||||
int i, state, nameIndex, valueIndex, allowSpacesInValue;
|
||||
char * theFileContent;
|
||||
|
||||
|
||||
printf("\n FILE_GetStringFromFile");
|
||||
|
||||
theFileSize = FILE_GetStringFromFile(path, &theFileContent);
|
||||
printf("\n FILE_GetStringFromFile Done");
|
||||
|
||||
|
||||
char name[PARAMETER_SIZE_LIMIT];
|
||||
char value[PARAMETER_SIZE_LIMIT];
|
||||
@ -296,7 +310,8 @@ static int readConfigurationFile(char *path, DYNV_VectorGenericDataType *paramet
|
||||
nameIndex = 0;
|
||||
valueIndex = 0;
|
||||
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));
|
||||
}
|
||||
break;
|
||||
@ -318,7 +333,8 @@ static int readConfigurationFile(char *path, DYNV_VectorGenericDataType *paramet
|
||||
memset(value, 0, PARAMETER_SIZE_LIMIT);
|
||||
nameIndex = 0;
|
||||
valueIndex = 0;
|
||||
//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));
|
||||
}
|
||||
|
||||
|
@ -91,39 +91,85 @@ long int FILE_GetAvailableSpace(const char* path)
|
||||
/* Get the file size */
|
||||
long long int FILE_GetFileSize(FILE *TheFilePointer)
|
||||
{
|
||||
#ifdef _LARGEFILE64_SOURCE
|
||||
long long int Prev = 0, TheFileSize = 0;
|
||||
Prev = ftello64(TheFilePointer);
|
||||
fseeko64(TheFilePointer, 0, SEEK_END);
|
||||
TheFileSize = ftello64(TheFilePointer);
|
||||
fseeko64(TheFilePointer, Prev, SEEK_SET);
|
||||
return TheFileSize;
|
||||
#endif
|
||||
|
||||
#ifndef _LARGEFILE64_SOURCE
|
||||
long long int Prev = 0, TheFileSize = 0;
|
||||
Prev = ftell(TheFilePointer);
|
||||
fseek(TheFilePointer, 0, SEEK_END);
|
||||
TheFileSize = ftell(TheFilePointer);
|
||||
fseek(TheFilePointer, Prev, SEEK_SET);
|
||||
return TheFileSize;
|
||||
#endif
|
||||
}
|
||||
|
||||
long long int FILE_GetFileSizeFromPath(char *TheFileName)
|
||||
{
|
||||
if (FILE_IsFile(TheFileName) == 1)
|
||||
{
|
||||
FILE *TheFilePointer;
|
||||
TheFilePointer = fopen64(TheFileName, "rb");
|
||||
long long int Prev = 0, TheFileSize = 0;
|
||||
Prev = ftello64(TheFilePointer);
|
||||
fseeko64(TheFilePointer, 0L, SEEK_END);
|
||||
TheFileSize = ftello64(TheFilePointer);
|
||||
fseeko64(TheFilePointer, Prev, SEEK_SET);
|
||||
fclose(TheFilePointer);
|
||||
return TheFileSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef _LARGEFILE64_SOURCE
|
||||
if (FILE_IsFile(TheFileName) == 1)
|
||||
{
|
||||
FILE *TheFilePointer;
|
||||
TheFilePointer = fopen64(TheFileName, "rb");
|
||||
long long int Prev = 0, TheFileSize = 0;
|
||||
Prev = ftello64(TheFilePointer);
|
||||
fseeko64(TheFilePointer, 0L, SEEK_END);
|
||||
TheFileSize = ftello64(TheFilePointer);
|
||||
fseeko64(TheFilePointer, Prev, SEEK_SET);
|
||||
fclose(TheFilePointer);
|
||||
return TheFileSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef _LARGEFILE64_SOURCE
|
||||
if (FILE_IsFile(TheFileName) == 1)
|
||||
{
|
||||
FILE *TheFilePointer;
|
||||
TheFilePointer = fopen(TheFileName, "rb");
|
||||
long long int Prev = 0, TheFileSize = 0;
|
||||
Prev = ftell(TheFilePointer);
|
||||
fseek(TheFilePointer, 0L, SEEK_END);
|
||||
TheFileSize = ftell(TheFilePointer);
|
||||
fseek(TheFilePointer, Prev, SEEK_SET);
|
||||
fclose(TheFilePointer);
|
||||
return TheFileSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* Check if a file is valid */
|
||||
int FILE_IsFile(const char *TheFileName)
|
||||
{
|
||||
FILE *TheFile;
|
||||
TheFile = fopen64(TheFileName, "rb");
|
||||
|
||||
#ifdef _LARGEFILE64_SOURCE
|
||||
TheFile = fopen64(TheFileName, "rb");
|
||||
#endif
|
||||
|
||||
#ifndef _LARGEFILE64_SOURCE
|
||||
TheFile = fopen(TheFileName, "rb");
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
if (TheFile != NULL)
|
||||
{
|
||||
@ -222,7 +268,14 @@ int FILE_GetStringFromFile(char * filename, char **file_content)
|
||||
return 0;
|
||||
}
|
||||
|
||||
FILE *file = fopen(filename, "rb");
|
||||
|
||||
#ifdef _LARGEFILE64_SOURCE
|
||||
FILE *file = fopen64(filename, "rb");
|
||||
#endif
|
||||
|
||||
#ifndef _LARGEFILE64_SOURCE
|
||||
FILE *file = fopen(filename, "rb");
|
||||
#endif
|
||||
|
||||
if (file == NULL)
|
||||
{
|
||||
@ -232,6 +285,8 @@ int FILE_GetStringFromFile(char * filename, char **file_content)
|
||||
|
||||
file_size = FILE_GetFileSize(file);
|
||||
|
||||
|
||||
|
||||
count = 0;
|
||||
*file_content = (char *) malloc(file_size * sizeof(char) + 100);
|
||||
|
||||
@ -240,8 +295,14 @@ int FILE_GetStringFromFile(char * filename, char **file_content)
|
||||
(*file_content)[count++] = (char) c;
|
||||
}
|
||||
(*file_content)[count] = '\0';
|
||||
|
||||
|
||||
|
||||
fclose(file);
|
||||
return (count);
|
||||
|
||||
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
void FILE_ReadStringParameters(char * filename, DYNV_VectorGenericDataType *ParametersVector)
|
||||
@ -505,7 +566,6 @@ char * FILE_GetGroupOwner(char *fileName)
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
|
||||
time_t FILE_GetLastModifiedData(char *path)
|
||||
{
|
||||
struct stat statbuf;
|
||||
@ -553,7 +613,6 @@ void FILE_DirectoryToParent(char ** sourceString)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int FILE_LockFile(int fd)
|
||||
{
|
||||
struct flock fl;
|
||||
@ -564,7 +623,6 @@ int FILE_LockFile(int fd)
|
||||
return(fcntl(fd, F_SETLK, &fl));
|
||||
}
|
||||
|
||||
|
||||
int FILE_doChownFromUidGid(const char *file_path, uid_t uid, gid_t gid)
|
||||
{
|
||||
if (chown(file_path, uid, gid) == -1)
|
||||
@ -606,7 +664,6 @@ int FILE_doChownFromUidGidString ( const char *file_path,
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
uid_t FILE_getUID(const char *user_name)
|
||||
{
|
||||
struct passwd *pwd;
|
||||
@ -630,4 +687,4 @@ gid_t FILE_getGID(const char *group_name)
|
||||
}
|
||||
|
||||
return grp->gr_gid;
|
||||
}
|
||||
}
|
||||
|
51
uftpd.cfg
Normal file
51
uftpd.cfg
Normal file
@ -0,0 +1,51 @@
|
||||
#FTP CONFIGURATION SAMPLE
|
||||
|
||||
#######################################################
|
||||
# UFTP SERVER SETTINGS #
|
||||
#######################################################
|
||||
|
||||
MAXIMUM_ALLOWED_FTP_CONNECTION = 30
|
||||
#MAXIMUM ALLOWED CONNECTIONS ON THE SERVER
|
||||
|
||||
FTP_PORT = 21
|
||||
#TCP/IP PORT SETTINGS (DEFAULT 21)
|
||||
|
||||
SINGLE_INSTANCE = true
|
||||
#Allow only one server instance (true or false)
|
||||
|
||||
DAEMON_MODE = true
|
||||
#Run in background, daemon mode ok
|
||||
|
||||
IDLE_MAX_TIMEOUT = 3600
|
||||
# Idle timeout in seconds, client are disconnected for inactivity after the
|
||||
# specified amount of time in seconds, set to 0 to disable
|
||||
|
||||
|
||||
MAX_CONNECTION_NUMBER_PER_IP = 2
|
||||
#MAX CONNECTIONS PER IP
|
||||
#LIMIT THE MAXIMUM NUMBER OF CONNECTION FOR EACH IP ADDRESS
|
||||
# 0 TO DISABLE
|
||||
|
||||
|
||||
MAX_CONNECTION_TRY_PER_IP = 3
|
||||
#MAX LOGIN TRY PER IP
|
||||
#THE IP ADDRESS WILL BE BLOCKED FOR 5 MINUTES AFTER WRONG LOGIN USERNAME AND PASSWORD
|
||||
#0 TO DISABLE
|
||||
|
||||
#USERS
|
||||
#START FROM USER 0 TO XXX
|
||||
USER_0 = username
|
||||
PASSWORD_0 = password
|
||||
HOME_0 = /
|
||||
GROUP_NAME_OWNER_0 = usergroup
|
||||
USER_NAME_OWNER_0 = user
|
||||
|
||||
USER_1 = apache
|
||||
PASSWORD_1 = apachePassword
|
||||
HOME_1 = /var/www/html/
|
||||
GROUP_NAME_OWNER_1 = www-data
|
||||
USER_NAME_OWNER_1 = www-data
|
||||
|
||||
USER_2 = anotherUsername
|
||||
PASSWORD_2 = anotherPassowrd
|
||||
HOME_2 = /
|
Reference in New Issue
Block a user