~lynxman/ubuntu/precise/puppet/puppetlabsfixbug12844

« back to all changes in this revision

Viewing changes to .pc/CVE-2011-3872.patch/test/network/client/dipper.rb

  • Committer: Bazaar Package Importer
  • Author(s): Marc Deslauriers
  • Date: 2011-10-24 15:05:12 UTC
  • Revision ID: james.westby@ubuntu.com-20111024150512-yxqwfdp6hcs6of5l
Tags: 2.7.1-1ubuntu3.2
* SECURITY UPDATE: puppet master impersonation via incorrect certificates
  - debian/patches/CVE-2011-3872.patch: refactor certificate handling.
  - Thanks to upstream for providing the patch.
  - CVE-2011-3872

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env ruby
 
2
 
 
3
require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest')
 
4
 
 
5
require 'puppettest'
 
6
require 'puppet/file_bucket/dipper'
 
7
 
 
8
class TestDipperClient < Test::Unit::TestCase
 
9
  include PuppetTest::ServerTest
 
10
 
 
11
  def setup
 
12
    super
 
13
    @dipper = Puppet::FileBucket::Dipper.new(:Path => tempfile)
 
14
  end
 
15
 
 
16
  # Make sure we can create a new file with 'restore'.
 
17
  def test_restore_to_new_file
 
18
    file = tempfile
 
19
    text = "asdf;lkajseofiqwekj"
 
20
    File.open(file, "w") { |f| f.puts text }
 
21
    md5 = nil
 
22
    assert_nothing_raised("Could not send file") do
 
23
      md5 = @dipper.backup(file)
 
24
    end
 
25
 
 
26
    newfile = tempfile
 
27
    assert_nothing_raised("could not restore to new path") do
 
28
      @dipper.restore(newfile, md5)
 
29
    end
 
30
 
 
31
    assert_equal(File.read(file), File.read(newfile), "did not restore correctly")
 
32
  end
 
33
end
 
34