diff options
author | Martin Pärtel <martin.partel@gmail.com> | 2012-05-18 12:30:31 +0300 |
---|---|---|
committer | Martin Pärtel <martin.partel@gmail.com> | 2012-05-18 12:30:31 +0300 |
commit | 1cfc042b5a5e6dc8ea5d81d9d719d472a1800167 (patch) | |
tree | 3d1eb3f2d8661d90d57d2f0364bee3ed9eba7fbb /tests | |
parent | cb4cf90bd7e13ecb7b2a286d548fe853796948c4 (diff) | |
download | bindfs-1cfc042b5a5e6dc8ea5d81d9d719d472a1800167.tar.gz |
Fixed --create-as-user.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/common.rb | 2 | ||||
-rwxr-xr-x | tests/test_bindfs.rb | 22 |
2 files changed, 23 insertions, 1 deletions
diff --git a/tests/common.rb b/tests/common.rb index ac1ef43..7174257 100755 --- a/tests/common.rb +++ b/tests/common.rb @@ -18,7 +18,7 @@ # along with bindfs. If not, see <http://www.gnu.org/licenses/>. # -require 'fileutils.rb' +require 'fileutils' include FileUtils # Set the default umask for all tests diff --git a/tests/test_bindfs.rb b/tests/test_bindfs.rb index ff1ee24..1f78250 100755 --- a/tests/test_bindfs.rb +++ b/tests/test_bindfs.rb @@ -74,6 +74,28 @@ testenv("-u nobody -m #{Process.uid} -p 0600,u+D") do assert { File.stat('mnt/file').uid == Process.uid } end +root_testenv("", :title => "--create-as-user should be default for root") do + chmod(0777, 'src') + `su -c 'touch mnt/file' nobody` + `su -c 'mkdir mnt/dir' nobody` + `su -c 'ln -sf /tmp/foo mnt/lnk' nobody` + + assert { File.stat('mnt/file').uid == nobody_uid } + assert { File.stat('mnt/file').gid == nogroup_gid } + assert { File.stat('src/file').uid == nobody_uid } + assert { File.stat('src/file').gid == nogroup_gid } + + assert { File.stat('mnt/dir').uid == nobody_uid } + assert { File.stat('mnt/dir').gid == nogroup_gid } + assert { File.stat('src/dir').uid == nobody_uid } + assert { File.stat('src/dir').gid == nogroup_gid } + + assert { File.lstat('mnt/lnk').uid == nobody_uid } + assert { File.lstat('mnt/lnk').gid == nogroup_gid } + assert { File.lstat('src/lnk').uid == nobody_uid } + assert { File.lstat('src/lnk').gid == nogroup_gid } +end + testenv("--create-with-perms=og=r:ogd+x") do touch('src/file') mkdir('src/dir') |