removed some printf

This commit is contained in:
Ugo Cirmignani
2018-12-31 16:43:43 +01:00
parent f1f0d6000a
commit e7757348bd
14 changed files with 24 additions and 29 deletions

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.

View File

@ -157,7 +157,7 @@ int parseCommandPass(ftpDataType * data, int socketId)
if (strlen(thePass) >= 1)
{
printf("\nLogin try with user %s, password %s", data->clients[socketId].login.name.text, thePass);
//printf("\nLogin try with user %s, password %s", data->clients[socketId].login.name.text, thePass);
//PAM AUTH METHOD IF ENABLED
if (data->ftpParameters.pamAuthEnabled == 1)
@ -165,7 +165,7 @@ int parseCommandPass(ftpDataType * data, int socketId)
loginCheck( data->clients[socketId].login.name.text, thePass, &data->clients[socketId].login, &data->clients[socketId].memoryTable);
if (data->clients[socketId].login.userLoggedIn == 1)
{
printf("\n User logged with PAM ok!");
//printf("\n User logged with PAM ok!");
returnCode = socketPrintf(data, socketId, "s", "230 Login Ok.\r\n");
if (returnCode <= 0)
return FTP_COMMAND_PROCESSED_WRITE_ERROR;
@ -291,7 +291,7 @@ int parseCommandAuth(ftpDataType * data, int socketId)
int parseCommandPwd(ftpDataType * data, int socketId)
{
printf("\n pwd is %s", data->clients[socketId].login.ftpPath.text);
//printf("\n pwd is %s", data->clients[socketId].login.ftpPath.text);
int returnCode;
returnCode = socketPrintf(data, socketId, "sss", "257 \"", data->clients[socketId].login.ftpPath.text ,"\" is your current location\r\n");
@ -745,18 +745,18 @@ int parseCommandCwd(ftpDataType * data, int socketId)
thePath = getFtpCommandArg("CWD", data->clients[socketId].theCommandReceived, 0);
printf("\ncdw requested path: %s", thePath);
//printf("\ncdw requested path: %s", thePath);
if (strlen(thePath) > 0)
{
//printf("Memory data address 1st call : %lld", &data->clients[socketId].memoryTable);
isSafePath = getSafePath(&theSafePath, thePath, &data->clients[socketId].login, &data->clients[socketId].memoryTable);
printf("\ncdw safe path: %s", theSafePath.text);
//printf("\ncdw safe path: %s", theSafePath.text);
}
if (isSafePath == 1)
{
printf("\n The Path requested for CWD IS:%s", theSafePath.text);
//printf("\n The Path requested for CWD IS:%s", theSafePath.text);
setDynamicStringDataType(&absolutePathPrevious, data->clients[socketId].login.absolutePath.text, data->clients[socketId].login.absolutePath.textLen, &data->clients[socketId].memoryTable);
setDynamicStringDataType(&ftpPathPrevious, data->clients[socketId].login.ftpPath.text, data->clients[socketId].login.ftpPath.textLen, &data->clients[socketId].memoryTable);
@ -784,10 +784,9 @@ int parseCommandCwd(ftpDataType * data, int socketId)
}
printf("\ndata->clients[socketId].login.absolutePath = %s", data->clients[socketId].login.absolutePath.text);
printf("\ndata->clients[socketId].login.ftpPath = %s", data->clients[socketId].login.ftpPath.text);
printf("\nChecking the directory: %s", data->clients[socketId].login.absolutePath.text);
fflush(0);
// printf("\ndata->clients[socketId].login.absolutePath = %s", data->clients[socketId].login.absolutePath.text);
// printf("\ndata->clients[socketId].login.ftpPath = %s", data->clients[socketId].login.ftpPath.text);
// printf("\nChecking the directory: %s", data->clients[socketId].login.absolutePath.text);

View File

@ -722,7 +722,7 @@ static int processCommand(int processingElement)
{
int toReturn = 0;
//printTimeStamp();
printf ("\nCommand received from (%d): %s", processingElement, ftpData.clients[processingElement].theCommandReceived);
//printf ("\nCommand received from (%d): %s", processingElement, ftpData.clients[processingElement].theCommandReceived);
cleanDynamicStringDataType(&ftpData.clients[processingElement].ftpCommand.commandArgs, 0, &ftpData.clients[processingElement].memoryTable);
cleanDynamicStringDataType(&ftpData.clients[processingElement].ftpCommand.commandOps, 0, &ftpData.clients[processingElement].memoryTable);

View File

@ -107,13 +107,13 @@ void loginCheck(char *name, char *password, loginDataType *login, DYNMEM_MemoryT
login->ownerShip.ownerShipSet = 1;
login->userLoggedIn = 1;
printf("\nLogin as: %s", pass->pw_name);
printf("\nPasswd: %s", pass->pw_passwd);
printf("\nDir: %s", pass->pw_dir);
printf("\nGid: %d", pass->pw_gid);
printf("\nUid: %d", pass->pw_uid);
printf("\nlogin->homePath.text: %s", login->homePath.text);
printf("\nlogin->absolutePath.text: %s", login->absolutePath.text);
// printf("\nLogin as: %s", pass->pw_name);
// printf("\nPasswd: %s", pass->pw_passwd);
// printf("\nDir: %s", pass->pw_dir);
// printf("\nGid: %d", pass->pw_gid);
// printf("\nUid: %d", pass->pw_uid);
// printf("\nlogin->homePath.text: %s", login->homePath.text);
// printf("\nlogin->absolutePath.text: %s", login->absolutePath.text);
}
}
else

View File

@ -146,7 +146,6 @@ void initFtpData(ftpDataType *ftpData)
//printf("\nDYNMEM_malloc called");
//printf("\nElement location: %ld", (long int) ftpData->generalDynamicMemoryTable);
//fflush(0);
//printf("\nElement size: %ld", ftpData->generalDynamicMemoryTable->size);
//printf("\nElement address: %ld", (long int) ftpData->generalDynamicMemoryTable->address);
//printf("\nElement nextElement: %ld",(long int) ftpData->generalDynamicMemoryTable->nextElement);

View File

@ -52,7 +52,7 @@ int socketPrintf(ftpDataType * ftpData, int clientId, const char *__restrict __f
int theStringSize = 0, theCommandSize = 0;
memset(&theBuffer, 0, SOCKET_PRINTF_BUFFER);
memset(&commandBuffer, 0, COMMAND_BUFFER);
printf("\nWriting to socket id %d, TLS %d: ", clientId, ftpData->clients[clientId].tlsIsEnabled);
//printf("\nWriting to socket id %d, TLS %d: ", clientId, ftpData->clients[clientId].tlsIsEnabled);
pthread_mutex_lock(&ftpData->clients[clientId].writeMutex);
@ -140,7 +140,7 @@ int socketPrintf(ftpDataType * ftpData, int clientId, const char *__restrict __f
#endif
}
printf("\n%s", commandBuffer);
//printf("\n%s", commandBuffer);
pthread_mutex_unlock(&ftpData->clients[clientId].writeMutex);

View File

@ -129,7 +129,6 @@ void *DYNMEM_realloc(void *theMemoryAddress, size_t bytes, DYNMEM_MemoryTable_Da
if(!found)
{
//fflush(0);
//Debug TRAP
//char *theData ="c";
//strcpy(theData, "NOOOOOOOOOOOOOOOO");
@ -183,7 +182,6 @@ void DYNMEM_free(void *f_address, DYNMEM_MemoryTable_DataType ** memoryListHead)
if(!found)
{
//printf("\n\nMemory address : %ld not found\n\n", f_address);
//fflush(0);
//Debug TRAP
//char *theData ="c";
//strcpy(theData, "ciaociaociao");

View File

@ -585,8 +585,7 @@ int checkParentDirectoryPermissions(char *fileName, int uid, int gid)
theFileName[theFileNameLen++] = fileName[i];
}
printf ("\n checking parent permissions on : %s", theFileName);
fflush(0);
//printf ("\n checking parent permissions on : %s", theFileName);
return checkUserFilePermissions(theFileName, uid, gid);
}
@ -596,7 +595,7 @@ int checkUserFilePermissions(char *fileName, int uid, int gid)
if (uid == 0 || gid == 0)
{
printf("\n User is root");
//printf("\n User is root");
return FILE_PERMISSION_RW;
}
@ -621,19 +620,19 @@ int checkUserFilePermissions(char *fileName, int uid, int gid)
if (info.st_uid == uid ||
info.st_gid == gid)
{
printf("\n User is owner");
//printf("\n User is owner");
filePermissions = FILE_PERMISSION_RW;
}
else
{
mode_t perm = info.st_mode;
if ((perm & S_IROTH)){
printf("\nfile can be readen");
//printf("\nfile can be readen");
filePermissions |= FILE_PERMISSION_R;
}
if ((perm & S_IWOTH)){
printf("\nfile can be written");
//printf("\nfile can be written");
filePermissions |= FILE_PERMISSION_W;
}
}