~ubuntu-branches/ubuntu/precise/puppet/precise-proposed

« back to all changes in this revision

Viewing changes to acceptance/tests/resource/file/ticket_8740_should_not_enumerate_root_directory.rb

  • Committer: Package Import Robot
  • Author(s): Micah Anderson
  • Date: 2012-02-23 18:24:48 UTC
  • mfrom: (1.1.28) (3.1.36 sid)
  • Revision ID: package-import@ubuntu.com-20120223182448-belun93murza4w99
Tags: 2.7.11-1
* New upstream release
* Urgency set to high due to regressions in previous release
  and security vulnerabilities
* Execs when run with a user specified, but no group, get the root
  group. Similarly unexpected privileges are given to providers and
  types (egid remains as root), this is fixed with a patch from
  upstream (CVE-2012-1053)
* Fix Klogin write through symlink (CVE-2012-1054)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
test_name "#8740: should not enumerate root directory"
 
2
 
 
3
target = "/test-socket-#{$$}"
 
4
 
 
5
step "clean up the system before we begin"
 
6
on(agents, "rm -f #{target}")
 
7
 
 
8
step "create UNIX domain socket"
 
9
on(agents, %Q{ruby -e "require 'socket'; UNIXServer::new('#{target}').close"})
 
10
 
 
11
step "query for all files, which should return nothing"
 
12
on(agents, puppet_resource('file'), :acceptable_exit_codes => [1]) do
 
13
  assert_match(%r{Listing all file instances is not supported.  Please specify a file or directory, e.g. puppet resource file /etc}, stderr)
 
14
end
 
15
 
 
16
["/", "/etc"].each do |file|
 
17
  step "query '#{file}' directory, which should return single entry"
 
18
  on(agents, puppet_resource('file', file)) do
 
19
    files = stdout.scan(/^file \{ '([^']+)'/).flatten
 
20
 
 
21
    assert_equal(1, files.size, "puppet returned multiple files: #{files.join(', ')}")
 
22
    assert_match(file, files[0], "puppet did not return file")
 
23
  end
 
24
end
 
25
 
 
26
step "query file that does not exist, which should report the file is absent"
 
27
on(agents, puppet_resource('file', '/this/does/notexist')) do
 
28
  assert_match(/ensure\s+=>\s+'absent'/, stdout)
 
29
end
 
30
 
 
31
step "remove UNIX domain socket"
 
32
on(agents, "rm -f #{target}")