mirror of
https://github.com/kingk85/uFTP.git
synced 2025-07-19 10:16:13 +03:00
fixed cd .. command on command line clients
This commit is contained in:
6
build/compile.sh
Executable file
6
build/compile.sh
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
cd ..
|
||||||
|
make clean
|
||||||
|
make
|
||||||
|
cd build
|
||||||
|
sudo killall uFTP
|
||||||
|
./uFTP
|
@ -737,8 +737,8 @@ void resetClientData(ftpDataType *data, int clientId, int isInitialization)
|
|||||||
int compareStringCaseInsensitive(char * stringIn, char * stringRef, int stringLenght)
|
int compareStringCaseInsensitive(char * stringIn, char * stringRef, int stringLenght)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
char * alfaLowerCase = "qwertyuiopasdfghjklzxcvbnm ";
|
char * alfaLowerCase = "qwertyuiopasdfghjklzxcvbnm .";
|
||||||
char * alfaUpperCase = "QWERTYUIOPASDFGHJKLZXCVBNM ";
|
char * alfaUpperCase = "QWERTYUIOPASDFGHJKLZXCVBNM .";
|
||||||
|
|
||||||
int stringInIndex;
|
int stringInIndex;
|
||||||
int stringRefIndex;
|
int stringRefIndex;
|
||||||
|
11
ftpServer.c
11
ftpServer.c
@ -859,16 +859,17 @@ static int processCommand(int processingElement)
|
|||||||
//printf("\nLIST COMMAND RECEIVED");
|
//printf("\nLIST COMMAND RECEIVED");
|
||||||
toReturn = parseCommandList(&ftpData, processingElement);
|
toReturn = parseCommandList(&ftpData, processingElement);
|
||||||
}
|
}
|
||||||
|
else if(compareStringCaseInsensitive(ftpData.clients[processingElement].theCommandReceived, "CDUP", strlen("CDUP")) == 1 ||
|
||||||
|
compareStringCaseInsensitive(ftpData.clients[processingElement].theCommandReceived, "CWD ..", strlen("CWD ..")) == 1)
|
||||||
|
{
|
||||||
|
//printf("\nCDUP COMMAND RECEIVED");
|
||||||
|
toReturn = parseCommandCdup(&ftpData, processingElement);
|
||||||
|
}
|
||||||
else if(compareStringCaseInsensitive(ftpData.clients[processingElement].theCommandReceived, "CWD", strlen("CWD")) == 1)
|
else if(compareStringCaseInsensitive(ftpData.clients[processingElement].theCommandReceived, "CWD", strlen("CWD")) == 1)
|
||||||
{
|
{
|
||||||
//printf("\nCWD COMMAND RECEIVED");
|
//printf("\nCWD COMMAND RECEIVED");
|
||||||
toReturn = parseCommandCwd(&ftpData, processingElement);
|
toReturn = parseCommandCwd(&ftpData, processingElement);
|
||||||
}
|
}
|
||||||
else if(compareStringCaseInsensitive(ftpData.clients[processingElement].theCommandReceived, "CDUP", strlen("CDUP")) == 1)
|
|
||||||
{
|
|
||||||
//printf("\nCDUP COMMAND RECEIVED");
|
|
||||||
toReturn = parseCommandCdup(&ftpData, processingElement);
|
|
||||||
}
|
|
||||||
else if(compareStringCaseInsensitive(ftpData.clients[processingElement].theCommandReceived, "REST", strlen("REST")) == 1)
|
else if(compareStringCaseInsensitive(ftpData.clients[processingElement].theCommandReceived, "REST", strlen("REST")) == 1)
|
||||||
{
|
{
|
||||||
//printf("\nREST COMMAND RECEIVED");
|
//printf("\nREST COMMAND RECEIVED");
|
||||||
|
@ -711,11 +711,12 @@ void FILE_DirectoryToParent(char ** sourceString, DYNMEM_MemoryTable_DataType **
|
|||||||
{
|
{
|
||||||
//printf("\n");
|
//printf("\n");
|
||||||
|
|
||||||
size_t theLastSlash = -1;
|
int theLastSlash = -1;
|
||||||
size_t strLen = 0;
|
size_t strLen = 0;
|
||||||
|
|
||||||
strLen = strlen(*sourceString);
|
strLen = strlen(*sourceString);
|
||||||
//printf("\nstrLen = %d", strLen);
|
//printf("\nThe directory = %s", (*sourceString));
|
||||||
|
//printf("\ndirectory to parent strLen = %d", strLen);
|
||||||
|
|
||||||
for (size_t i = 0; i < strLen; i++)
|
for (size_t i = 0; i < strLen; i++)
|
||||||
{
|
{
|
||||||
@ -723,9 +724,10 @@ void FILE_DirectoryToParent(char ** sourceString, DYNMEM_MemoryTable_DataType **
|
|||||||
if ( (*sourceString)[i] == '/')
|
if ( (*sourceString)[i] == '/')
|
||||||
{
|
{
|
||||||
theLastSlash = i;
|
theLastSlash = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//printf("\n theLastSlash = %d", theLastSlash);
|
//printf("\n theLastSlash = %d", theLastSlash);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (theLastSlash > -1)
|
if (theLastSlash > -1)
|
||||||
{
|
{
|
||||||
@ -734,8 +736,13 @@ void FILE_DirectoryToParent(char ** sourceString, DYNMEM_MemoryTable_DataType **
|
|||||||
{
|
{
|
||||||
theNewSize = 1;
|
theNewSize = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//printf("\n theNewSize = %d", theNewSize);
|
||||||
|
|
||||||
*sourceString = DYNMEM_realloc(*sourceString, theNewSize+1, &*memoryTable);
|
*sourceString = DYNMEM_realloc(*sourceString, theNewSize+1, &*memoryTable);
|
||||||
(*sourceString)[theNewSize] = '\0';
|
(*sourceString)[theNewSize] = '\0';
|
||||||
|
|
||||||
|
//printf("\nThe directory upped is = %s", (*sourceString));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user