static int list(int ctrlfd, char *cmdline)
{
char buf[BUFSIZ];
int n;
int fd,count;
fd = accept(pasv_socket, NULL, NULL);
close(pasv_socket);
FTP_CHECK_LOGIN();
ftp_send_resp(ctrlfd, 150);
system("dir > tmp.txt");
FILE *fin=fopen("tmp.txt","r"); char temp_buffer[80];
while (!feof(fin))
{
count = fread(temp_buffer,1,sizeof(temp_buffer),fin);
if(write(fd,temp_buffer,count) != count )
printf("c'est un problem");
printf("I am just tsting %s -------------- \n",temp_buffer);
}
fclose(fin);
close(fd);
ftp_send_resp(ctrlfd,226);
return 1;
}
What I have tried:
the function list must read from the directory the file names and then passes them to the ftp client through the socket
all the printing is accepted and all is correct the problem is that the file list is not showing in my filezilla maybe it is a problem of data type
I even tried wireshark on my loopback interface and the data is being sent!!!
please if anyone knows a solution to this problem please help me