mirror of
https://github.com/kingk85/uFTP.git
synced 2025-04-20 00:18:57 +03:00
TLS prototype test
This commit is contained in:
@ -11,6 +11,7 @@ OPTIMIZATION=-O3
|
|||||||
HEADERS=-I
|
HEADERS=-I
|
||||||
LIBPATH=./build/modules/
|
LIBPATH=./build/modules/
|
||||||
BUILDFILES=start uFTP end
|
BUILDFILES=start uFTP end
|
||||||
|
LIBS=-lpthread -lssl -lcrypto
|
||||||
|
|
||||||
#DEFINITIONS=
|
#DEFINITIONS=
|
||||||
|
|
||||||
@ -29,14 +30,17 @@ 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 signals.o connection.o
|
uFTP: uFTP.c fileManagement.o configRead.o logFunctions.o ftpCommandElaborate.o ftpData.o ftpServer.o daemon.o signals.o connection.o openSsl.o
|
||||||
@$(CC) $(DEFINITIONS) 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 $(LIBPATH)connection.o -o $(OUTPATH)uFTP -lpthread
|
@$(CC) $(DEFINITIONS) 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 $(LIBPATH)connection.o $(LIBPATH)openSsl.o -o $(OUTPATH)uFTP $(LIBS)
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
dynamicVectors.o:
|
dynamicVectors.o:
|
||||||
@$(CC) $(CFLAGS) $(SOURCE_MODULES_PATH)dynamicVectors.c -o $(LIBPATH)dynamicVectors.o
|
@$(CC) $(CFLAGS) $(SOURCE_MODULES_PATH)dynamicVectors.c -o $(LIBPATH)dynamicVectors.o
|
||||||
|
|
||||||
|
openSsl.o:
|
||||||
|
@$(CC) $(CFLAGS) $(SOURCE_MODULES_PATH)openSsl.c -o $(LIBPATH)openSsl.o
|
||||||
|
|
||||||
configRead.o: dynamicVectors.o fileManagement.o
|
configRead.o: dynamicVectors.o fileManagement.o
|
||||||
@$(CC) $(CFLAGS) $(SOURCE_MODULES_PATH)configRead.c -o $(LIBPATH)configRead.o
|
@$(CC) $(CFLAGS) $(SOURCE_MODULES_PATH)configRead.c -o $(LIBPATH)configRead.o
|
||||||
@ -59,7 +63,7 @@ ftpCommandElaborate.o:
|
|||||||
ftpData.o:
|
ftpData.o:
|
||||||
@$(CC) $(CFLAGS) ftpData.c -o $(LIBPATH)ftpData.o
|
@$(CC) $(CFLAGS) ftpData.c -o $(LIBPATH)ftpData.o
|
||||||
|
|
||||||
ftpServer.o:
|
ftpServer.o: openSsl.o
|
||||||
@$(CC) $(CFLAGS) ftpServer.c -o $(LIBPATH)ftpServer.o
|
@$(CC) $(CFLAGS) ftpServer.c -o $(LIBPATH)ftpServer.o
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
Binary file not shown.
@ -1,29 +0,0 @@
|
|||||||
build/Debug/GNU-Linux/ftpCommandElaborate.o: ftpCommandElaborate.c \
|
|
||||||
library/dynamicVectors.h library/fileManagement.h \
|
|
||||||
library/dynamicVectors.h ftpData.h library/dynamicVectors.h ftpServer.h \
|
|
||||||
library/logFunctions.h library/fileManagement.h library/configRead.h \
|
|
||||||
library/dynamicVectors.h library/../ftpData.h ftpCommandsElaborate.h
|
|
||||||
|
|
||||||
library/dynamicVectors.h:
|
|
||||||
|
|
||||||
library/fileManagement.h:
|
|
||||||
|
|
||||||
library/dynamicVectors.h:
|
|
||||||
|
|
||||||
ftpData.h:
|
|
||||||
|
|
||||||
library/dynamicVectors.h:
|
|
||||||
|
|
||||||
ftpServer.h:
|
|
||||||
|
|
||||||
library/logFunctions.h:
|
|
||||||
|
|
||||||
library/fileManagement.h:
|
|
||||||
|
|
||||||
library/configRead.h:
|
|
||||||
|
|
||||||
library/dynamicVectors.h:
|
|
||||||
|
|
||||||
library/../ftpData.h:
|
|
||||||
|
|
||||||
ftpCommandsElaborate.h:
|
|
Binary file not shown.
@ -1,27 +0,0 @@
|
|||||||
build/Debug/GNU-Linux/ftpData.o: ftpData.c library/dynamicVectors.h \
|
|
||||||
library/fileManagement.h library/dynamicVectors.h ftpServer.h \
|
|
||||||
ftpCommandsElaborate.h ftpData.h library/dynamicVectors.h \
|
|
||||||
library/configRead.h library/dynamicVectors.h library/../ftpData.h \
|
|
||||||
library/fileManagement.h
|
|
||||||
|
|
||||||
library/dynamicVectors.h:
|
|
||||||
|
|
||||||
library/fileManagement.h:
|
|
||||||
|
|
||||||
library/dynamicVectors.h:
|
|
||||||
|
|
||||||
ftpServer.h:
|
|
||||||
|
|
||||||
ftpCommandsElaborate.h:
|
|
||||||
|
|
||||||
ftpData.h:
|
|
||||||
|
|
||||||
library/dynamicVectors.h:
|
|
||||||
|
|
||||||
library/configRead.h:
|
|
||||||
|
|
||||||
library/dynamicVectors.h:
|
|
||||||
|
|
||||||
library/../ftpData.h:
|
|
||||||
|
|
||||||
library/fileManagement.h:
|
|
Binary file not shown.
@ -1,33 +0,0 @@
|
|||||||
build/Debug/GNU-Linux/ftpServer.o: ftpServer.c library/dynamicVectors.h \
|
|
||||||
library/fileManagement.h library/dynamicVectors.h ftpServer.h ftpData.h \
|
|
||||||
library/dynamicVectors.h ftpCommandsElaborate.h library/fileManagement.h \
|
|
||||||
library/logFunctions.h library/configRead.h library/dynamicVectors.h \
|
|
||||||
library/../ftpData.h library/signals.h library/connection.h
|
|
||||||
|
|
||||||
library/dynamicVectors.h:
|
|
||||||
|
|
||||||
library/fileManagement.h:
|
|
||||||
|
|
||||||
library/dynamicVectors.h:
|
|
||||||
|
|
||||||
ftpServer.h:
|
|
||||||
|
|
||||||
ftpData.h:
|
|
||||||
|
|
||||||
library/dynamicVectors.h:
|
|
||||||
|
|
||||||
ftpCommandsElaborate.h:
|
|
||||||
|
|
||||||
library/fileManagement.h:
|
|
||||||
|
|
||||||
library/logFunctions.h:
|
|
||||||
|
|
||||||
library/configRead.h:
|
|
||||||
|
|
||||||
library/dynamicVectors.h:
|
|
||||||
|
|
||||||
library/../ftpData.h:
|
|
||||||
|
|
||||||
library/signals.h:
|
|
||||||
|
|
||||||
library/connection.h:
|
|
Binary file not shown.
@ -1,23 +0,0 @@
|
|||||||
build/Debug/GNU-Linux/library/configRead.o: library/configRead.c \
|
|
||||||
library/dynamicVectors.h library/fileManagement.h \
|
|
||||||
library/dynamicVectors.h library/configRead.h library/dynamicVectors.h \
|
|
||||||
library/../ftpData.h library/../library/dynamicVectors.h \
|
|
||||||
library/fileManagement.h library/daemon.h
|
|
||||||
|
|
||||||
library/dynamicVectors.h:
|
|
||||||
|
|
||||||
library/fileManagement.h:
|
|
||||||
|
|
||||||
library/dynamicVectors.h:
|
|
||||||
|
|
||||||
library/configRead.h:
|
|
||||||
|
|
||||||
library/dynamicVectors.h:
|
|
||||||
|
|
||||||
library/../ftpData.h:
|
|
||||||
|
|
||||||
library/../library/dynamicVectors.h:
|
|
||||||
|
|
||||||
library/fileManagement.h:
|
|
||||||
|
|
||||||
library/daemon.h:
|
|
Binary file not shown.
@ -1,16 +0,0 @@
|
|||||||
build/Debug/GNU-Linux/library/connection.o: library/connection.c \
|
|
||||||
library/dynamicVectors.h library/fileManagement.h \
|
|
||||||
library/dynamicVectors.h library/../ftpData.h \
|
|
||||||
library/../library/dynamicVectors.h library/connection.h
|
|
||||||
|
|
||||||
library/dynamicVectors.h:
|
|
||||||
|
|
||||||
library/fileManagement.h:
|
|
||||||
|
|
||||||
library/dynamicVectors.h:
|
|
||||||
|
|
||||||
library/../ftpData.h:
|
|
||||||
|
|
||||||
library/../library/dynamicVectors.h:
|
|
||||||
|
|
||||||
library/connection.h:
|
|
Binary file not shown.
@ -1,11 +0,0 @@
|
|||||||
build/Debug/GNU-Linux/library/daemon.o: library/daemon.c \
|
|
||||||
library/dynamicVectors.h library/fileManagement.h \
|
|
||||||
library/dynamicVectors.h library/fileManagement.h
|
|
||||||
|
|
||||||
library/dynamicVectors.h:
|
|
||||||
|
|
||||||
library/fileManagement.h:
|
|
||||||
|
|
||||||
library/dynamicVectors.h:
|
|
||||||
|
|
||||||
library/fileManagement.h:
|
|
Binary file not shown.
@ -1,11 +0,0 @@
|
|||||||
build/Debug/GNU-Linux/library/dynamicVectors.o: library/dynamicVectors.c \
|
|
||||||
library/dynamicVectors.h library/fileManagement.h \
|
|
||||||
library/dynamicVectors.h library/dynamicVectors.h
|
|
||||||
|
|
||||||
library/dynamicVectors.h:
|
|
||||||
|
|
||||||
library/fileManagement.h:
|
|
||||||
|
|
||||||
library/dynamicVectors.h:
|
|
||||||
|
|
||||||
library/dynamicVectors.h:
|
|
Binary file not shown.
@ -1,14 +0,0 @@
|
|||||||
build/Debug/GNU-Linux/library/fileManagement.o: library/fileManagement.c \
|
|
||||||
library/dynamicVectors.h library/fileManagement.h \
|
|
||||||
library/dynamicVectors.h library/fileManagement.h \
|
|
||||||
library/dynamicVectors.h
|
|
||||||
|
|
||||||
library/dynamicVectors.h:
|
|
||||||
|
|
||||||
library/fileManagement.h:
|
|
||||||
|
|
||||||
library/dynamicVectors.h:
|
|
||||||
|
|
||||||
library/fileManagement.h:
|
|
||||||
|
|
||||||
library/dynamicVectors.h:
|
|
Binary file not shown.
@ -1,11 +0,0 @@
|
|||||||
build/Debug/GNU-Linux/library/logFunctions.o: library/logFunctions.c \
|
|
||||||
library/dynamicVectors.h library/fileManagement.h \
|
|
||||||
library/dynamicVectors.h library/logFunctions.h
|
|
||||||
|
|
||||||
library/dynamicVectors.h:
|
|
||||||
|
|
||||||
library/fileManagement.h:
|
|
||||||
|
|
||||||
library/dynamicVectors.h:
|
|
||||||
|
|
||||||
library/logFunctions.h:
|
|
Binary file not shown.
@ -1,11 +0,0 @@
|
|||||||
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.
@ -1,10 +0,0 @@
|
|||||||
build/Debug/GNU-Linux/uFTP.o: uFTP.c library/dynamicVectors.h \
|
|
||||||
library/fileManagement.h library/dynamicVectors.h ftpServer.h
|
|
||||||
|
|
||||||
library/dynamicVectors.h:
|
|
||||||
|
|
||||||
library/fileManagement.h:
|
|
||||||
|
|
||||||
library/dynamicVectors.h:
|
|
||||||
|
|
||||||
ftpServer.h:
|
|
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.
@ -40,6 +40,7 @@
|
|||||||
#include "library/logFunctions.h"
|
#include "library/logFunctions.h"
|
||||||
#include "library/fileManagement.h"
|
#include "library/fileManagement.h"
|
||||||
#include "library/configRead.h"
|
#include "library/configRead.h"
|
||||||
|
#include "library/openSsl.h"
|
||||||
#include "ftpCommandsElaborate.h"
|
#include "ftpCommandsElaborate.h"
|
||||||
|
|
||||||
|
|
||||||
@ -214,13 +215,29 @@ int parseCommandPass(ftpDataType * data, int socketId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int parseCommandAuth(clientDataType *theClientData)
|
int parseCommandAuth(clientDataType *theClientData, SSL_CTX *ctx)
|
||||||
{
|
{
|
||||||
int returnCode;
|
int returnCode;
|
||||||
returnCode = dprintf(theClientData->socketDescriptor, "502 Security extensions not implemented.\r\n");
|
//returnCode = dprintf(theClientData->socketDescriptor, "502 Security extensions not implemented.\r\n");
|
||||||
|
returnCode = dprintf(theClientData->socketDescriptor, "234 AUTH TLS OK..\r\n");
|
||||||
if (returnCode <= 0)
|
if (returnCode <= 0)
|
||||||
return FTP_COMMAND_PROCESSED_WRITE_ERROR;
|
return FTP_COMMAND_PROCESSED_WRITE_ERROR;
|
||||||
|
|
||||||
|
|
||||||
|
theClientData->tlsIsEnabled = 1;
|
||||||
|
SSL *ssl;
|
||||||
|
ssl = SSL_new(ctx);
|
||||||
|
SSL_set_fd(ssl, theClientData->socketDescriptor);
|
||||||
|
|
||||||
|
if (SSL_accept(ssl) <= 0) {
|
||||||
|
printf("\nSSL ERRORS");
|
||||||
|
ERR_print_errors_fp(stderr);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("\nSSL ACCEPTED");
|
||||||
|
SSL_write(ssl, "ciao prova\r\n", strlen("ciao prova\r\n"));
|
||||||
|
}
|
||||||
|
|
||||||
//client -> AUTH TLS
|
//client -> AUTH TLS
|
||||||
//server -> 234 AUTH TLS OK.
|
//server -> 234 AUTH TLS OK.
|
||||||
|
|
||||||
@ -272,7 +289,7 @@ int parseCommandFeat(clientDataType *theClientData)
|
|||||||
211 End.
|
211 End.
|
||||||
*/
|
*/
|
||||||
int returnCode;
|
int returnCode;
|
||||||
returnCode = dprintf(theClientData->socketDescriptor, "211-Extensions supported:\r\n PASV\r\nUTF8\r\n211 End.\r\n");
|
returnCode = dprintf(theClientData->socketDescriptor, "211-Extensions supported:\r\n PASV\r\nUTF8\r\nAUTH TLS\r\n211 End.\r\n");
|
||||||
if (returnCode <= 0)
|
if (returnCode <= 0)
|
||||||
return FTP_COMMAND_PROCESSED_WRITE_ERROR;
|
return FTP_COMMAND_PROCESSED_WRITE_ERROR;
|
||||||
|
|
||||||
|
@ -37,7 +37,8 @@
|
|||||||
#define FTP_CHMODE_COMMAND_RETURN_CODE_NO_FILE 2
|
#define FTP_CHMODE_COMMAND_RETURN_CODE_NO_FILE 2
|
||||||
#define FTP_CHMODE_COMMAND_RETURN_CODE_NO_PERMISSIONS 3
|
#define FTP_CHMODE_COMMAND_RETURN_CODE_NO_PERMISSIONS 3
|
||||||
#define FTP_CHMODE_COMMAND_RETURN_NAME_TOO_LONG 4
|
#define FTP_CHMODE_COMMAND_RETURN_NAME_TOO_LONG 4
|
||||||
|
#include <openssl/ssl.h>
|
||||||
|
#include <openssl/err.h>
|
||||||
#include "ftpData.h"
|
#include "ftpData.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@ -49,7 +50,7 @@ extern "C" {
|
|||||||
int parseCommandUser(clientDataType *theClientData);
|
int parseCommandUser(clientDataType *theClientData);
|
||||||
int parseCommandSite(clientDataType *theClientData);
|
int parseCommandSite(clientDataType *theClientData);
|
||||||
int parseCommandPass(ftpDataType * data, int socketId);
|
int parseCommandPass(ftpDataType * data, int socketId);
|
||||||
int parseCommandAuth(clientDataType *theClientData);
|
int parseCommandAuth(clientDataType *theClientData, SSL_CTX *);
|
||||||
int parseCommandPwd(clientDataType *theClientData);
|
int parseCommandPwd(clientDataType *theClientData);
|
||||||
int parseCommandSyst(clientDataType *theClientData);
|
int parseCommandSyst(clientDataType *theClientData);
|
||||||
int parseCommandFeat(clientDataType *theClientData);
|
int parseCommandFeat(clientDataType *theClientData);
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
#define FTPDATA_H
|
#define FTPDATA_H
|
||||||
|
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
#include <openssl/ssl.h>
|
||||||
|
#include <openssl/err.h>
|
||||||
#include "library/dynamicVectors.h"
|
#include "library/dynamicVectors.h"
|
||||||
|
|
||||||
|
|
||||||
@ -50,7 +52,6 @@ struct parameter
|
|||||||
char* value;
|
char* value;
|
||||||
} typedef parameter_DataType;
|
} typedef parameter_DataType;
|
||||||
|
|
||||||
|
|
||||||
struct ownerShip
|
struct ownerShip
|
||||||
{
|
{
|
||||||
int ownerShipSet;
|
int ownerShipSet;
|
||||||
@ -116,6 +117,8 @@ struct ipData
|
|||||||
|
|
||||||
struct workerData
|
struct workerData
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
int threadIsAlive;
|
int threadIsAlive;
|
||||||
int connectionPort;
|
int connectionPort;
|
||||||
int passiveModeOn;
|
int passiveModeOn;
|
||||||
@ -147,6 +150,9 @@ struct workerData
|
|||||||
|
|
||||||
struct clientData
|
struct clientData
|
||||||
{
|
{
|
||||||
|
SSL *ssl;
|
||||||
|
int tlsIsEnabled;
|
||||||
|
|
||||||
int clientProgressiveNumber;
|
int clientProgressiveNumber;
|
||||||
int socketDescriptor;
|
int socketDescriptor;
|
||||||
int socketIsConnected;
|
int socketIsConnected;
|
||||||
@ -202,6 +208,7 @@ struct ConnectionParameters
|
|||||||
|
|
||||||
struct ftpData
|
struct ftpData
|
||||||
{
|
{
|
||||||
|
|
||||||
int connectedClients;
|
int connectedClients;
|
||||||
char welcomeMessage[1024];
|
char welcomeMessage[1024];
|
||||||
ConnectionData_DataType connectionData;
|
ConnectionData_DataType connectionData;
|
||||||
|
46
ftpServer.c
46
ftpServer.c
@ -47,10 +47,11 @@
|
|||||||
#include "library/logFunctions.h"
|
#include "library/logFunctions.h"
|
||||||
#include "library/configRead.h"
|
#include "library/configRead.h"
|
||||||
#include "library/signals.h"
|
#include "library/signals.h"
|
||||||
|
#include "library/openSsl.h"
|
||||||
#include "library/connection.h"
|
#include "library/connection.h"
|
||||||
|
|
||||||
ftpDataType ftpData;
|
ftpDataType ftpData;
|
||||||
|
SSL_CTX *ctx;
|
||||||
static int processCommand(int processingElement);
|
static int processCommand(int processingElement);
|
||||||
|
|
||||||
void workerCleanup(void *socketId)
|
void workerCleanup(void *socketId)
|
||||||
@ -325,9 +326,11 @@ void *connectionWorkerHandle(void * socketId)
|
|||||||
|
|
||||||
void runFtpServer(void)
|
void runFtpServer(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
printf("\nHello uFTP server v%s starting..\n", UFTP_SERVER_VERSION);
|
printf("\nHello uFTP server v%s starting..\n", UFTP_SERVER_VERSION);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Needed for Select*/
|
/* Needed for Select*/
|
||||||
static int processingSock = 0, returnCode = 0;
|
static int processingSock = 0, returnCode = 0;
|
||||||
|
|
||||||
@ -352,6 +355,10 @@ void runFtpServer(void)
|
|||||||
|
|
||||||
/* the maximum socket fd is now the main socket descriptor */
|
/* the maximum socket fd is now the main socket descriptor */
|
||||||
ftpData.connectionData.maxSocketFD = ftpData.connectionData.theMainSocket+1;
|
ftpData.connectionData.maxSocketFD = ftpData.connectionData.theMainSocket+1;
|
||||||
|
|
||||||
|
init_openssl();
|
||||||
|
ctx = create_context();
|
||||||
|
configure_context(ctx);
|
||||||
|
|
||||||
//Endless loop ftp process
|
//Endless loop ftp process
|
||||||
while (1)
|
while (1)
|
||||||
@ -359,9 +366,7 @@ void runFtpServer(void)
|
|||||||
/* waits for socket activity, if no activity then checks for client socket timeouts */
|
/* waits for socket activity, if no activity then checks for client socket timeouts */
|
||||||
if (selectWait(&ftpData) == 0)
|
if (selectWait(&ftpData) == 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
checkClientConnectionTimeout(&ftpData);
|
checkClientConnectionTimeout(&ftpData);
|
||||||
|
|
||||||
flushLoginWrongTriesData(&ftpData);
|
flushLoginWrongTriesData(&ftpData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -518,7 +523,38 @@ static int processCommand(int processingElement)
|
|||||||
else if(compareStringCaseInsensitive(ftpData.clients[processingElement].theCommandReceived, "AUTH", strlen("AUTH")) == 1)
|
else if(compareStringCaseInsensitive(ftpData.clients[processingElement].theCommandReceived, "AUTH", strlen("AUTH")) == 1)
|
||||||
{
|
{
|
||||||
printf("\nAUTH COMMAND RECEIVED");
|
printf("\nAUTH COMMAND RECEIVED");
|
||||||
toReturn = parseCommandAuth(&ftpData.clients[processingElement]);
|
|
||||||
|
int returnCode;
|
||||||
|
//returnCode = dprintf(theClientData->socketDescriptor, "502 Security extensions not implemented.\r\n");
|
||||||
|
returnCode = dprintf(ftpData.clients[processingElement].socketDescriptor, "234 AUTH TLS OK..\r\n");
|
||||||
|
|
||||||
|
|
||||||
|
ftpData.clients[processingElement].tlsIsEnabled = 1;
|
||||||
|
SSL *ssl;
|
||||||
|
ssl = SSL_new(ctx);
|
||||||
|
SSL_set_fd(ssl, ftpData.clients[processingElement].socketDescriptor);
|
||||||
|
|
||||||
|
if (SSL_accept(ssl) <= 0) {
|
||||||
|
printf("\nSSL ERRORS");
|
||||||
|
ERR_print_errors_fp(stderr);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("\nSSL ACCEPTED");
|
||||||
|
SSL_write(ssl, "ciao prova\r\n", strlen("ciao prova\r\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
char buffer[100];
|
||||||
|
int readenb = 0;
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
readenb = SSL_read(ssl, buffer, 100);
|
||||||
|
if (readenb > 0)
|
||||||
|
printf("\nSslReaden: %s", buffer);
|
||||||
|
sleep(1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// toReturn = parseCommandAuth(&ftpData.clients[processingElement], ctx);
|
||||||
}
|
}
|
||||||
else if(compareStringCaseInsensitive(ftpData.clients[processingElement].theCommandReceived, "PWD", strlen("PWD")) == 1)
|
else if(compareStringCaseInsensitive(ftpData.clients[processingElement].theCommandReceived, "PWD", strlen("PWD")) == 1)
|
||||||
{
|
{
|
||||||
|
@ -44,6 +44,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/openSsl.o \
|
||||||
${OBJECTDIR}/library/signals.o \
|
${OBJECTDIR}/library/signals.o \
|
||||||
${OBJECTDIR}/uFTP.o
|
${OBJECTDIR}/uFTP.o
|
||||||
|
|
||||||
@ -117,6 +118,11 @@ ${OBJECTDIR}/library/logFunctions.o: library/logFunctions.c
|
|||||||
${RM} "$@.d"
|
${RM} "$@.d"
|
||||||
$(COMPILE.c) -g -D_LARGEFILE64_SOURCE -Ilibrary -include library/dynamicVectors.h -include library/fileManagement.h -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/library/logFunctions.o library/logFunctions.c
|
$(COMPILE.c) -g -D_LARGEFILE64_SOURCE -Ilibrary -include library/dynamicVectors.h -include library/fileManagement.h -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/library/logFunctions.o library/logFunctions.c
|
||||||
|
|
||||||
|
${OBJECTDIR}/library/openSsl.o: library/openSsl.c
|
||||||
|
${MKDIR} -p ${OBJECTDIR}/library
|
||||||
|
${RM} "$@.d"
|
||||||
|
$(COMPILE.c) -g -D_LARGEFILE64_SOURCE -Ilibrary -include library/dynamicVectors.h -include library/fileManagement.h -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/library/openSsl.o library/openSsl.c
|
||||||
|
|
||||||
${OBJECTDIR}/library/signals.o: library/signals.c
|
${OBJECTDIR}/library/signals.o: library/signals.c
|
||||||
${MKDIR} -p ${OBJECTDIR}/library
|
${MKDIR} -p ${OBJECTDIR}/library
|
||||||
${RM} "$@.d"
|
${RM} "$@.d"
|
||||||
|
@ -44,6 +44,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/openSsl.o \
|
||||||
${OBJECTDIR}/library/signals.o \
|
${OBJECTDIR}/library/signals.o \
|
||||||
${OBJECTDIR}/uFTP.o
|
${OBJECTDIR}/uFTP.o
|
||||||
|
|
||||||
@ -117,6 +118,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/openSsl.o: library/openSsl.c
|
||||||
|
${MKDIR} -p ${OBJECTDIR}/library
|
||||||
|
${RM} "$@.d"
|
||||||
|
$(COMPILE.c) -O2 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/library/openSsl.o library/openSsl.c
|
||||||
|
|
||||||
${OBJECTDIR}/library/signals.o: library/signals.c
|
${OBJECTDIR}/library/signals.o: library/signals.c
|
||||||
${MKDIR} -p ${OBJECTDIR}/library
|
${MKDIR} -p ${OBJECTDIR}/library
|
||||||
${RM} "$@.d"
|
${RM} "$@.d"
|
||||||
|
@ -10,6 +10,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/openSsl.h</itemPath>
|
||||||
<itemPath>library/signals.h</itemPath>
|
<itemPath>library/signals.h</itemPath>
|
||||||
</logicalFolder>
|
</logicalFolder>
|
||||||
<itemPath>library/daemon.h</itemPath>
|
<itemPath>library/daemon.h</itemPath>
|
||||||
@ -33,6 +34,7 @@
|
|||||||
<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/openSsl.c</itemPath>
|
||||||
<itemPath>library/signals.c</itemPath>
|
<itemPath>library/signals.c</itemPath>
|
||||||
</logicalFolder>
|
</logicalFolder>
|
||||||
<itemPath>MakeFileGeneric</itemPath>
|
<itemPath>MakeFileGeneric</itemPath>
|
||||||
@ -124,6 +126,10 @@
|
|||||||
</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/openSsl.c" ex="false" tool="0" flavor2="0">
|
||||||
|
</item>
|
||||||
|
<item path="library/openSsl.h" ex="false" tool="3" flavor2="0">
|
||||||
|
</item>
|
||||||
<item path="library/signals.c" ex="false" tool="0" flavor2="0">
|
<item path="library/signals.c" ex="false" tool="0" flavor2="0">
|
||||||
</item>
|
</item>
|
||||||
<item path="library/signals.h" ex="false" tool="3" flavor2="0">
|
<item path="library/signals.h" ex="false" tool="3" flavor2="0">
|
||||||
@ -197,6 +203,10 @@
|
|||||||
</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/openSsl.c" ex="false" tool="0" flavor2="0">
|
||||||
|
</item>
|
||||||
|
<item path="library/openSsl.h" ex="false" tool="3" flavor2="0">
|
||||||
|
</item>
|
||||||
<item path="library/signals.c" ex="false" tool="0" flavor2="0">
|
<item path="library/signals.c" ex="false" tool="0" flavor2="0">
|
||||||
</item>
|
</item>
|
||||||
<item path="library/signals.h" ex="false" tool="3" flavor2="0">
|
<item path="library/signals.h" ex="false" tool="3" flavor2="0">
|
||||||
|
@ -13,8 +13,6 @@
|
|||||||
<gdb_interceptlist>
|
<gdb_interceptlist>
|
||||||
<gdbinterceptoptions gdb_all="false" gdb_unhandled="true" gdb_unexpected="true"/>
|
<gdbinterceptoptions gdb_all="false" gdb_unhandled="true" gdb_unexpected="true"/>
|
||||||
</gdb_interceptlist>
|
</gdb_interceptlist>
|
||||||
<gdb_signals>
|
|
||||||
</gdb_signals>
|
|
||||||
<gdb_options>
|
<gdb_options>
|
||||||
<DebugOptions>
|
<DebugOptions>
|
||||||
</DebugOptions>
|
</DebugOptions>
|
||||||
|
@ -6,6 +6,16 @@
|
|||||||
</data>
|
</data>
|
||||||
<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/ftpData.c</file>
|
||||||
|
<file>file:/home/ugo/NetBeansProjects/uFTP/library/openSsl.h</file>
|
||||||
|
<file>file:/home/ugo/NetBeansProjects/uFTP/ftpCommandElaborate.c</file>
|
||||||
|
<file>file:/home/ugo/NetBeansProjects/uFTP/ftpServer.c</file>
|
||||||
|
<file>file:/home/ugo/NetBeansProjects/uFTP/MakeFileGeneric</file>
|
||||||
|
<file>file:/home/ugo/NetBeansProjects/uFTP/library/openSsl.c</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/ftpCommandsElaborate.h</file>
|
||||||
|
</group>
|
||||||
</open-files>
|
</open-files>
|
||||||
</project-private>
|
</project-private>
|
||||||
|
@ -13,7 +13,7 @@ FTP_PORT = 21
|
|||||||
SINGLE_INSTANCE = true
|
SINGLE_INSTANCE = true
|
||||||
#Allow only one server instance (true or false)
|
#Allow only one server instance (true or false)
|
||||||
|
|
||||||
DAEMON_MODE = true
|
DAEMON_MODE = false
|
||||||
#Run in background, daemon mode ok
|
#Run in background, daemon mode ok
|
||||||
|
|
||||||
IDLE_MAX_TIMEOUT = 3600
|
IDLE_MAX_TIMEOUT = 3600
|
||||||
|
Reference in New Issue
Block a user