ypy705 / rt-n56u

Automatically exported from code.google.com/p/rt-n56u
0 stars 0 forks source link

vsftpd bug -> "STOR /directory/file" does not work #293

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use command line to log into the FTP-server
2. Do not change the directory! 
3. Use command "put file /AiDisk_b1/directory/file"

What is the expected output? What do you see instead?
EXPECTED: 150 Ok to send data & File receive OK.
INSTEAD ERROR: 550 Permission denied (restricted operation).

What version of the product are you using? On what operating system?
1.1.1.8f-b6 Same issue with previous versions and same issue with ASUS original 
firmware.

Logfile:
May 23 19:32:08 vsftpd: Wed May 23 19:32:08 2012 [pid 1819] [ftpuser] FTP 
command: Client "192.168.1.2", "STOR /AiDisk_b1/highdir/lowdir/2.jpg"
May 23 19:32:08 vsftpd: Wed May 23 19:32:08 2012 [pid 1819] [ftpuser] FTP 
response: Client "192.168.1.2", "550 Permission denied (restricted operation).

As soon as you use the STOR command with a directory it fails. Therefore if you 
use Filezilla you will not notice the issue, because you change the directory 
first.

Please see attached "FTP STOR COMMAND DOES NOT WORK CORRECTLY.pdf"

(In Germany a very popular application, called ONLINETVRECORDER is using the 
STOR command in the way I described.)

Original issue reported on code.google.com by h...@meine-fotos.info on 23 May 2012 at 9:04

Attachments:

GoogleCodeExporter commented 9 years ago
Ok. To what path are you trying to put the file?

To what directory should I change the path with filezilla?..

Original comment by d...@soulblader.com on 23 May 2012 at 9:25

GoogleCodeExporter commented 9 years ago
In the attachent you find an example of recreation with commandline:
put 2.jpg /AiDisk_b1/highdir/lowdir/2.jpg  
With command line I upload file 2.jpg to /AiDisk_b1/highdir/lowdir/2.jpg and 
give it the same name. FTP-Command is "STOR /AiDisk_b1/highdir/lowdir/2.jpg" 
--> FAIL 

With Filezilla you click with the mouse to go to directory /AiDisk and then to 
highdir and to lowdir and finally you move the file into the directory. With 
Filezilla NO PROBLEM, because the FTP-command is "STOR 2.jpg".  --> OK 

Original comment by h...@meine-fotos.info on 24 May 2012 at 4:15

GoogleCodeExporter commented 9 years ago
Perhaps my example is not clear, this is what ONLINETVRECODER in Germany does:

May 20 23:51:50 vsftpd: Sun May 20 23:51:50 2012 [pid 3884] [otruser] FTP 
response: Client "81.95.11.23", "331 Please specify the password."
May 20 23:51:50 vsftpd: Sun May 20 23:51:50 2012 [pid 3884] [otruser] FTP 
command: Client "81.95.11.23", "PASS <password>"
May 20 23:51:50 vsftpd: Sun May 20 23:51:50 2012 [pid 3883] [otruser] OK LOGIN: 
Client "81.95.11.23"
May 20 23:51:50 vsftpd: Sun May 20 23:51:50 2012 [pid 3885] [otruser] FTP 
response: Client "81.95.11.23", "230 Login successful."
May 20 23:51:50 vsftpd: Sun May 20 23:51:50 2012 [pid 3885] [otruser] FTP 
command: Client "81.95.11.23", "TYPE I"
May 20 23:51:50 vsftpd: Sun May 20 23:51:50 2012 [pid 3885] [otruser] FTP 
response: Client "81.95.11.23", "200 Switching to Binary mode."
May 20 23:51:50 vsftpd: Sun May 20 23:51:50 2012 [pid 3885] [otruser] FTP 
command: Client "81.95.11.23", "SIZE 
/AiDisk_b1/otruser/54701_Die_letzte_Spur_12.05.18_21-15_zdf_45_TVOON_DE.mpg.HQ.c
ut.mp4"
May 20 23:51:50 vsftpd: Sun May 20 23:51:50 2012 [pid 3885] [otruser] FTP 
response: Client "81.95.11.23", "550 Permission denied (restricted operation)."
May 20 23:51:50 vsftpd: Sun May 20 23:51:50 2012 [pid 3885] [otruser] FTP 
command: Client "81.95.11.23", "SIZE 
/AiDisk_b1/otruser/54701_Die_letzte_Spur_12.05.18_21-15_zdf_45_TVOON_DE.mpg.HQ.c
ut.mp4"
May 20 23:51:50 vsftpd: Sun May 20 23:51:50 2012 [pid 3885] [otruser] FTP 
response: Client "81.95.11.23", "550 Permission denied (restricted operation)."
May 20 23:51:50 vsftpd: Sun May 20 23:51:50 2012 [pid 3885] [otruser] FTP 
command: Client "81.95.11.23", "PORT 81,95,11,23,133,11"
May 20 23:51:50 vsftpd: Sun May 20 23:51:50 2012 [pid 3885] [otruser] FTP 
response: Client "81.95.11.23", "200 PORT command successful. Consider using 
PASV."
May 20 23:51:50 vsftpd: Sun May 20 23:51:50 2012 [pid 3885] [otruser] FTP 
command: Client "81.95.11.23", "STOR 
/AiDisk_b1/otruser/54701_Die_letzte_Spur_12.05.18_21-15_zdf_45_TVOON_DE.mpg.HQ.c
ut.mp4"
May 20 23:51:50 vsftpd: Sun May 20 23:51:50 2012 [pid 3885] [otruser] FTP 
response: Client "81.95.11.23", "550 Permission denied (restricted operation)."
May 20 23:51:58 vsftpd: Sun May 20 23:51:58 2012 [pid 3885] [otruser] FTP 
command: Client "81.95.11.23", "QUIT"
May 20 23:51:58 vsftpd: Sun May 20 23:51:58 2012 [pid 3885] [otruser] FTP 
response: Client "81.95.11.23", "221 Goodbye."

It always fails if it is attempted to put a file in a directory.

Original comment by h...@meine-fotos.info on 24 May 2012 at 4:37

GoogleCodeExporter commented 9 years ago
Let me ask - does the user have the rights to write to this directory? 
Maybe chmod 777 /AiDisk_b1/highdir/lowdir will change the results?

Original comment by d...@soulblader.com on 24 May 2012 at 9:17

GoogleCodeExporter commented 9 years ago
Hi Soulblader,

it is already 777:

drwxrwxrwx    4 admin    admin         4096 May 23 17:50 .
drwxrwxrwx    4 admin    admin           80 Jan  1  2000 ..
-rw-rw-rw-    1 admin    admin           73 May 23 17:50 .__MediaServer_var.txt
-rw-rw-rw-    1 admin    admin           26 Jan  1  2000 .__folder_list.txt
-rw-rw-rw-    1 admin    admin           13 May 23 17:50 .__ftpuser_var.txt
drwxrwxrwx    3 admin    admin         4096 May 23 17:51 highdir
drwx------    2 admin    admin        16384 May 18 18:21 lost+found

/media/AiDisk_b1 #
/media/AiDisk_b1 # cd highdir
/media/AiDisk_b1/highdir # ls -al
drwxrwxrwx    3 admin    admin         4096 May 23 17:51 .
drwxrwxrwx    4 admin    admin         4096 May 23 17:50 ..
drwxrwxrwx    2 nobody   nobody        4096 May 23 19:47 lowdir
/media/AiDisk_b1/highdir # /media/AiDisk_b1 #

Regards,
Hans

Original comment by hans...@gmx.de on 24 May 2012 at 10:05

GoogleCodeExporter commented 9 years ago
I'm sorry but it seems I still haven't understood the problem.

Let me describe the things I've done just now.
1) Enabled FTP (I do not use it)
2) created the path /media/AiDisk_a1/test
3) checked the bits of the path
4) from my laptop:
  ftp> open 192.168.130.254 21
  username ....
  passwd ....

  Connected.

  ftp> cd ./AiDisk_a1/test
  ftp> put ./some_file

then connected by ssh 
/opt/home/admin # ls -la /media/AiDisk_a1/test
total 12
drwxrwxrwx  2 admin admin 4096 2012-05-24 23:02 .
drwxrwxrwx 15 admin admin 4096 2012-05-24 23:02 ..
-rw-rw-rw-  1     1     1  336 2012-05-24 23:02 some_file

So, it was uploaded fine. What is the problem here?..

Original comment by d...@soulblader.com on 24 May 2012 at 7:13

GoogleCodeExporter commented 9 years ago
Hi Soulblader,
My apologies if my explanations were not clear.
I have attached "ISSUE 293 RECREATION IN 4 STEPS.pdf" It is only 2 pages and 
contains the screenshots of the error recreation. Just try yourself!
Regards from Hamburg,
Hans

Original comment by hans...@gmx.de on 24 May 2012 at 7:19

Attachments:

GoogleCodeExporter commented 9 years ago
Hi Soulblader,
Ahaaa...  I see now.
To recreate, you must not change the directory but do:
ftp> pwd
257 "/"
ftp> put file2.txt ./AiDisk_b1/directory/file2.txt
200 PORT command successful. Consider using PASV.
550 Permission denied (restricted operation).

Regards,
Hans

Original comment by hans...@gmx.de on 24 May 2012 at 7:32

GoogleCodeExporter commented 9 years ago
Thank you, Hans. I've looked through the PDF file. The thing is I'm not sure 
ftp can put files to other dirs. I can't find info on this in the ftp man.
Just try to put file and then move it to the needed path, or first cd to this 
path and put the file.

ftp> put file2.txt

Original comment by d...@soulblader.com on 25 May 2012 at 5:21

GoogleCodeExporter commented 9 years ago
Hallo Andy,

Well, a good ftp-server can do that, below an example of the ftp-server at my 
work:
ftp> pwd
257 "/" is your current location
ftp> cd incoming
250 OK. Current directory is /incoming
ftp> mkdir hans
257 "hans" : The directory was successfully created
ftp> cd ..
250 OK. Current directory is /
ftp> pwd
257 "/" is your current location
ftp> put 1.txt /incoming/hans/1.txt
200 PORT command successful
150 Connecting to port 51188
226-265051.1 Mbytes free disk space
226-File successfully transferred
226 0.803 seconds (measured here), 109.75 Kbytes per second
ftp: 90580 bytes sent in 0.69Seconds 132.04Kbytes/sec.
ftp> cd incoming
250 OK. Current directory is /incoming
ftp> cd hans
250 OK. Current directory is /incoming/hans
ftp> dir
200 PORT command successful
150 Connecting to port 51200
-rw-r--r--    1 50       1100        90245 May 23 08:09 1.txt
226-Options: -l
226 1 matches total
ftp: 63 bytes received in 0.00Seconds 63000.00Kbytes/sec.
ftp>

So, on this good ftp-server I'm pushing the file 1.txt directly into 
"/incoming/hans", without changing the directory. 

Of course on the ASUS-ftp-server, if you change the directory first, the 
ASUS-ftp-server works. The issue is however: ONLINETVRECORDER does NOT change 
the directory!

What do you think? Shall I inform ASUS?
The ASUS-ftp-server seems to be confused with directories, you can see that if 
you use the SIZE command, see attachment "FTP STOR COMMAND DOES NOT WORK 
CORRECTLY.pdf"

Regards,
Hans

Original comment by hans...@gmx.de on 25 May 2012 at 5:44