eith0s / rutorrent

Automatically exported from code.google.com/p/rutorrent
0 stars 0 forks source link

Autotools' automove should respect $profileMask in conf/settings.php #852

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Enable automove (operation type move) in rutorrent interface > settings > 
autotools

What is the expected output? What do you see instead?
Directories created by automove should respect $profileMask

What environment are you using?
1. My ruTorrent version is: 3.5-1
2. My rTorrent version is: 0.9.3-1
3. I use web-server apache it version is 2.2.25-1 on linux
4. I use browser chrome it version is 29.0.1547.65 on osx

Are some errors present in the web-server log?
NA

Are some errors present in the browser error console?
NA

Please provide any additional information below.
Problem is in plugins/automove/util_rt.php file.
I created a patch, seems to be working, but I'm not a php developer.

Original issue reported on code.google.com by james.sl...@gmail.com on 5 Sep 2013 at 11:08

Attachments:

GoogleCodeExporter commented 8 years ago
It shouldn't. 
$profileMask is used for directories and files, which must be accessed both 
rtorrent and web-server users.

Original comment by novik65 on 6 Sep 2013 at 5:50

GoogleCodeExporter commented 8 years ago
OK, maybe don't use $profileMask, but the permissions for new directories 
should be configurable. 

Original comment by james.sl...@gmail.com on 6 Sep 2013 at 10:12

GoogleCodeExporter commented 8 years ago
Of course it is configurable. 
man umask

Original comment by novik65 on 6 Sep 2013 at 11:38

GoogleCodeExporter commented 8 years ago
$ grep ^umask /etc/profile
umask 022

Apache's umask is set to 022, but directories created by automove still have 
0777 permissions.

automove calls plugins/automove/util_rt.php: rtOpFiles when moving a directory,
inside function rtOpFiles a function rtMkDir gets called like so: rtMkDir( 
dirname( $dst ), 0777 )
Eventually php's "mkdir" function is called in php/util.php like so: 
@mkdir($dir,$perms,true);
where perms is always set to 0777.

Original comment by james.sl...@gmail.com on 6 Sep 2013 at 12:18

GoogleCodeExporter commented 8 years ago
>grep ^umask /etc/profile

1) profile of which user?
2) Anyway, try to search umask in the *rtorrent* man. For example, here - 
http://libtorrent.rakshasa.no/wiki/RTorrentMan

>where perms is always set to 0777.

This hasn't relation to the question. Because
real_mode = requested_mode & ~umask

Original comment by novik65 on 6 Sep 2013 at 2:28

GoogleCodeExporter commented 8 years ago
My umask is unchanged from the default 022,

If you check the source for the makeDirectory function in php/util.php. Notice 
the `umask(0)` before the calls to `mkdir($dir, $perms, true);`

Original comment by james.sl...@gmail.com on 6 Sep 2013 at 3:51

GoogleCodeExporter commented 8 years ago
You are right. For unknown reason author of plugin use makeDirectory call 
instead mkdir. Fixed.

Original comment by novik65 on 7 Sep 2013 at 7:42