Bug 14734 - inherit owner not working on created directories
Summary: inherit owner not working on created directories
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.14.5
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-08 23:02 UTC by Björn Jacke
Modified: 2021-07-19 06:18 UTC (History)
3 users (show)

See Also:


Attachments
git-am fix for 4.14.next. (2.84 KB, patch)
2021-06-09 22:53 UTC, Jeremy Allison
bjacke: review+
Details
git-am fix for 4.14.next. (3.27 KB, patch)
2021-06-11 17:10 UTC, Jeremy Allison
jra: review? (slow)
npower: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Björn Jacke 2021-06-08 23:02:23 UTC
in samba 4.14 inherit owner is no longer working correctly on directories. They are created with the ownership of the creating user instead of the ownership of the parent directory. In 4.13 this was still working fine.
Comment 1 Jeremy Allison 2021-06-09 00:17:28 UTC
I have a slight suspicion that this *may* be related to:

https://bugzilla.samba.org/show_bug.cgi?id=14732

any chance you can pull the patch from that and re-test ?
Comment 2 Björn Jacke 2021-06-09 09:53:36 UTC
I tried but it doesn't fix this issue unfortunately
Comment 3 Jeremy Allison 2021-06-09 15:31:29 UTC
OK, then can you post the smb.conf and exact steps you used to reproduce ? Thanks.
Comment 4 Björn Jacke 2021-06-09 16:44:16 UTC
/tmp/t is root owned, chmod 777 like this:
drwxrwxrwx   4 root   root  4096 Jun  9 18:35 .

[tmptest]
        path=/tmp/t
        read only = no
        inherit owner = yes
        inherit permissions = yes

in my case it was a simple security = ads joined member server.

creating a file results in a root owned file. creating a folder results in the connected user being the owner.
Comment 5 Rowland Penny 2021-06-09 18:15:45 UTC
(In reply to Björn Jacke from comment #4)
Can we see the [global] part of your smb.conf ?

I ask this because it works for me.

pi@rpi400:~ $ samba -V
Version 4.14.5-Debian

pi@rpi400:~ $ ls -la /tmp/t
total 32
drwxrwxrwx   4 root root 4096 Jun  9 19:09 .
drwxrwxrwt  16 root root 4096 Jun  9 19:07 ..
-rwxrwxr-x+  1 root root    0 Jun  9 19:09 test2.txt
drwxrwxr-x+  2 root root 4096 Jun  9 18:57 testdir
drwxrwxr-x+  2 root root 4096 Jun  9 19:09 testdir2
-rwxrwxr-x+  1 root root    0 Jun  9 18:57 test.txt
Comment 6 Jeremy Allison 2021-06-09 20:04:32 UTC
OK, I'm 100% sure this is the mkdir_internal() using pathref_fsp I just discovered and fixed in master.

I also have a test :-).

I'll back-port as I think the fix will be different to the one in master.
Comment 7 Jeremy Allison 2021-06-09 22:53:13 UTC
Created attachment 16646 [details]
git-am fix for 4.14.next.

Ralph, I think this is the fix. Doh....
Comment 8 Jeremy Allison 2021-06-09 22:53:57 UTC
Comment on attachment 16646 [details]
git-am fix for 4.14.next.

Björn, can you confirm ?
Comment 9 Jeremy Allison 2021-06-09 23:09:10 UTC
For master:

https://gitlab.com/samba-team/devel/samba/-/pipelines/318071364
Comment 10 Björn Jacke 2021-06-10 08:43:38 UTC
Comment on attachment 16646 [details]
git-am fix for 4.14.next.

wow, thanks for the quick fix! Looks good for me now! :)
Comment 11 Björn Jacke 2021-06-10 08:45:46 UTC
Karo, please schedule this for 4.14
Comment 12 Karolin Seeger 2021-06-10 09:20:48 UTC
(In reply to Björn Jacke from comment #11)
Pushed to autobuild-v4-14-test.
Comment 13 Ralph Böhme 2021-06-10 09:24:36 UTC
(In reply to Karolin Seeger from comment #12)
Can you cancel the autobuild? This is patch is not even in master yet... It's very likely correct, but I still need to review this.
Comment 14 Karolin Seeger 2021-06-10 09:31:08 UTC
(In reply to Ralph Böhme from comment #13)
Removed for now
Comment 15 Björn Jacke 2021-06-10 09:31:41 UTC
oops, I didn't notice that, sorry... 8-)
Comment 16 Jeremy Allison 2021-06-11 17:10:04 UTC
Created attachment 16652 [details]
git-am fix for 4.14.next.

Updated patch with cherry-pick refspec's from master. (fchmod needed a slight back-port as the cherry-pick didn't apply cleanly).
Comment 17 Karolin Seeger 2021-06-29 06:42:27 UTC
(In reply to Jeremy Allison from comment #16)
Pushed to autobuild-v4-14-test.
Comment 18 Samba QA Contact 2021-07-12 13:53:12 UTC
This bug was referenced in samba v4-14-test:

f8c4bcb0b22d3c20419bec2f175785266e629f3a
Comment 19 Samba QA Contact 2021-07-13 10:34:14 UTC
This bug was referenced in samba v4-14-stable (Release samba-4.14.6):

f8c4bcb0b22d3c20419bec2f175785266e629f3a
Comment 20 Karolin Seeger 2021-07-19 06:18:08 UTC
Closing out bug report.

Thanks!