-
Notifications
You must be signed in to change notification settings - Fork 497
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ensure correct user homedir perms on user.update
- Loading branch information
Showing
5 changed files
with
97 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from middlewared.test.integration.assets.account import user | ||
from middlewared.test.integration.assets.pool import dataset | ||
from middlewared.test.integration.utils import call, ssh | ||
|
||
|
||
def test_chown_on_update(): | ||
"""This test ensures that on user.update, if the users | ||
home directory permissions are incorrect, we will | ||
fix (chown) them accordingly.""" | ||
with dataset("unpriv_homedir") as homedir: | ||
temp = {"username": "unpriv", "full_name": "unpriv", "group_create": True, "password": "pass"} | ||
with user(temp) as u: | ||
ssh(f"chown nobody:nobody /mnt/{homedir}") | ||
st = call("filesystem.stat", f"/mnt{homedir}") | ||
assert st["user"] == "nobody" | ||
assert st["group"] == "nobody" | ||
call("user.update", u["id"], {"home": f"/mnt/{homedir}"}) | ||
st = call("filesystem.stat", f"/mnt/{homedir}") | ||
assert st["user"] == "unpriv" | ||
assert st["group"] == "unpriv" |