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

« back to all changes in this revision

Viewing changes to lib/puppet/util/reference.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:
36
36
 
37
37
  def self.pdf(text)
38
38
    puts "creating pdf"
39
 
    Puppet::Util.secure_open("/tmp/puppetdoc.txt", "w") do |f|
40
 
      f.puts text
41
 
    end
42
 
    rst2latex = which('rst2latex') || which('rst2latex.py') || raise("Could not find rst2latex")
 
39
    rst2latex = which('rst2latex') || which('rst2latex.py') ||
 
40
      raise("Could not find rst2latex")
 
41
 
43
42
    cmd = %{#{rst2latex} /tmp/puppetdoc.txt > /tmp/puppetdoc.tex}
44
 
    Puppet::Util.secure_open("/tmp/puppetdoc.tex","w") do |f|
45
 
      # If we get here without an error, /tmp/puppetdoc.tex isn't a tricky cracker's symlink
46
 
    end
 
43
    Puppet::Util.replace_file("/tmp/puppetdoc.txt") {|f| f.puts text }
 
44
    # There used to be an attempt to use secure_open / replace_file to secure
 
45
    # the target, too, but that did nothing: the race was still here.  We can
 
46
    # get exactly the same benefit from running this effort:
 
47
    File.unlink('/tmp/puppetdoc.tex') rescue nil
47
48
    output = %x{#{cmd}}
48
49
    unless $CHILD_STATUS == 0
49
50
      $stderr.puts "rst2latex failed"