~lynxman/ubuntu/precise/puppet/puppetlabsfixbug12844

« back to all changes in this revision

Viewing changes to .pc/CVE-2011-3872.patch/test/network/xmlrpc/client.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/network/xmlrpc/client'
 
7
require 'mocha'
 
8
 
 
9
class TestXMLRPCClient < Test::Unit::TestCase
 
10
  include PuppetTest
 
11
 
 
12
  def setup
 
13
    Puppet::Util::SUIDManager.stubs(:asuser).yields
 
14
    super
 
15
  end
 
16
 
 
17
  def test_set_backtrace
 
18
    error = Puppet::Network::XMLRPCClientError.new("An error")
 
19
    assert_nothing_raised do
 
20
      error.set_backtrace ["caller"]
 
21
    end
 
22
    assert_equal(["caller"], error.backtrace)
 
23
  end
 
24
 
 
25
  # Make sure we correctly generate a netclient
 
26
  def test_handler_class
 
27
    # Create a test handler
 
28
    klass = Puppet::Network::XMLRPCClient
 
29
    yay = Class.new(Puppet::Network::Handler) do
 
30
      @interface = XMLRPC::Service::Interface.new("yay") { |iface|
 
31
        iface.add_method("array getcert(csr)")
 
32
      }
 
33
 
 
34
      @name = :Yay
 
35
    end
 
36
    Object.const_set("Yay", yay)
 
37
 
 
38
    net = nil
 
39
    assert_nothing_raised("Failed when retrieving client for handler") do
 
40
      net = klass.handler_class(yay)
 
41
    end
 
42
 
 
43
    assert(net, "did not get net client")
 
44
  end
 
45
end