btsync and folder permissions


gcr

Recommended Posts

Hello!

On Linux, btsync doesn't set the "other users' execute" permissions on folders that it creates on remote clients:

$ ls -l
total 8
-rw-r--r-- 1 gcr gcr 146 Apr 30 20:42 index.htm
drwxr-xr-- 2 gcr gcr 4096 May 5 11:35 lights-ustream

where 'gcr' is my username. Can I get btsync to set the other executable bit? Without this, my web server gives a "403 Forbidden" error whenever someone browses that folder because it's running as a different user.

For the record, here are the permissions at the source:

$ ls -l
total 4
-rw-r--r-- 1 my-username users 146 May 1 21:11 index.htm
drwxr-xr-x 1 my-username users 148 May 5 11:34 lights-ustream

Link to comment
Share on other sites

  • 1 month later...

I suspect the problem is a bug in the function below (in pseudocode from disassembly). It seems to take a file permission set as an argument and return a specific permission set based on that. The return value is then used as part of a call to chmod.

I'm not certain what the intended logic is, but it seems that an input that is user writable:

input & 0x80 != 0

and group executable:

input & 0x8 != 0

results in a return value of 774, which is suspicious since the bug we see is a missing the other executable bit. A return of 775 would make more sense.


function sub_4c013a {
input = rdi;
result = 0x0;
if ((input & 0x80) != 0x0) {
result = 0x1b4;
}
else {
if ((input & 0x1) != 0x0) {
result = 0x124;
}
}
if ((input & 0x8) != 0x0) {
result = result | 0x48;
}
return result;
}

I suspect this:

result | 0x48 # 0110

should be this:

result | 0x49 # 0111

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.